From patchwork Fri Dec 9 12:53:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 704468 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tZsbs3sZYz9vF6 for ; Fri, 9 Dec 2016 23:53:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="eniRxAIe"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=eiRSyLhUwDbU5b09G17kgFZGiAjpU KrMuY7HoPBaue/QIYClmZLaCglGEcpiB125BdeOnJRRYlhezRTZ78A0w3LwfDF0a O75jQGaIvoDWpPsMfGycM6F+ICibfWEB/9LRgXcmoMxQ08hM3v9WK+zMtbY4AgMv Q+Wr4fqrP5s6kI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=pxGg1XINKOzQUflylo0Rf+5VFwE=; b=eni RxAIeaMUfT3ZvZ4ZU3jv94ULyrdLhYiC6hRPCnd/Z2mmdqk/lNIIG0ABxnzoPX84 ZoWqPHh/BIQS3jFCBOnHXJgbWWOGBT/+IqHWbpBSWSyZA4ZFhbyZtYp4Cxxd5gg5 8w3dGkUxuPjU4oH5L+gdprX4sSVsA56y9k1xg0g4= Received: (qmail 2843 invoked by alias); 9 Dec 2016 12:53:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 2762 invoked by uid 89); 9 Dec 2016 12:53:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=4226, 422, 6, Hx-languages-length:976 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 12:53:05 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF3C3707; Fri, 9 Dec 2016 04:53:03 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9AD723F477 for ; Fri, 9 Dec 2016 04:53:03 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [3/67] Add GDB pretty printer for machine mode classes References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 12:53:02 +0000 In-Reply-To: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 09 Dec 2016 12:48:01 +0000") Message-ID: <874m2dp8lt.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 This patch adds gdb hooks for printing machine_modes in the natural way. gcc/ * gdbhooks.py (MachineModePrinter): New class. (build_pretty_printer): Use it for machine_modes. diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index 1212312..95f4b95 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -422,6 +422,16 @@ class VecPrinter: ###################################################################### +class MachineModePrinter: + def __init__(self, gdbval): + self.gdbval = gdbval + + def to_string (self): + name = str(self.gdbval['m_mode']) + return name[2:] if name.startswith('E_') else name + +###################################################################### + # TODO: # * hashtab # * location_t @@ -518,6 +528,9 @@ def build_pretty_printer(): 'vec', VecPrinter) + pp.add_printer_for_types(['machine_mode'], + 'machine_mode', MachineModePrinter) + return pp gdb.printing.register_pretty_printer(