From patchwork Thu Apr 16 13:55:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Galvan X-Patchwork-Id: 6262 Received: (qmail 45468 invoked by alias); 16 Apr 2015 13:55:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 45440 invoked by uid 89); 16 Apr 2015 13:55:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_SOFTFAIL, TBC autolearn=no version=3.3.2 X-HELO: mail-qg0-f52.google.com Received: from mail-qg0-f52.google.com (HELO mail-qg0-f52.google.com) (209.85.192.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 16 Apr 2015 13:55:14 +0000 Received: by qgfi89 with SMTP id i89so5863241qgf.1 for ; Thu, 16 Apr 2015 06:55:12 -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:to:subject:date:message-id; bh=vczSukL+CHcTzB/JR9b3GDjuBCae21ro3eWG6VJ9PQ0=; b=aPeccmCB783hBWxi98h/+w5F/EBb9+NJQ9dn9dZejoOaJfSC2SDvF1Yo54Mi/qCizM pIiRY3JopuEDrBpdqEUYX2tXDLleXX/rksK0W/nRzOOpKbOU6p4MGy7qRI77Q4pzxp+6 h+zJ8GrlF1auR9TU17zh1/zJ/+J9K2XnooE9sB95LxFSexw4wueOu9lmJT5eY7LKhg7W 6fX2YWw6m/aZy3A8VsrSI7lH/iBps+slp4VyxIMVrgJcpXHXJa/tgepC+7Q9YnSBuSWh +KEHISQFNn5tBHZOGTclEaMudCuupH8+wfjefT+SAbN9imWWirmZLeJhTjXCL33+lX2t b68Q== X-Gm-Message-State: ALoCoQkFedQoe00Y2LThQ77XeIrxiHgVFPUE/b7zMUalQJMlfWj8Gw4EtSsgoPM9orJArTq18sB1 X-Received: by 10.55.27.42 with SMTP id b42mr62867372qkb.53.1429192511918; Thu, 16 Apr 2015 06:55:11 -0700 (PDT) Received: from localhost.localdomain ([200.69.202.173]) by mx.google.com with ESMTPSA id 72sm5620050qhx.32.2015.04.16.06.55.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Apr 2015 06:55:10 -0700 (PDT) From: Martin Galvan To: gdb-patches@sourceware.org, dje@google.com Subject: [PATCH v3] Python API: Fix an exception when registering a global pretty-printer in verbose mode Date: Thu, 16 Apr 2015 10:55:05 -0300 Message-Id: <1429192505-5750-1-git-send-email-martin.galvan@tallertechnologies.com> This patch fixes a Python exception that was being thrown when trying to register a global pretty-printer with verbose mode on: File "/usr/share/gdb/python/gdb/printing.py", line 119, in register_pretty_printer gdb.write("Registering global %s pretty-printer ...\n" % name) NameError: name 'name' is not defined This patch was previously accepted by Doug Evans (https://sourceware.org/ml/gdb-patches/2015-03/msg00312.html), but it was never committed. I have a company-wide copyright assignment for gdb. I don't have commit access though, so it would be great if anyone could commit this for me. Thanks a lot! Chamges in v3: * Added the function name to the ChangeLog entry, and wrapped it at 80 characters. Changes in v2: * Moved printer.name to the next line so that it won't break the 80 character limit. --- ChangeLog: gdb/ 2015-04-16 Martin Galvan * python/lib/gdb/printing.py (register_pretty_printer): Fix exception when registering a global pretty-printer in verbose mode. --- gdb/python/lib/gdb/printing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.3.5 diff --git a/gdb/python/lib/gdb/printing.py b/gdb/python/lib/gdb/printing.py index e384e41..c935333 100644 --- a/gdb/python/lib/gdb/printing.py +++ b/gdb/python/lib/gdb/printing.py @@ -116,7 +116,8 @@ def register_pretty_printer(obj, printer, replace=False): if obj is None: if gdb.parameter("verbose"): - gdb.write("Registering global %s pretty-printer ...\n" % name) + gdb.write("Registering global %s pretty-printer ...\n" % + printer.name) obj = gdb else: if gdb.parameter("verbose"):