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

Weird behavior of GDB with roslaunch

asked 2019-11-20 08:24:35 -0500

ignite gravatar image

updated 2019-11-20 08:48:40 -0500

I am trying to debug a ROS project which is started by the followinng (simplified) launch file. When the launch file is executed with launch-prefix="gdb --args" appended to the last part of every node tag, gdb seems to start fine. (I also compile the project with catkin_make -DCMAKE_BUILD_TYPE=Debug.)

However, when I try to type run command, it's showing a weird behavior, seeeming not getting the correct input that I type (please see at the very last part of the output).


  <arg name="cf_path" default = "..." />
  <arg name="path" default = "..." />

  <node name="feature_tracker" pkg="feature_tracker" type="feature_tracker" output="log" launch-prefix="gdb --args">
    <param name="cf_file" type="string" value="..." />
    <param name="folder" type="string" value="..." />

  <node name="estimator" pkg="estimator" type="estimator" output="screen" launch-prefix="gdb --args">
    <param name="cf_file" type="string" value="..." />
    <param name="folder" type="string" value="..." />

  <node name="pose_graph" pkg="pose_graph" type="pose_graph" output="screen" launch-prefix="gdb --args">


x@laptop:~/project$ roslaunch estimator project.launch
... logging to /home/x/.ros/log/9a2f20e0-0b9d-11ea-be50-380025e3d4b0/roslaunch-laptop-14259.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://laptop:45849/


 * /feature_tracker/cf_file: /home/x/project...
 * /feature_tracker/folder: /home/x/project...
 * /pose_graph/cf_file: /home/x/project...
 * /pose_graph/skip_cnt: 0
 * /pose_graph/skip_dis: 0.0
 * /pose_graph/visualization_shift_x: 0
 * /pose_graph/visualization_shift_y: 0
 * /rosdistro: kinetic
 * /rosversion: 1.12.14
 * /estimator/cf_file: /home/x/project...
 * /estimator/folder: /home/x/project...

    feature_tracker (feature_tracker/feature_tracker)
    pose_graph (pose_graph/pose_graph)
    estimator (estimator/estimator)

auto-starting new master
process[master]: started with pid [14269]

setting /run_id to 9a2f20e0-0b9d-11ea-be50-380025e3d4b0
process[rosout-1]: started with pid [14282]
started core service [/rosout]
process[feature_tracker-2]: started with pid [14294]
process[estimator-3]: started with pid [14301]
process[pose_graph-4]: started with pid [14303]
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
This GDB was configured as "x86_64-linux-gnu".
Type "apropos word" to search for commands related to "word"
Reading symbols from /home/x/project/devel/lib/estimator/estimator...GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Reading symbols from /home/x/project/devel/lib/pose_graph/pose_graph...done.
(gdb) done.
(gdb) The program is not being run.
(gdb) The program is not being run.
(gdb) Undefined command: "nnu".  Try "help".
(gdb) Undefined command: "rrnu".  Try "help".
Undefined command: "rrnu".  Try "help".
Undefined command: "nq".  Try "help".
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-11-20 08:48:50 -0500

gvdhoorn gravatar image

This could be due to conflicting stdin/stdout muxing/exclusive access.

I typically launch gdb in a separate window (from How to Roslaunch Nodes in Valgrind or GDB):

launch-prefix="xterm -e gdb --args"
edit flag offensive delete link more



@gvdhoom, This solves the problem. I'm figuring out the equivalent gnome-terminal command. Do you happen to know if we could do the same with gnome-terminal?

gnome-terminal --window -e gdb --args doesn't seem to work. It gives Failed to parse arguments: Unknown option --args error when running.

ignite gravatar image ignite  ( 2019-11-20 09:36:53 -0500 )edit

Related questions to gnome-terminal:

ignite gravatar image ignite  ( 2019-11-20 09:46:32 -0500 )edit

Using gnome-terminal -x bash -c gdb --args, the debugger gdb won't load the symbols correctly.

ignite gravatar image ignite  ( 2019-11-20 10:01:06 -0500 )edit

Could be a CWD issue, but I'm not sure.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-20 10:37:20 -0500 )edit

@ignite, I'm not sure if you already figured out the issue with gnome-terminal but this launch-prefix worked for me (loaded debug symbols correctly) on Ubuntu 16.04 with a default profile setup:

launch-prefix="gnome-terminal -x gdb --args"

The --window-with-profile=<your-profile-name> option could also be helpful.

rjb0026 gravatar image rjb0026  ( 2020-03-12 13:46:41 -0500 )edit

Question Tools



Asked: 2019-11-20 08:24:35 -0500

Seen: 1,984 times

Last updated: Nov 20 '19