考虑以下 Linux 内核转储堆栈跟踪;例如,您可以通过调用 panic("debugging a Linux kernel panic");
:
[<001360ac>] (unwind_backtrace+0x0/0xf8) from [<00147b7c>] (warn_slowpath_common+0x50/0x60)
[<00147b7c>] (warn_slowpath_common+0x50/0x60) from [<00147c40>] (warn_slowpath_null+0x1c/0x24)
[<00147c40>] (warn_slowpath_null+0x1c/0x24) from [<0014de44>] (local_bh_enable_ip+0xa0/0xac)
[<0014de44>] (local_bh_enable_ip+0xa0/0xac) from [<0019594c>] (bdi_register+0xec/0x150)
- 在
unwind_backtrace+0x0/0xf8
中+0x0/0xf8
代表什么? - 如何查看
unwind_backtrace+0x0/0xf8
的C代码? - 如何解读 panic 的内容?
最佳答案
这只是一个普通的回溯,那些函数以相反的顺序调用(第一个被调用的被前一个调用,依此类推):
unwind_backtrace+0x0/0xf8
warn_slowpath_common+0x50/0x60
warn_slowpath_null+0x1c/0x24
ocal_bh_enable_ip+0xa0/0xac
bdi_register+0xec/0x150
bdi_register+0xec/0x150
是符号 + 偏移量/长度,Understanding a Kernel Oops 中有更多信息以及如何调试内核 oops。在 Debugging the Kernel 上还有这个出色的教程
注意:正如 Eugene 下面的建议,您可能想尝试 addr2line首先,它仍然需要一个带有调试符号的图像,例如
addr2line -e vmlinux_with_debug_info 0019594c(+offset)
关于c - 如何阅读、理解、分析和调试 Linux 内核 panic ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13468286/