This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] Committed libstdc++ comments and changes patch.
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Mon, 09 Mar 2009 12:07:40 +0000
- Subject: [python] Committed libstdc++ comments and changes patch.
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.
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