[patch] Fix PR python/10646. Add libstdc++ Python pretty-printers for -D_GLIBCXX_DEBUG cases.
Phil Muldoon
pmuldoon@redhat.com
Wed Sep 30 13:48:00 GMT 2009
http://sourceware.org/bugzilla/show_bug.cgi?id=10646
This patch adds Python pretty-printer support for the debug variants of
various STL classes when the inferior is compiled with
-D_GLIBCXX_DEBUG. There are four attachments. The first is the patch,
the second is the test .cpp program; the third and fourth are the
pretty-printer output files from the "normal" compilation, and the
-D_GLIBCXX_DEBUG enabled compilation from within GDB. The two output
forms, and the test program are submitted as supporting documentation
and are not part of the overall patch.
I compiled the binaries as follows:
g++ -g3 -O0 -std=c++0x -D_GLIBCXX_DEBUG printer-test.cpp -o printer-test-dbg
and
g++ -g3 -O0 -std=c++0x printer-test.cpp -o printer-test
I then run each binary through a Python enabled GDB as follows:
/home/build/obj/gdb/gdb --quiet -ex "set verbose off" -ex "set
pagination off" -ex "set confirm no" -ex "source printers.py" -ex
"python gdb.pretty_printers = [lookup_function]" -ex "break 198" -ex
"run" -ex "info locals" -ex "quit" --args printer-test-dbg > debug.out
/home/build/obj/gdb/gdb --quiet -ex "set verbose off" -ex "set
pagination off" -ex "set confirm no" -ex "source printers.py" -ex
"python gdb.pretty_printers = [lookup_function]" -ex "break 198" -ex
"run" -ex "info locals" -ex "quit" --args printer-test > normal.out
The output from the -D_GLIBCXX_DEBUG enabled binary should now match the
output from the binary compiled without it.
Note that some of the classes do not have debug variants and are not
included in this patch. These are mainly the TR1, __gnu_cxx::slist
and __gnu_cxx::slist iterator, shared, weak and unique pointer
classes. Some of the debug variant iterators are wrapped in the
encapsulating "__gnu_debug::_Safe_iterator" and are renamed, and some
are just wrapped and not renamed with the __norm namespace. Some of the
iterators have implementation details that required some small changes
in the actual iterator printers.
Where appropriate, this patch now writes the class name for the given
class as it was passed in via the printer, instead of returning a fixed
string.
OK?
Regards
Phil
ChangeLog:
2009-09-30 Phil Muldoon <pmuldoon@redhat.com>
PR python/10646
* python/libstdcxx/v6/printers.py (StdListPrinter):
Add -D_GLIBCXX_DEBUG implementation changes. Receive typename from
printer registration.
(StdListIteratorPrinter): Likewise.
(StdDebugIteratorPrinter): New printer.
(build_libstdcxx_dictionary): Add -D_GLIBCXX_DEBUG registration
entries. Always pass a typename where the type can change.
(StdSlistPrinter) Receive typename from printer registration. Use
in printer output.
(StdBitsetPrinter): Likewise.
(StdDequePrinter): Likewise.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: glibcxx_debug_printers.patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090930/50d5364f/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printer-test.cpp
Type: text/x-c++src
Size: 5116 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090930/50d5364f/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: normal.out
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090930/50d5364f/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debug.out
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090930/50d5364f/attachment-0002.ksh>
More information about the Libstdc++
mailing list