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

How can I find the line where the code crashes?

asked 2020-07-10 00:49:17 -0600

gab27 gravatar image

updated 2020-07-12 22:01:39 -0600

Hi

I only got the following error message:

[package-2] process has died [pid 14880, exit code -6, cmd /home/user/catkin_ws/devel/lib/package/package_node /package/sub_topic:=/topic __name:=package __log:=/home/user/.ros/log/74b3f964-c270-11ea-9dfa-98e743bf11b3/package-2.log].
log file: /home/user/.ros/log/74b3f964-c270-11ea-9dfa-98e743bf11b3/package-2*.log

How do I find the line of code, where the code crashed?

Edit: Is there also a way to run the executable via rosrun or roslaunch?

I don't get any errors with gdb <path to ros executable>, but the node is also not getting any input topics (for example the navigation goal I usually set in RVIZ).

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2020-07-10 03:56:04 -0600

ahcorde gravatar image

Hello,

you should compile your code to include the debug symbols. You need to run your catkin command with:

catkin_make_isolated --cmake-args -DCMAKE_BUILD_TYPE=Debug --pkg <your package>

Then you need to run your code with gdb.

gdb <path to your ros executable>

When the code fails use the command bt to see the backtrace and see what is going on in your code.

edit flag offensive delete link more

Comments

Thanks, I try that.

gab27 gravatar image gab27  ( 2020-07-12 02:09:36 -0600 )edit

Is there also a way to run the executable via rosrun or roslaunch?

I don't get any errors with gdb <path to ros executable>, but the node is also not getting any input topics (for example the navigation goal I usually set in rviz, but I could also publish it via the terminal).

gab27 gravatar image gab27  ( 2020-07-12 17:14:13 -0600 )edit

That's cool. + 1 I started on ubuntu/linux just to play with ROS. No background in linux and never heard of this(GDB) until your post. Thank you.

billy gravatar image billy  ( 2020-07-13 00:44:51 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-07-10 00:49:17 -0600

Seen: 1,518 times

Last updated: Jul 12 '20