Using gdb for kernel module post mortem

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Hi,

I'm trying to perform a post mortem on a kernel panic due to a
segfault in a kernel module using gdb to do some disassembly/source
browsing.  My target is an embedded PPC device.

After doing a bit of googling I found instructions/hints about using /
sys/module/<mod-name>/sections and add-symbol-file in gdb to load the
symbols. Thats all working fine, after running add-symbol-file I can
view the source for the kernel module and it seems to know the correct
function addresses.

My problem is when I try to get the disassembly gdb can't find the
data to to disassembly with
(gdb) disassemble function-in-module
Dump of assembler code for function  function-in-module
0xa50c4af4 <function-in-module+0>:  Cannot access memory at address
0xa50c4af4

I can disassemble a function build into the kernel just fine
(gdb) disassemble MMU_init
Dump of assembler code for function MMU_init:
0x8038e80c <MMU_init+0>:        mflr    r0
0x8038e810 <MMU_init+4>:        stwu    r1,-16(r1)
....

I'm guessing I need to somehow tell gdb to load the data from the
module.o file in addition to the vmlinux image, but I thought add-
symbol-file would do that.  Most of the instructions I looked at were
using kgdb to connect to a live device and presumably getting the full
memory map through that. In my case the hardware platform doesn't have
an extra serial port I can use for kgdb.

Can anyone shed some light on how to use gdb in this situation without
a live system?

I'm not sure if I should be asking gdb guys or linux guys so feel free
to redirect me to another list.

Thanks,
Chris


Site Timeline