Using GDB with the command line tools
The Gazebo command line tools are based on Ruby. If you want to use GDB to debug a problem, which we highly encourage, then you'll need to run GDB against the Ruby executable. Once in the GDB shell, you can run the gz sim script to run an instance of Gazebo.
You'll likely want to debug the Gazebo server or GUI separately. Refer to the following two sections for instructions concerning each case.
Debugging the server
Find the
gzexecutable:which gzThe following instructions will assume the output was
/usr/bin/gz, be sure to change it accordingly.Launch
gdbgdb rubyRun the Gazebo server with the desired arguments. Make sure to use the
-sargument. The following example runs theshapes.sdfworld.(gdb) r /usr/bin/gz sim -s shapes.sdf- Use GDB as normal
Debugging the GUI
Launch
gdbgdb rubyRun the Gazebo GUI with the desired arguments. Make sure to use the
-gargument.(gdb) r /usr/bin/gz sim -gIn another terminal run the Gazebo server.
gz sim -s -v 4 -r shapes.sdf- Use GDB as normal.