From patchwork Tue Apr 10 12:45:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 896642 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-476123-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vh3Dm+jp"; dkim-atps=neutral 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 40L6Nl21dXz9s3m for ; Tue, 10 Apr 2018 22:46:13 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=S+DHzTLxkiqdxhOx3o+/XLiVqvFvVefA5pfmc+T9FhAPbK9XsL s54fGUBbNNrXt9C8mjXZnYDX63GmvGN8aqTpvLE+UkwPswn2iJCIL59V0M8WQ/Vw qkdog3+2eZznOGtQ286+G9K0eRz4msbkMLsCvYQKsQI5bQyHlospMsv9k= 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 :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=3yEIBkqv6ePijcPt+JHe2s00S5I=; b=vh3Dm+jpEqarupFQkoZU DLABmymI+B+T7qMWSoNG6kAo/w9lk99KPzxnWH7ExCX/+XzB8MKEU9QWJhVOoa+O v6MSo3y1iINxurXKMsRx1ZDDhdZNErUfBb8BtDwZ3CjieasFFndDd7G/phrwSUjc GbBPSiBJbahMJ11DWwusiV8= Received: (qmail 128461 invoked by alias); 10 Apr 2018 12:46:06 -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 128438 invoked by uid 89); 10 Apr 2018 12:46:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=our X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Apr 2018 12:46:03 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3BF05ABC9; Tue, 10 Apr 2018 12:46:00 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] gdbhooks: Add new pretty-printers for: varpool_node, symtab_node, cgraph_edge and ipa_ref. To: gcc-patches@gcc.gnu.org Cc: David Malcolm Message-ID: Date: Tue, 10 Apr 2018 14:45:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi. I'm bit ashamed that I tasted our gdb pretty-printers today for the first time. It's working nice and I would like to extend it a bit for classes that I print/debug often. gcc/ChangeLog: 2018-04-10 Martin Liska * gdbhooks.py: Add pretty-printers for varpool_node, symtab_node, cgraph_edge and ipa_ref. --- gcc/gdbhooks.py | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index f13e4e67402..e439942531a 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -105,10 +105,10 @@ it's a quick way of getting lots of debuggability quickly. Callgraph nodes are printed with the name of the function decl, if available: (gdb) frame 5 - #5 0x00000000006c288a in expand_function (node=) at ../../src/gcc/cgraphunit.c:1594 + #5 0x00000000006c288a in expand_function (node=) at ../../src/gcc/cgraphunit.c:1594 1594 execute_pass_list (g->get_passes ()->all_passes); (gdb) p node - $1 = + $1 = vec<> pointers are printed as the address followed by the elements in braces. Here's a length 2 vec: @@ -245,18 +245,45 @@ class TreePrinter: # Callgraph pretty-printers ###################################################################### -class CGraphNodePrinter: +class SymtabNodePrinter: def __init__(self, gdbval): self.gdbval = gdbval def to_string (self): - result = '