The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

gdb++ - GDB wrapper providing nice reflection features

SYNOPSIS

 gdb++ [options] [executable-file [core-file or process-id]]
 gdb++ [options] --args executable-file [inferior-arguments ...]

OPTIONS

--args

Pass all parameters after executable-file to the program being debugged.

-v

If STDIN is not a tty (e.g. it's a pipe), echo back the GDB prompt as well as the command being executed.

-g PATH

Specify the path to the gdb executable. Defaults to gdb.

DESCRIPTION

Devel::GDB::Reflect provides a reflection API for GDB/C++, which can be used to recursively print the contents of STL data structures (vector, set, map, etc.) within a GDB session. It is not limited to STL, however; you can write your own delegates for printing custom container types.

The module provides a script, "gdb++", which serves as a wrapper around GDB. Invoke it the same way you would invoke gdb, e.g.:

 $ gdb++ MYPROG

Within the gdb++ session, you can execute the same commands as within gdb, with the following extensions:

  • print_r VAR

    Recursively prints the contents of VAR. The command can be abbreviated as "pr". For example, if "v" is of type vector< vector<int> >:

            (gdb) pr v
            [
                [ 11, 12, 13 ], 
                [ 21, 22, 23 ], 
                [ 31, 32, 33 ]
            ]
  • set gdb_reflect_indent VALUE

  • show gdb_reflect_indent

    Set or show the number of spaces to indent at each level of recursion. Defaults to 4.

  • set gdb_reflect_max_depth VALUE

  • show gdb_reflect_max_depth

    Set or show the maximum recursion depth. Defaults to 5. Example:

            (gdb) set gdb_reflect_max_depth 2
            (gdb) pr v
            [
                [ { ... }, { ... }, { ... } ], 
                [ { ... }, { ... }, { ... } ], 
                [ { ... }, { ... }, { ... } ]
            ]
  • set gdb_reflect_max_width VALUE

  • show gdb_reflect_max_width

    Set or show the maximum number of elements to show from a given container. Defaults to 10. Example:

            (gdb) set gdb_reflect_max_width 2
            (gdb) pr v                       
            [
              [ 11, 12, ... ], 
              [ 21, 22, ... ], 
              ...
            ]

1 POD Error

The following errors were encountered while parsing the POD:

Around line 47:

=over without closing =back