# Debugging using ROS Qt Creator Plugin

Hi,

I'm with ROS since two weeks and i couldn't figure out yet how to set up QT Creator to automatically attach the debugger after pressing F5.

In my case, after pressing F5, the node is starting in the ROS Terminal as supposed but I expect also the Debugger to attach and if there are Breakpoints set it should stop there.

My workaround is to "Attach to running application" which works fine, but in this case I cannot debug Initialisation code because is is already processed. The "Attach to unstarted application" is also working, but also here it doesn't stop in initialisation code either.

My questions are: How do I set up Qt Creator to automatically attach to the application by pressing F5? How can I set it up to process breakpoints already from the first line of code?

edit retag close merge delete

I'm also interested in this question.

( 2018-07-18 20:50:54 -0600 )edit

I could 'nt figure it out yet. To debug initialisation i put an while(1) loop at the beginning and jump over it after i attached manually. It's really anoying

( 2018-07-19 08:57:45 -0600 )edit

Sort by » oldest newest most voted

Hello guys,

I've suffered from the same problem until discovering a pretty clear way to do it. First, we have to configure the project "build" and "run" parameters that can be accessed through the section "Projects" in the right sidebar.

After access the "Projects" section, we need to set up all parameters related to the build process as the following steps:

1) Remove the current catkin_make configuration (this configuration is just an execution of the conventional process that we are already used to). To remove it just hover your arrow near "Details", hence an "X" will appear.

2) After removing the current build step configuration, click on "Add build step" and choose the option "Custom Process Step" and fill the blanks according to your workspace environment.

Above I filled in the blanks considering the tips I found here and my workspace build directory location (in order to have it already done at this step you have to run the "catkin_make" command at least once before it). In my case, my build directory is located at /home/matheus/rosworks/build.

Moreover, the arguments that I used were:

../src -DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel -DCMAKE_BUILD_TYPE=Debug.

Notice that the -DCMAKE_BUILD_TYPE=Debug CMake argument is used aiming to allow us to attach to the ROS application in runtime.

4) Once the MakeFile is generated by the CMake, we are able to run the make command, to achieve it we must add other "Custom Process Step".

Above, the argument ''-j12" specifies the number of process to run simultaneously.

If an application requires an install step, other "Custom Process Step" with a make command and install argument can be added.

5) Now, you should be able to build your project. To accomplish it easier we can type ctrl+b to build and afterwards alt+4 to keep up with the compilation.

Now, in order to perform the debug just pressing F5 we need to configure the "run" section of the IDE. For it, follow the next steps:

1) On the "Project" section select the "run" tab.

2) Click on "Add" and then on "Custom Executable".

3) Now, add the path to your ROS executable that probably is placed in your_workspace/devel/lib/your_package_name and the path to your build directory as well.

Congratulations!!

Now you must be able to set up your breakpoints and press F5 to debug your ROS application.

Please, if it was useful for anyone or if you still have a remaining doubt, please let me know that.

Best regards for all.

more

awesome... b

( 2018-12-14 06:11:48 -0600 )edit