Consider the following linux kernel dump stack trace, you can trigger a panic from the kernel source code by calling panic(\"debugging a linux kernel panic\");
:
Here are two alternatives for addr2line
. Assuming you have the proper target's toolchain, you can do one of the following:
Use objdump
:
locate your vmlinux
or the .ko
file under the kernel root directory, then disassemble the object file :
objdump -dS vmlinux > /tmp/kernel.s
Open the generated assembly file, /tmp/kernel.s
. with a text editor such as vim
. Go to
unwind_backtrace+0x0/0xf8
, i.e. search for the address of unwind_backtrace
+ the offset
. Finally, you have located the problematic part in your source code.
Use gdb
:
IMO, an even more elegant option is to use the one and only gdb
. Assuming you have the suitable toolchain on your host machine:
gdb
.list *(unwind_backtrace+0x10)
.For additional information, you may checkout the following resources: