From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26857 invoked by alias); 6 Mar 2009 21:16:58 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 26799 invoked by uid 9674); 6 Mar 2009 21:16:57 -0000 Date: Fri, 06 Mar 2009 21:16:00 -0000 Message-ID: <20090306211657.26783.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer: Merge commit 'origin/archer-jankratochvil-python' into archer X-Git-Refname: refs/heads/archer X-Git-Reftype: branch X-Git-Oldrev: 6cf16c0711e844094ab694b3d929f7bd30b49f61 X-Git-Newrev: 46c9c97c70d8a5670691a7a7f62e76d48213bf4e X-SW-Source: 2009-q1/txt/msg00282.txt.bz2 List-Id: The branch, archer has been updated via 46c9c97c70d8a5670691a7a7f62e76d48213bf4e (commit) via 9ae706a486c079a09f55352803456dc2588d5b92 (commit) from 6cf16c0711e844094ab694b3d929f7bd30b49f61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 46c9c97c70d8a5670691a7a7f62e76d48213bf4e Merge: 6cf16c0711e844094ab694b3d929f7bd30b49f61 9ae706a486c079a09f55352803456dc2588d5b92 Author: Jan Kratochvil Date: Fri Mar 6 22:16:29 2009 +0100 Merge commit 'origin/archer-jankratochvil-python' into archer ----------------------------------------------------------------------- Summary of changes: gdb/python/lib/gdb/libstdcxx/v6/hook.in | 27 ++++++++++++++++++++++ gdb/python/lib/gdb/libstdcxx/v6/printers.py | 33 +++++++++++++-------------- 2 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 gdb/python/lib/gdb/libstdcxx/v6/hook.in First 500 lines of diff: diff --git a/gdb/python/lib/gdb/libstdcxx/v6/hook.in b/gdb/python/lib/gdb/libstdcxx/v6/hook.in new file mode 100644 index 0000000..fe7c072 --- /dev/null +++ b/gdb/python/lib/gdb/libstdcxx/v6/hook.in @@ -0,0 +1,27 @@ +# -*- python -*- +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import sys +import gdb + +# Update module path. +dir = '@dir@' +if not dir in sys.path: + sys.path.insert(0, dir) + +# Load the pretty-printers. +from libstdcxx.v6.printers import register_libstdcxx_printers +register_libstdcxx_printers (gdb.current_objfile ()) diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py index 7a77ad4..ccef97d 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,21 +613,20 @@ 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 - - # 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) - - # Extensions. + + # 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 to std, tr1 pretty-printers. pretty_printers_dict[re.compile('^__gnu_cxx::slist<.*>$')] = StdSlistPrinter if True: @@ -644,4 +644,3 @@ def build_libstdcxx_dictionary (): pretty_printers_dict = {} build_libstdcxx_dictionary () -register_libstdcxx_printers (gdb.current_objfile()) hooks/post-receive -- Repository for Project Archer.