From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16967 invoked by alias); 30 Sep 2014 07:29:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16956 invoked by uid 89); 30 Sep 2014 07:29:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 30 Sep 2014 07:29:41 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 30 Sep 2014 00:29:40 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 30 Sep 2014 00:28:56 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s8U7StA7011075; Tue, 30 Sep 2014 08:28:55 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id s8U7St90022503; Tue, 30 Sep 2014 09:28:55 +0200 Received: (from wtedesch@localhost) by ulvlx001.iul.intel.com with œ id s8U7SsC8022499; Tue, 30 Sep 2014 09:28:55 +0200 From: Walfred Tedeschi To: palves@redhat.com, mark.kettenis@xs4all.nl Cc: gdb-patches@sourceware.org, Walfred Tedeschi Subject: [PATCH, PR 17364] Need better printer names in bound_register.py Date: Tue, 30 Sep 2014 07:29:00 -0000 Message-Id: <1412062133-22469-1-git-send-email-walfred.tedeschi@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00867.txt.bz2 Moved the printer to the global scope and changed the name of the printer to a more specific name. 2014.09.11 Walfred Tedeschi python/lib/gdb/command: * bound_registers.py (mpx_bound_reg_printer) Added function to register pretty-printing for bound registers, and fixed comments. (build_pretty_printer) Removed. --- gdb/python/lib/gdb/command/bound_registers.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/gdb/python/lib/gdb/command/bound_registers.py b/gdb/python/lib/gdb/command/bound_registers.py index 24d4c45..6f2dbc6 100644 --- a/gdb/python/lib/gdb/command/bound_registers.py +++ b/gdb/python/lib/gdb/command/bound_registers.py @@ -16,8 +16,8 @@ import gdb.printing -class BoundPrinter: - """Adds size field to a _rawbound128 type.""" +class BoundPrinter (object): + """Adds size field to a __gdb_builtin_type_bound128 type.""" def __init__ (self, val): self.val = val @@ -31,15 +31,14 @@ class BoundPrinter: result = '{lbound = %s, ubound = %s} : size %s' % (lower, upper, size) return result -# There are two pattern matching used: first one is related to a library -# second is related to the type. Since we are displaying a register all -# libraries are accepted. Type to be processed is the same present -# in the xml file. +# Register a global pretty-printer for the bnd[0..3] pseudo +# register. -def build_pretty_printer (): - pp = gdb.printing.RegexpCollectionPrettyPrinter (".*") - pp.add_printer ('bound', '^__gdb_builtin_type_bound128', BoundPrinter) - return pp +def mpx_bound_reg_printer (val): + lookup_tag = val.type.tag + if lookup_tag == None: + return None + if lookup_tag == "__gdb_builtin_type_bound128": + return BoundPrinter (val) -gdb.printing.register_pretty_printer (gdb.current_objfile (), - build_pretty_printer ()) +gdb.pretty_printers.append (mpx_bound_reg_printer) -- 1.9.1