使用 kgdb 调试 Linux 内核时堆栈跟踪中的行号错误
我正在尝试通过串行使用 kgdb 在 Linux 内核中调试 Ethernet-MAC 的驱动程序。
我通过在代码中的所需位置调用“kgdb_breakpoint()
”来停止执行,并重新编译内核。
但是在代码停止后,正如您在屏幕截图中可能注意到的,回溯显示正确函数图和源文件名,但由于某种原因,相应的行号不正确。
请注意:我已在 boot-args 中设置了“CONFIG_FRAME_POINTER
”和“nokaslr
”来编译此内核。
有没有办法可以在这里看到具有正确行号的堆栈跟踪?
(我在此屏幕截图中使用了 QtCreator,尽管行为与命令行或 TUI 上的 gdb 类似)
Edit: No matter, whichever function I put the `kgdb_breakpoint()` in, (inside the driver source) , line number in the stacktrace always say the same line number for the halted function.
I am trying to debug a driver for an Ethernet-MAC in the Linux kernel using kgdb over serial.
I halt the execution by making a call to "kgdb_breakpoint()
" at the desired location in the code and recompile the kernel.
But after the code halts, as you may notice in the screenshot the backtrace shows correct function-graph and source filenames but, for some reason corresponding line numbers are not correct.
Please note: I have compiled this kernel with "CONFIG_FRAME_POINTER
" set and "nokaslr
" in the boot-args.
Is there a way I can see a stack trace with correct line number here ?
(I have used QtCreator during this screenshot, although behavior is similar with gdb over command-line or TUI)
Edit: No matter, whichever function I put the `kgdb_breakpoint()`
in, (inside the driver source) , line number in the stacktrace always say the same line number for the halted function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论