Boost logo

Boost Users :

Subject: Re: [Boost-users] Support of Pretty print
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-06-26 11:00:14


On Fri, Jun 26, 2009 at 9:49 AM, Mario Chacon<the.masch_at_[hidden]> wrote:
> eheh... I do not know enough to write pretty prints, it's will be help if
> there are some example that other can continue, Do you know if exist some
> pretty print boost exampless?
>

It's nothing specific to boost, you just have to learn the GDB macro
language. One of the difficulties in writing GDB pretty prints is
that, unlike with Visual Studio debug visualizers, GDB pretty printing
does not happen "automatically". You have to write a special command
for every single type you want to pretty print. "printboostvariant",
"printboostany", "printboostfspath", etc. It's a little bit annoying
for sure. You can get around this even by writing a GDB plugin.

To learn the GDB macro syntax just google for "gdb macro syntax".
Additionally, you can refer to this page:

http://www.yolinux.com/TUTORIALS/GDB-Commands.html#STLDEREF

which, specifically contains this .gdbinit file (which is where you add macros)

http://www.yolinux.com/TUTORIALS/src/dbinit_stl_views-1.03.txt

that contains many examples of pretty printing STL containers.

If you want to write a GDB plugin, there is not as much available
info, but you can refer to this page:

http://sourceware.org/ml/gdb-patches/2008-05/msg00671.html

in which someone submitted a plugin for GDB to automatically display
correctly STL types just by using the normal "print" statement.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net