kdb
[Top] [All Lists]

Re: Line numbers in kdb?

To: Dean Roe <roe@xxxxxxx>
Subject: Re: Line numbers in kdb?
From: Keith Owens <kaos@xxxxxxx>
Date: Fri, 07 Jun 2002 12:05:17 +1000
Cc: holt@xxxxxxx (Robin Holt), dcn@xxxxxxx (Dean Nelson), kdb@xxxxxxxxxxx
In-reply-to: Your message of "Thu, 06 Jun 2002 16:06:57 EST." <200206062106.QAA26340@shaft.americas.sgi.com>
Sender: owner-kdb@xxxxxxxxxxx
On Thu, 6 Jun 2002 16:06:57 -0500 (CDT), 
Dean Roe <roe@xxxxxxx> wrote:
>Keith Owens wrote
>> To get line numbers you have to compile the kernel with -g and use
>> objdump.  You will have to exit kdb or put the kernel image and source
>> on a different machine from the one you are debugging in order to run
>> objdump.  Given a failing function, identify the object it lives in.
>> Example: xlog_state_do_callback which is in fs/xfs/xfs_log.o
>> 
>> cd linux
>> rm fs/xfs/xfs_log.o
>> make CFLAGS_xfs_log.o=-g vmlinux
>> s=$(sed -ne '/xlog_state_do_callback/s/ .*//p' System.map | tr '[a-z]' 
>> '[A-Z]')
>> e=$(echo -e "obase=16\nibase=16\n$s+500" | bc)
>> objdump -S --start-address=0x$s --stop-address=0x$e vmlinux
>
>Any idea how to get this to work with kernel modules?  I haven't
>been able to get any source intermixed with the instructions of any
>kernel modules (built with -g of course).

You need the start address of the section in the module, which is why
bt prints it.  Add --adjust-vma=<section-start> to objdump.  See
Documentation/kdb/kdb_bt.man, "MATCHING TRACE TO KERNEL CODE".


<Prev in Thread] Current Thread [Next in Thread>