[Boost-users] Support of Pretty print

143 views
Skip to first unread message

Mario Chacon

unread,
Jun 25, 2009, 1:51:04 PM6/25/09
to boost...@lists.boost.org
Hello:
Is is possible that boost have gdb pretty prints??..
It's works great with std objects, it will be awesome if boost have it too!!

Salu2...
masch...

Steven Watanabe

unread,
Jun 25, 2009, 3:40:04 PM6/25/09
to boost...@lists.boost.org
AMDG

Mario Chacon wrote:
> Is is possible that boost have gdb pretty prints??..
>

Not that I know of. There are some for visual studio
https://svn.boost.org/trac/boost/wiki/DebuggerVisualizers

> It's works great with std objects, it will be awesome if boost have it too!!
>

It seems like a useful feature.
Would you be willing to write some?

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Mario Chacon

unread,
Jun 26, 2009, 10:49:59 AM6/26/09
to boost...@lists.boost.org
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?

Salu2..
masch...

Zachary Turner

unread,
Jun 26, 2009, 11:00:14 AM6/26/09
to boost...@lists.boost.org
On Fri, Jun 26, 2009 at 9:49 AM, Mario Chacon<the....@gmail.com> 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.

Vladimir Prus

unread,
Jun 26, 2009, 11:42:34 AM6/26/09
to boost...@lists.boost.org
Zachary Turner wrote:

> On Fri, Jun 26, 2009 at 9:49 AM, Mario Chacon<the....@gmail.com> 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.

I guess much of confusion has resulted from the fact that Mario did not
say what exactly he is talking about. The GDB pretty-printers he mention
have nothing to do with that inadequate-for-anything GDB macro language.
These are Python pretty-printers. See:

http://tromey.com/blog/?p=524

These are also documented in the development version of the GDB.

> 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.

That specific patch did not went further, since Python support was already
in development.

- Volodya

Mario Chacon

unread,
Jun 26, 2009, 12:25:01 PM6/26/09
to boost...@lists.boost.org
Sorry, yes I was referring the pretty print that Volodya said.
So Is it possible to start with some libraries???

Salu2...
masch...

tom fogal

unread,
Jul 2, 2009, 5:23:17 PM7/2/09
to boost...@lists.boost.org
Mario Chacon <the....@gmail.com> writes:
> Sorry, yes I was referring the pretty print that Volodya said.
> So Is it possible to start with some libraries???

Just look at the ones in libstdc++. They look fairly obvious; you just
need to know the internal names for the data structures in question. I
don't think you really need a boost-specific example.

-tom

> --000325572b8267bfec046d42c9d0
> Content-Type: text/html; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
>
> Sorry, yes I was referring the pretty print that Volodya said.<br>So Is it =
> possible to start with some libraries???<br><br>Salu2...<br>masch...<br><br=
> ><div class=3D"gmail_quote">On Fri, Jun 26, 2009 at 12:42 PM, Vladimir Prus=
> <span dir=3D"ltr">&lt;<a href=3D"mailto:vlad...@codesourcery.com">vladimi=
> r...@codesourcery.com</a>&gt;</span> wrote:<br>
>
> <blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
> 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class=3D"im"=
> >Zachary Turner wrote:<br>
> <br>
> &gt; On Fri, Jun 26, 2009 at 9:49 AM, Mario Chacon&lt;<a href=3D"mailto:the=
> .ma...@gmail.com">the....@gmail.com</a>&gt; wrote:<br>
> &gt;&gt; eheh... I do not know enough to write pretty prints, it&#39;s will=
> be help if<br>
> &gt;&gt; there are some example that other can continue, Do you know if exi=
> st some<br>
> &gt;&gt; pretty print boost exampless?<br>
> &gt;&gt;<br>
> &gt;<br>
> &gt;<br>
> &gt; It&#39;s nothing specific to boost, you just have to learn the GDB mac=
> ro<br>
> &gt; language. =C2=A0One of the difficulties in writing GDB pretty prints i=
> s<br>
> &gt; that, unlike with Visual Studio debug visualizers, GDB pretty printing=
> <br>
> &gt; does not happen &quot;automatically&quot;. =C2=A0You have to write a s=
> pecial command<br>
> &gt; for every single type you want to pretty print. =C2=A0 &quot;printboos=
> tvariant&quot;,<br>
> &gt; &quot;printboostany&quot;, &quot;printboostfspath&quot;, etc. =C2=A0It=
> &#39;s a little bit annoying<br>
> &gt; for sure. =C2=A0You can get around this even by writing a GDB plugin.<=
> br>
> <br>
> </div>I guess much of confusion has resulted from the fact that Mario did n=
> ot<br>
> say what exactly he is talking about. The GDB pretty-printers he mention<br=
> >
> have nothing to do with that inadequate-for-anything GDB macro language.<br=
> >
> These are Python pretty-printers. See:<br>
> <br>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"http://tromey.com/blog/?p=3D524" tar=
> get=3D"_blank">http://tromey.com/blog/?p=3D524</a><br>
> <br>
> These are also documented in the development version of the GDB.<br>
> <div class=3D"im"><br>
> &gt; If you want to write a GDB plugin, there is not as much available<br>
> &gt; info, but you can refer to this page:<br>
> &gt;<br>
> &gt; <a href=3D"http://sourceware.org/ml/gdb-patches/2008-05/msg00671.html"=
> target=3D"_blank">http://sourceware.org/ml/gdb-patches/2008-05/msg00671.ht=
> ml</a><br>
> &gt;<br>
> &gt; in which someone submitted a plugin for GDB to automatically display<b=
> r>
> &gt; correctly STL types just by using the normal &quot;print&quot; stateme=
> nt.<br>
> <br>
> </div>That specific patch did not went further, since Python support was al=
> ready<br>
> in development.<br>
> <br>
> - Volodya<br>
> <div><div></div><div class=3D"h5"><br>
> <br>
> <br>
> _______________________________________________<br>
> Boost-users mailing list<br>
> <a href=3D"mailto:Boost...@lists.boost.org">Boost...@lists.boost.org<=
> /a><br>
> <a href=3D"http://lists.boost.org/mailman/listinfo.cgi/boost-users" target=
> =3D"_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br>
> </div></div></blockquote></div><br>
>
> --000325572b8267bfec046d42c9d0--
>
> --===============0305474003==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline


>
> _______________________________________________
> Boost-users mailing list
> Boost...@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

> --===============0305474003==--

Reply all
Reply to author
Forward
0 new messages