This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix glitches with libstdc++ pretty printers

On Wed, Oct 15, 2008 at 3:52 PM, Tom Tromey <> wrote:

> FYI -- I randomly change these as I work on the pretty-printing code.
> I've appended my current file.  You can see how some of the MI-style
> printers are written here.
> I guess I could check this in temporarily so we could share.

Perhaps this can go into testsuite/gdb.python/ ?

That's where I put it as I was working up a test case.

> I don't want to ship this with gdb, since I think it belongs in
> libstdc++.  But, in the interim it is nice if we can all be
> up-to-date.  What do you think?

It's pretty clear that GDB would need its own copy in some shape
for testing, and above location is (IMHO) logical place for it.

The question of "who and how should maintain this" is an interesting
one. Ideally you'd want container writers to do that, and you'd want
this code to be somehow embedded in the binary with the rest of
debug info, so the end user can pretty print any container and not
worry about the pretty printer getting out of sync with container
implementation. But I have no clue how to achieve this :(

> Paul> I am not making a test case for this, because there are some more
> Paul> glitches to fix, and I'd rather have a single test for everything.
> I haven't written any pretty-printing tests yet anyhow.  That is on my
> to-do list, as is finishing the documentation on writing a
> pretty-printer.

Maybe I'll beat you to it :)

> This patch is ok, thanks.

Thanks, committed as above.

> Tom
> # Pretty-printers for libstc++.
> class StdListPrinter:
>    "Print a std::list"

I think this either depends on some uncomitted patches, or else is
broken for nested STL containers:

Using the same stl1 test case:

(gdb) b 15
Breakpoint 1 at 0x400364: file, line 15.
(gdb) r

Breakpoint 1, main () at
15        return 0; // break here
(gdb) p xx
$1 = std::list
     [0] = 1
(gdb) p yy
$2 = Traceback (most recent call last):
  File "<string>", line 4, in _format_children
  File "<string>", line 62, in header
TypeError: unsupported operand type(s) for -: 'gdb.Value' and 'tuple'
Traceback (most recent call last):
  File "<string>", line 4, in _format_children
  File "<string>", line 62, in header
TypeError: unsupported operand type(s) for -: 'gdb.Value' and 'tuple'
{<std::_Vector_base<std::list<int, std::allocator<int> >,
std::allocator<std::list<int, std::allocator<int> > > >> = {_M_impl =
    {<std::allocator<std::list<int, std::allocator<int> > >> =
{<__gnu_cxx::new_allocator<std::list<int, std::allocator<int> > >> =
{<No data fields>}, <No data fields>}, _M_start = 0x405030, _M_finish
= 0x405040,
      _M_end_of_storage = 0x405040}}, <No data fields>}

Paul Pluzhnikov

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]