gdb++ - GDB wrapper providing nice reflection features
gdb++ [options] [executable-file [core-file or process-id]] gdb++ [options] --args executable-file [inferior-arguments ...]
Pass all parameters after executable-file to the program being debugged.
If STDIN is not a tty (e.g. it's a pipe), echo back the GDB prompt as well as the command being executed.
Specify the path to the gdb executable. Defaults to gdb.
gdb
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
print_r
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
set gdb_reflect_indent
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
set gdb_reflect_max_depth
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
set gdb_reflect_max_width
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:
=over without closing =back
To install Devel::GDB::Reflect, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::GDB::Reflect
CPAN shell
perl -MCPAN -e shell install Devel::GDB::Reflect
For more information on module installation, please visit the detailed CPAN module installation guide.