Ask Your Question
1

How to debug plugins with GDB in ROS

asked 2016-01-30 04:15:49 -0500

Megacephalo gravatar image

updated 2016-01-30 04:16:24 -0500

Hi, all !

I am still a novice in debugging. I ran into the problem of writing my own global planner plugin and keeps popping out error, such as the one found on my other question, or the one below not even giving any explicit complain upon crashing:

[move_base-1] process has died [pid 10503, exit code -11 (...)]

I managed to open an external GDB window for debugging following the instruction on this tutorial. At this point it is pretty clear how to debug a certain node, but then my question is, since what I want is to debug a plugin (not the way presented with this question ,duh !!), what should the proper way to do so with GDB? Or do I need to make the plugin as a certain node to better debug it ? Thanks !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-01-30 12:31:11 -0500

ahendrix gravatar image

You can't run a plugin by itself in gdb; you need to run it as part of a node.

The easiest way to go about this is to run the node which loads your plugin in gdb; in this case that would be move_base. Just edit the launch file which runs move_base to run it inside of gdb.

Depending on the node and the failure case, you may get more output by adding the output="screen" option in your launch file as well.

As a side node, negative exit codes (like -11) indicate the signal that caused your program to exit; signal 11 is segfault. The signal numbers are standardized for all Linux, OSX and POSIX systems, and are widely documented; for example: http://man7.org/linux/man-pages/man7/...

edit flag offensive delete link more

Comments

Hi ahendrix,

Your answer is truly awesome! I've never heard of such a documentation on Linux signal and it is very useful! I already added output="screen" before posting this question, so I guess the best way to debug is using ROS_DEBUG_STREAM or write an extra int main to run it as a node. Agree?

Megacephalo gravatar image Megacephalo  ( 2016-02-15 04:32:19 -0500 )edit

If you already have output="screen" , the next step is to run your node in a debugger: http://wiki.ros.org/roslaunch/Tutoria...

ahendrix gravatar image ahendrix  ( 2016-02-15 04:54:56 -0500 )edit

Hi, ahendrix! Thank you ! I will try debugging this way. Thank you :) !

Megacephalo gravatar image Megacephalo  ( 2016-04-09 08:12:53 -0500 )edit

Sure, but how do you actually step into the source code of a plugin once you are running the node? GDB won't follow the pointer.

MartinS gravatar image MartinS  ( 2018-01-09 19:40:40 -0500 )edit

@MartinS: that is better asked in a new question, and it looks like you've already done it: https://answers.ros.org/question/2793...

ahendrix gravatar image ahendrix  ( 2018-01-10 00:00:55 -0500 )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

1 follower

Stats

Asked: 2016-01-30 04:15:49 -0500

Seen: 1,508 times

Last updated: Jan 30 '16