From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25810 invoked by alias); 9 Oct 2014 17:34:42 -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 25800 invoked by uid 89); 9 Oct 2014 17:34:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-qc0-f202.google.com Received: from mail-qc0-f202.google.com (HELO mail-qc0-f202.google.com) (209.85.216.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 09 Oct 2014 17:34:40 +0000 Received: by mail-qc0-f202.google.com with SMTP id i17so75554qcy.3 for ; Thu, 09 Oct 2014 10:34:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=FJYStURCNCT2nCVVyi3AK3BtOmzfk1jMFvABYxBa3+U=; b=b0/NA5KD5IMcOvQClPae49byzFNhftE3YXuIjRdAbzJgPyJNbwWR25IY7aMEQSufH0 CKNoR/fCL7brq5aonsFUivulVk/l/SnMEtnagw+j8rBNW9KDIFLOu41/C0p6+AHg5XL8 dUDv6t1jtdx4pRbWY+m9ipVvGFGMBxZBWWLoSULSA1/s+yIV+XtfZe5jIeUy4m5zFakk sv+j55F0z2wCfML9JdvRRF9Cl53JdKxXRdi8+FFTK0XKFRObL0bRvZfzwqTbx8qqhhu+ vRjvHK7iRuUd/INrlQc4BqkD661xi/NYb7szdPtT5B7ARCC85M45wUt459lAMaXFtK8d HwqQ== X-Gm-Message-State: ALoCoQnWpNxHYQuPCJW0scjiLcefDIuGBz0U5rjmCmdGi9bhmZHd4dDhp3eX3YaCdUCMraUS2iHCGDc4C1tYztiOVaPyMf61ZvLC/Rl7SCmZtuYfk3Q/4+1ubk+G6VPnQQM0CobHz6+VvXqmCgZ3cXCpFZqNXRHmcSIO+b5e9LTq/Ty8cluysS8= X-Received: by 10.52.232.37 with SMTP id tl5mr13004432vdc.4.1412876077887; Thu, 09 Oct 2014 10:34:37 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id n24si196458yha.6.2014.10.09.10.34.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Oct 2014 10:34:37 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com ([172.17.128.107]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id azHvazt8.1; Thu, 09 Oct 2014 10:34:37 -0700 From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21558.50988.529374.214950@ruffy2.mtv.corp.google.com> Date: Thu, 09 Oct 2014 17:34:00 -0000 To: Walfred Tedeschi Cc: palves@redhat.com, mark.kettenis@xs4all.nl, gdb-patches@sourceware.org Subject: Re: [PATCH, PR 17364] Need better printer names in bound_register.py In-Reply-To: <1412062133-22469-1-git-send-email-walfred.tedeschi@intel.com> References: <1412062133-22469-1-git-send-email-walfred.tedeschi@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00210.txt.bz2 Walfred Tedeschi writes: > 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. Hi. fwiw, I kinda like grouping together all the pretty-printers provided by gdb. See https://sourceware.org/ml/gdb-patches/2014-10/msg00081.html Using RegexpCollectionPrettyPrinter is a bit of overkill since there are no templates, at least not yet. We could certainly add SimpleCollectionPrettyPrinter or some such that just did string comparisons on tag names instead of regexps, but since this is all implementation detail we could defer this. > +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) Random comments: 1) "lookup_tag" is a bit confusing as there is no lookup done here. I'd rename it to just val_type_tag or some such. [Assuming we keep this version.] 2) "mpx" is presumably enough to distinguish this pretty-printer from other arch's bounds reg pretty-printers (probably a better choice than "x86" too). 3) If I do "info pretty" I see this: global pretty-printers: mpx_bound_reg_printer Having "printer" in the name is superfluous, thus if one was to do things this way I'd rename mpx_bound_reg_printer to mpx_bound_reg. That way the user can do "disable pretty-printer global mpx_bound_reg". 4) It might be preferable to pick a name closer to the actual type's name: "mpx_bound128" ? [digression: Registering printers as functions was how pretty-printers were originally added, but it turned out to be insufficient: printers need to be disableable and thus need names. OTOH one tends to think of the name of the function here as an implementation detail, except that it isn't.] --- Going forward, I like the idea of providing basic infrastructure for grouping builtin pretty-printers together and using that for 17364. Plus this file really doesn't belong in python/lib/gdb/command. I propose sticking with this patch https://sourceware.org/ml/gdb-patches/2014-10/msg00081.html but I'm happy to tweak it as desired (e.g. use "mpx_bound128" as the name).