Search code examples
linuxlinux-kernelgdbaddr2line

addr2line on kernel address cannot find source line


I am building a custom linux kernel (4.15.0 x86_64) with debug symbol enabled. I find that addr2line fails to point to the source code line.

addr2line -e vmlinux 0xffffffff9be625f0

gdb also returns "No line number information available for address" with following command

$ gdb ../linux/vmlinux /proc/kcore

... Reading symbols from ../linux/vmlinux...done.

$ info line *0xffffffff9be625f0

What should be done to get the line number from address? Here is the .config file.


Solution

  • First - try to find out which procedure this address belongs to from /proc/kallsyms. Then compute the offset of this address from the beginning of this proc. Then:

    objdump -D -S -l ./vmlinux | less
    

    find your procedure name and then move to your offset. Of course your kernel vmlinux should be compiled with debugging symbols.