Ask Your Question

Debugging with QtCreator

asked 2015-03-04 17:11:44 -0500

Pototo gravatar image

I am trying to switch from Eclipse to QtCreator (the indexing on Eclipse is very poor after our recent switch from fuerte to indigo). And while I have indexing and building working wonderfully in QtCreator, I cannot get debugging to work at all. I found the following article on this forum:

I did the following with QtCreator 3.0.1:

  1. Switch Projects/Build & Run / Run
  2. Set run configuration as the name of my executable
  3. Set program arguments
  4. Set working directory to ~/workspace/bin ( a newly created folder)
  5. Checked my run environment (the ROS_MASTER_URI and ROS_ROOT variables are correctly set)

And then I tried to debug and I get a small error window titled "Unknown error" with no message. Debug never reaches the first line of the program. But if I execute the program by hand, it works fine.

Any ideas on what I have not configured? In general, I should be able to debug with qtcreator, right?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2015-03-04 18:02:33 -0500

ebeowulf gravatar image

It seems to be a QtCreator problem ( ). Removing the CMakeLists.txt.user file fixes the issue temporarily... upgrading to Creator 3.1.0 may solve the issue.

edit flag offensive delete link more

answered 2015-03-05 01:55:33 -0500

kokirits gravatar image

What I do is: after opening my CMakeLists.txt file, right click on the root folder named "Project", run Cmake, and then for arguments I use:


for debugging with QtCreator and


for the release version.

edit flag offensive delete link more

answered 2015-05-15 04:04:40 -0500

jespestana gravatar image

Hey, there is another post in ROS Answers addressing how to debug a rosnode in Qtcreator:

I think that the answer can be summarized to:

  1. compile the node/package that you want to compile in debug mode (add "set(CMAKE_BUILD_TYPE Debug)" to your CMakeLists.txt)
  2. start your roscore and everything else as usual, except for the node you want to debug
  3. start qtcreator with "sudo" (remember to source correctly your catkin workspace)
  4. in qtcreator start the debugging mode for the rosnode by going to "Debug"->"Start Debugging"->"Attach to unstarted Application...", look for your compiled node, it should be in: "${CATKIN_WORKSPACE_FOLDER}"/devel/lib/package_name/node_name and click "Start Watching".
  5. start the node in a terminal either with rosrun or roslaunch
  6. enjoy...

Note: you need to run qtcreator with "sudo", otherwise you get a "ptrace operation not allowed" problem. Note2: if you try to run qtcreator as a normal user afterwards, you will have problems accessing some of the Qt configuration files of your home folder, run these commands to get this back to normal:

sudo chown -R ${USER}:${USER} .qt
sudo chown -R ${USER}:${USER} .config/
edit flag offensive delete link more



Instead of running qtcreator as sudo, you should probably just allow ptrace of non-child-processes. echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope more info

GordonShumway gravatar image GordonShumway  ( 2015-07-08 08:31:56 -0500 )edit

Probably even more safe would be to allow only gdb to ptrace non-child-processes.

sudo apt-get install libcap2-bin 
sudo setcap cap_sys_ptrace=eip /usr/bin/gdb
GordonShumway gravatar image GordonShumway  ( 2015-07-08 08:49:55 -0500 )edit

Thanks a lot! More info about first solution: , so I see that I can recover the original more secure behavior doing echo 1 | sudo tee /proc/sys/kernel/yama/ptrace_scope . About your second solution, more info here: .

jespestana gravatar image jespestana  ( 2015-07-09 03:25:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-04 17:11:44 -0500

Seen: 4,497 times

Last updated: May 15 '15