使用 kgdb 调试 Linux 内核时堆栈跟踪中的行号错误

发布于 2025-01-13 05:40:17 字数 677 浏览 1 评论 0原文

我正在尝试通过串行使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文