~j-rivero/+junk/ignition-gazebo

« back to all changes in this revision

Viewing changes to tutorials/debugging.md

  • Committer: Jose Luis Rivero
  • Date: 2022-02-15 17:35:59 UTC
  • Revision ID: jrivero@osrfoundation.org-20220215173559-qyu3wjmqnrby30k7
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\page debugging Debugging
 
2
 
 
3
## Using GDB with the command line tools
 
4
 
 
5
The Gazebo command line tools are based on Ruby. If you want to use GDB to
 
6
debug a problem, which we highly encourage, then you'll need to run GDB against
 
7
the Ruby executable. Once in the GDB shell, you can run the `ign gazebo`
 
8
script to run an instance of Gazebo.
 
9
 
 
10
You'll likely want to debug the Gazebo server or GUI separately. Refer to the
 
11
following two sections for instructions concerning each case.
 
12
 
 
13
### Debugging the server
 
14
 
 
15
1. Find the `ign` executable:
 
16
 
 
17
    `which ign`
 
18
 
 
19
    The following instructions will assume the output was `/usr/bin/ign`, be
 
20
    sure to change it accordingly.
 
21
 
 
22
2. Launch `gdb`
 
23
 
 
24
    `gdb ruby`
 
25
 
 
26
3. Run the Gazebo server with the desired arguments. Make sure to use the
 
27
   `-s` argument. The following example runs the `shapes.sdf` world.
 
28
 
 
29
    `(gdb) r /usr/bin/ign gazebo -s shapes.sdf`
 
30
 
 
31
4. Use GDB as normal
 
32
 
 
33
### Debugging the GUI
 
34
 
 
35
1. Launch `gdb`
 
36
 
 
37
    `gdb ruby`
 
38
 
 
39
2. Run the Gazebo GUI with the desired arguments. Make sure to use the
 
40
   `-g` argument.
 
41
 
 
42
    `(gdb) r /usr/bin/ign gazebo -g`
 
43
 
 
44
3. In another terminal run the Gazebo server.
 
45
 
 
46
    `ign gazebo -s -v 4 -r shapes.sdf`
 
47
 
 
48
4. Use GDB as normal.