• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    Python
  • Created about 15 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GDB Pretty Printers for Boost

GDB Pretty Printers for Boost

Since version 7.0, GDB has Python scripting support. This can be used to provide “pretty printers” to make the output of GDB more usable. The libstdc++ project currently provides a set of pretty printers for their implementation of the C++ standard library. This projects goal is to provide a similar set of pretty printers for the Boost library.

Help is appreciated!

See SUPPORTED.org for supported classes and names of contributors. See NOTES.org for other general notes. See HACKING.org for more low-level information about printers in general.

The pretty printers are licensed under the terms of the Boost Software License, version 1.0.

Installation

GDB version 7 or better is required. Currently, most printers work with either Python 2 or Python 3.

To install, check out the git repository:

git clone git://github.com/ruediger/Boost-Pretty-Printer.git

Then, add the following lines to your ~/.gdbinit:

python
import sys
sys.path.insert(1, 'PATH-TO-THE-REPO/Boost-Pretty-Printer')
import boost
boost.register_printers(boost_version=(x,y,z))
end

If you have no ~/.gdbinit file just create it. And of course, replace PATH-TO-THE-REPO with the absolute path to the Boost Pretty Printer repository. boost_version is a tuple with boost version which you use. boost_version may be omitted. In that case boost version will be detected automatically. Note, that autodetect routine makes gdb startup somewhat slower.

Now you can simply use GDB’s print (short p) statement to pretty print the supported boost objects.

Example

$ cat > foo.c++
#include <boost/range/iterator_range.hpp>
using namespace boost;

int main() {
  char buf[] = "Hello World";
  iterator_range<char const*> range(buf, buf + sizeof(buf));

  return range[0];
}
^D
$ g++ -g3 foo.c++
$ gdb -q a.out
Reading symbols from /home/ruediger/develop/demos/a.out...done.
(gdb) break 7
Breakpoint 1 at 0x4006cb: file /home/ruediger/develop/demos/foo.c++, line 7.
(gdb) run
Starting program: /home/ruediger/develop/demos/a.out

Breakpoint 1, main () at /home/ruediger/develop/demos/foo.c++:8
8         return range[0];
(gdb) p range
$1 = boost::iterator_range<char const*> of length 12 = {72 'H', 101 'e', 108 'l', 108 'l', 111 'o', 32 ' ', 87 'W', 111 'o', 114 'r', 108 'l', 100 'd', 0 '\000'}

Volatililty Of Printers

Due to the limited nature of the debugging interface, individual printers included in this package can stop working with every Boost update. Specifically, a printer for boost::intrusive::list designed for Boost version 1.40 might or might not work with Boost 1.46. The reasons for this are explained in HACKING.org. Keeping the printers up to date is a daunting task, and contributions are welcome in that sense. If you need to debug some data structures and you find that there is no printer for them, or that the included printer stopped working, consider investing some time in fixing them and creating a pull request. Various information about this process is provided in HACKING.org.

Managing Printers From Inside GDB

This python module installs a single top-level printer called boost, and individual subprinters for the various supported types. Here are some useful commands to manage printers from inside gdb:

# show list of loaded boost printers (also shows which, if any, are disabled)
info pretty-printer global boost
# disable some printers
disable pretty-printer global boost;boost::intrusive::list
# re-enable all boost printers
enable pretty-printer global boost;.*

For more information, see the GDB documentation.

More Repositories

1

VobSub2SRT

Converts VobSub subtitles (.idx/.srt format) into .srt subtitles.
C
293
star
2

libbert

A BERT library for C++ and C
C++
53
star
3

magit-filenotify

Refresh status buffer when git tree changes
Emacs Lisp
49
star
4

emacs-codepad

Emacs integration for codepad.org
Emacs Lisp
42
star
5

weather-metno-el

Weather data from met.no in GNU Emacs
Emacs Lisp
32
star
6

qrencode-el

QRCode encoder for Emacs in pure elisp
Emacs Lisp
30
star
7

matlab-emacs

(Unofficial GIT Import of the Official CVS Repo!) Major mode for Emacs for editing MATLAB code, and running MATLAB in an inferior shell.
Emacs Lisp
19
star
8

mat-asm.js

Simple linear algebra implementation using asm.js
JavaScript
15
star
9

emacs-firefox-remote

Using Firefox' Remote Debugger from Emacs
Emacs Lisp
9
star
10

gcc-etags

GCC plugin to generate ETags-like TAGS files
C++
9
star
11

rusti.el

Rust interactive mode
Emacs Lisp
8
star
12

osm-mode

OpenStreetMap mode for Emacs
Emacs Lisp
8
star
13

systemtap-mode

Emacs mode for SystemTap
Emacs Lisp
7
star
14

rainbow-mode

Colorize color names in buffers
Emacs Lisp
7
star
15

bibeltex

BibTeX for org-mode
Emacs Lisp
5
star
16

cl-fastcgi

FastCGI Library for Common Lisp
Common Lisp
4
star
17

gcc-python-plugin

My "fork" of the gcc-python-plugin (will send patches upstream soon!)
Python
3
star
18

org-world-cup2014

FIFA World Cup 2014 Schedule for org-mode
3
star
19

Beerzlib-License

A modified zlib license
3
star
20

help.github.com

GitHub help guides
JavaScript
3
star
21

xmls-path

lisp style xpath-derivate
Common Lisp
3
star
22

PonWebGL

A simple Pong-like game based on WebGL
JavaScript
2
star
23

sdl-flusspferd

SDL module for Flusspferd (JavaScript)
C++
2
star
24

misc

misc stuff
C
2
star
25

webglframework

A very basic framework for WebGL
JavaScript
2
star
26

dcpu16

DCPU-16 Emulator and Tools
C++
2
star
27

apl-mode

An Emacs Mode for the APL programming language
Emacs Lisp
2
star
28

libuni

my attempt at implementing Unicode
C++
2
star
29

countryquiz

A country quiz in xhtml, svg and javascript.
JavaScript
2
star
30

wasm-demo-web

Just playing around with wasm/web-sys/rust.
Rust
1
star
31

cloudbbq

Attempt at a Rust implementation to talk to "Cloud BBQ" thermometers.
Rust
1
star