I am not familiar with Eclipse, as I prefer to use CLion. However, for projects that do not use CMake build system, I will have to use Eclipse.
In this post, I will discuss how to remote-debug with Eclipse. The setup is as follows:
target (local): running the application from, say terminal
host (Eclipse): debug the program as it is running
First, open up the project with Eclipse. Make sure that Eclipse can build the project.
Next, setup gdbserver on the target:
$ gdbserver :7777 EXECUTABLE ARG1 ARG2 ...
Here, 7777 is the port we will use for remote-debugging, EXECUTABLE is the binary file we are going to debug as it is running, and ARG1, ARG2, ... are appropriate arguments for this program.
Next, we setup Eclipse debugging.
From the menu, select Run --> Debug Configurations... --> C/C++ Remote Application (double click) --> Using GDB (DSF) Auto Remote Debugging Launcher (Select other) --> GDB (DSF) Manual Remote Debugging Launcher --> OK. Basically, we have selected "manual" remote debugging configuration here.
Make sure Project and C/C++ Application fields are properly filled, i.e., you should be able to select the project from the drop down menu if the project import/build is successful, and choose the EXECUTABLE for C/C++ Application.
In the Debugger tab --> Connection tab, change Port Number to 7777.
Finally, click Debug button. You now should be able to remote debug with Eclipse.
Happy hacking!
No comments:
Post a Comment