Debugging ROS nodes started from launch file with Eclipse

By Christopher, December 14, 2014

Requirements

  • Imported ROS project into Eclipse workspace (see http://wiki.ros.org/IDEs for details)
  • Installed gdbserver (apt-get install gdbserver)

Follow the steps below.

1) Adjust the launch file:

Add this to the node tag if you want a new terminal window for the process

1
launch-prefix="xterm -e gdbserver localhost:10000"

or add the following if you want to stay in the current started terminal.

1
launch-prefix="gdbserver localhost:10000"

2) Eclipse Debug Configuration

Add a new Eclipse debug run configuration for C/C++ Remote Application. Adjust the path to your C/C++ application binary, leave everything else default

Debug Configurations _023

3) Execution

First execute ROS launch with your launch file. You can either do this from the terminal or by a external tools hook from eclipse (http://answers.ros.org/question/10043/how-do-i-start-a-launch-file-from-eclipse-ide/)

Because I am using a multi-package ROS-Eclipse project and my launch files are always in the root of a package I am using ${container_name}  instead of ${project_name} for the external tools arguments in Eclipse.

Now you will see that a small gdb terminal has opened if you are using the first version of launch file configuration from above.

gdbserver_024

Now, just start your Eclipse debug configuration and you are ready to debug.

 

Further References