Ask Your Question
0

Weird behavior of GDB with roslaunch

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

ignite gravatar image

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

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).

project.launch

<launch>
  <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>

  <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>

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

Output

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/

SUMMARY
========

PARAMETERS
 * /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...

NODES
  /
    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]
ROS_MASTER_URI=http://localhost:11311

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
1

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

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

Comments

@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 imageignite ( 2019-11-20 09:36:53 -0600 )edit

Related questions to gnome-terminal: https://superuser.com/questions/19801...

ignite gravatar imageignite ( 2019-11-20 09:46:32 -0600 )edit

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

ignite gravatar imageignite ( 2019-11-20 10:01:06 -0600 )edit

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

gvdhoorn gravatar imagegvdhoorn ( 2019-11-20 10:37:20 -0600 )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

2 followers

Stats

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

Seen: 26 times

Last updated: Nov 20 '19