Reputation: 1226
I am trying to debug Linux using eclipse, after compiling the Linux kernel. I created a new project, now in run->debug configurations I gave path to vmlinux. gave TCP port and clicked on DEBUG. I got below error
"/home/linux-kernel/vmlinux":
not in executable format: File format not recognized TCP port and clicked on debug.
Please point me where I am going wrong.
Upvotes: 0
Views: 186
Reputation: 328604
The Linux kernel isn't an executable program. It takes over the whole computer. So you need to run the kernel on a different PC or on a PC emulator like qemu.
Here is a blog post which gives detailed instructions how to set everything up: Debugging the Linux kernel using Eclipse/CDT and Qemu
The error which you get suggests that you didn't configure remote debugging correctly. Instead of connecting to the running qemu, Eclipse tries to start the Linux kernel like a normal program. See here how to configure the Launch Configuration for remote debugging:
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.
If that doesn't work, make sure that qemu actually uses port 1234
.
Upvotes: 1