c - 无法使用eclipse调试linux

标签 c linux eclipse

在编译 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/

相关文章:

c - C程序预处理后生成哪个文件?

c - 如何在for循环中存储从rand()函数获得的数字?

linux - OpenGL 3+ 的 UI 实用程序库,或者 Xlib 可以吗?

使用 MinGW 的 Eclipse CDT 不在控制台中输出

javax.persistence.PersistenceException : No Persistence provider for EntityManager named XX

c - 如何在 C 中实现时钟例程

c - 为什么返回地址之前是 "NOP-Block"和Shellcode?

linux - 使用管道获取已排序的已登录用户的唯一列表

linux - "Can' t解析符号的可能原因”?

java - 安装的java版本与eclipse中显示的版本不匹配