0
$\begingroup$

Rosanswers logo

In this tutorial is shown how to launch nodes in gdb (and other tools). There are two options for gdb.

  • launch-prefix="xterm -e gdb --args" : run your node in a gdb in a separate xterm window, manually type run to start it
  • launch-prefix="gdb -ex run --args" : run your node in gdb in the same xterm as your launch without having to type run to start it

Is it possible to run my node in gdb in the same xterm as my launch with having to manually type run to start it? My attempts to do that were unsuccessful.


Originally posted by Matthew.J on ROS Answers with karma: 32 on 2015-01-28

Post score: 0


Original comments

Comment by gvdhoorn on 2015-01-29:
Isn't the second option you list what you ask?

Comment by Matthew.J on 2015-01-29:
Nope :-( it automatically runs the node. I want to set breakpoint and som awatches first. And when I remove the run command gdb doesn't launch correctly.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Seems I misread what you wanted.

Is it possible to run my node in gdb in the same xterm as my launch with having to manually type run to start it?

I initially thought you wanted with-out having to manually type run .., hence my confusion.

According to Debugging with GDB - File Options - 2.1.1 Choosing Files:

-ex command

     Execute a single gdb command.

You tried gdb -ex run --args. I would assume gdb --args should do what you want (ie: start gdb with the specified executable, but not run it).


Edit: btw, I've assumed you want to start your node(s) using launch files. That is obviously not required, you could just as well start the node you want to debug with gdb --args /path/to/node/binary ARGS. But that would be in a separate terminal, so may not be what you want.


Originally posted by gvdhoorn with karma: 86574 on 2015-01-29

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by Matthew.J on 2015-01-29:
Great but there is still one problem. When I run it with gdb --args I can't see what I'm writing in terminal. It's hidden like a password.

Comment by gvdhoorn on 2015-01-29:
You probably need to add output="screen" to the node element (in your launch file) of the node that you want to debug.

Comment by Matthew.J on 2015-01-29:
Yes that was it. THX

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.