在编译 Linux 内核之后,我正在尝试使用 eclipse 调试 Linux。 我创建了一个新项目,现在在运行-> 调试配置中我给了 vmlinux 路径。 提供 TCP 端口并单击 DEBUG。 我遇到了以下错误
"/home/linux-kernel/vmlinux":
not in executable format: File format not recognized TCP port and clicked on debug.
请指出我哪里出错了。
最佳答案
Linux 内核不是可执行程序。它接管了整个计算机。所以你需要在不同的 PC 或 PC 模拟器上运行内核,如 qemu .
这是一篇博文,详细说明了如何设置所有内容:Debugging the Linux kernel using Eclipse/CDT and Qemu
您收到的错误表明您没有正确配置远程调试。 Eclipse 没有连接到正在运行的 qemu,而是像普通程序一样尝试启动 Linux 内核。在这里查看如何配置远程调试的启动配置:
Click on the "Debugger" tab, and in the "Debugger" listbox select the "gdbserver Debugger".
Next, modify the "Stop on startup at:" to "start_kernel".
Below this, you'll notice a frame named "Debugger Options";
click the "Connection" tab in this frame and modify the "Type" to "TCP" and the "Port number" to 1234.
Continue by clicking the "Debug" button.
如果这不起作用,请确保 qemu 实际使用端口 1234
。
关于c - 无法使用eclipse调试linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32821849/