* [python] Committed libstdc++ comments and changes patch.
@ 2009-03-09 12:07 Phil Muldoon
0 siblings, 0 replies; only message in thread
From: Phil Muldoon @ 2009-03-09 12:07 UTC (permalink / raw)
To: Project Archer
[-- Attachment #1: Type: text/plain, Size: 550 bytes --]
FYI:
Tom recently posted the libstdc++ printers python files upstream for
approval. After a few rounds, and some great comments and patches, the
files now differ. As this has been applied to the printers now hosted
over in the libstdc++ project, I'll apply the change here too for
continuity.
Regards
Phil
ChangeLog:
2009-03-09 Phil Muldoon <pmuldoon@redhat.com>
gdb/python/lib/gdb/libstdcxx/v6/printers.py (lookup_function):
Apply reg-ex to pick-up tr1 and std weak-pointers, and unordered
data-types.
[-- Attachment #2: gcc_printers.patch --]
[-- Type: text/x-patch, Size: 3376 bytes --]
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index 7a77ad4..a719b34 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -27,8 +27,9 @@ class StdPointerPrinter:
self.val = val
def to_string (self):
- return '%s (count %d) %s' % (self.typename, self.val['_M_refcount'],
- self.val['_M_ptr'])
+ return '%s (count %d) %s' % (self.typename,
+ self.val['_M_refcount']['_M_pi']['_M_use_count'],
+ self.val['_M_ptr'])
class UniquePointerPrinter:
"Print a unique_ptr"
@@ -612,19 +613,19 @@ def build_libstdcxx_dictionary ():
pretty_printers_dict[re.compile('^std::queue<.*>$')] = lambda val: StdStackOrQueuePrinter("std::queue", val)
pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
+ pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
pretty_printers_dict[re.compile('^std::vector<.*>$')] = StdVectorPrinter
# vector<bool>
- # C++0x stuff.
- # array - the default seems reasonable
- # smart_ptr? seems to only be in boost right now
- pretty_printers_dict[re.compile('^std::tr1::shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
- pretty_printers_dict[re.compile('^std::tr1::weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
- pretty_printers_dict[re.compile('^std::tr1::unique_ptr<.*>$')] = UniquePointerPrinter
- pretty_printers_dict[re.compile('^std::tr1::unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
- pretty_printers_dict[re.compile('^std::tr1::unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
- pretty_printers_dict[re.compile('^std::tr1::unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
- pretty_printers_dict[re.compile('^std::tr1::unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
+ # These are the C++0x printers. They also exist in the standard namespace.
+ # For array - the default GDB pretty-printer seems reasonable.
+ pretty_printers_dict[re.compile('^std::(tr1::)?shared_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::shared_ptr', val)
+ pretty_printers_dict[re.compile('^std::(tr1::)?weak_ptr<.*>$')] = lambda val: StdPointerPrinter ('std::weak_ptr', val)
+ pretty_printers_dict[re.compile('^std::(tr1::)?unordered_map<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_map', val)
+ pretty_printers_dict[re.compile('^std::(tr1::)?unordered_set<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_set', val)
+ pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multimap<.*>$')] = lambda val: Tr1UnorderedMapPrinter ('std::tr1::unordered_multimap', val)
+ pretty_printers_dict[re.compile('^std::(tr1::)?unordered_multiset<.*>$')] = lambda val: Tr1UnorderedSetPrinter ('std::tr1::unordered_multiset', val)
+
# Extensions.
pretty_printers_dict[re.compile('^__gnu_cxx::slist<.*>$')] = StdSlistPrinter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-09 12:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-09 12:07 [python] Committed libstdc++ comments and changes patch Phil Muldoon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).