ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Can I debug node in gdb without new xterm?

asked 2015-01-28 18:02:41 -0500

Matthew.J gravatar image

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.

edit retag flag offensive close merge delete

Comments

Isn't the second option you list what you ask?

gvdhoorn gravatar image gvdhoorn  ( 2015-01-29 02:02:20 -0500 )edit

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.

Matthew.J gravatar image Matthew.J  ( 2015-01-29 02:17:03 -0500 )edit

1 Answer

Sort by » oldest newest most voted
4

answered 2015-01-29 02:38:48 -0500

gvdhoorn gravatar image

updated 2015-01-29 06:17:12 -0500

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.

edit flag offensive delete link more

Comments

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.

Matthew.J gravatar image Matthew.J  ( 2015-01-29 04:08:22 -0500 )edit
1

You probably need to add output="screen" to the node element (in your launch file) of the node that you want to debug.

gvdhoorn gravatar image gvdhoorn  ( 2015-01-29 04:38:31 -0500 )edit

Yes that was it. THX

Matthew.J gravatar image Matthew.J  ( 2015-01-29 05:56:20 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-01-28 18:02:41 -0500

Seen: 1,572 times

Last updated: Jan 29 '15