Quantcast
Channel: Kernel stack trace to source code lines - Server Fault
Viewing all articles
Browse latest Browse all 6

Answer by Lekensteyn for Kernel stack trace to source code lines

$
0
0

Given an unstripped vmlinux with debugging symbols (typically included with "linux-devel" or "linux-headers" packages matching your kernel version), you can use the addr2line program included with binutils to translate addresses to lines in source files.

Consider this call trace:

Call Trace: [<ffffffff8107bf5d>] ? finish_task_switch+0x3d/0x120 [<ffffffff815f3130>] __schedule+0x3b0/0x9d0 [<ffffffff815f3779>] schedule+0x29/0x70 [<ffffffff815f2ccc>] schedule_hrtimeout_range_clock.part.24+0xdc/0xf0 [<ffffffff81076440>] ? hrtimer_get_res+0x50/0x50 [<ffffffff815f2c6f>] ? schedule_hrtimeout_range_clock.part.24+0x7f/0xf0 [<ffffffff815f2cf9>] schedule_hrtimeout_range_clock+0x19/0x60 [<ffffffff815f2d53>] schedule_hrtimeout_range+0x13/0x20 [<ffffffff811a8aa9>] poll_schedule_timeout+0x49/0x70 [<ffffffff811aa203>] do_sys_poll+0x423/0x550 [<ffffffff814eaf8c>] ? sock_recvmsg+0x9c/0xd0 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811a8c50>] ? poll_select_copy_remaining+0x140/0x140 [<ffffffff811aa3fe>] SyS_poll+0x5e/0x100 [<ffffffff816015d2>] system_call_fastpath+0x16/0x1b

Then the address of the caller in poll_select_copy_remaining can be found with:

$ addr2line -e /tmp/vmlinux ffffffff811a8c50/tmp/linux-3.15-rc8/fs/select.c:209

Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>