[Documentation] [TitleIndex] [WordIndex

Gazebo will segfault if any of the components (mechanism controller stack, dynamic plug-ins, etc) fail. To make PR2 simulator a useful tool, you will want to run it in debug mode sometimes. Assuming user is familiar with gdb, here are multiple ways to obtain a backtrace.

Launching GDB with roslaunch

Add launch-prefix="$(find gazebo_worlds)/scripts/gdbrun" to the gazebo node in the launch script. For reference, take a look at debug.launch.

Attach GDB to a Running Process

$ ps -ef | grep 'gazebo/bin/gazebo'
user       1234  2345 12 12:00 ?        00:00:01 /home/user/projects/electric_release/simulator_gazebo/gazebo/bin/gazebo -s -1 -u /home/user/projects/electric_release/simulator_gazebo/gazebo_worlds/worlds/empty.world __name:=gazebo __log:=/home/user/.ros/electric_release/log/012304e0-c778-11e0-ae1a-f46d1234a4c9/gazebo-2.log

Next, attach gdb to the gazebo process. For example, given the above result from ps,

localhost:~/ros/ros-pkg> gdb --pid 1234

When gdb stops loading, type cont at the gdb prompt to continue,

(gdb) cont

When gazebo segfaults, you can return to the gdb prompt and use your favorite gdb commands to debug.



2024-12-28 15:11