[v2] Python API: Fix an exception when registering a global pretty-printer in verbose mode
Message ID | 1426097817-30955-1-git-send-email-martin.galvan@tallertechnologies.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 39196 invoked by alias); 11 Mar 2015 18:17:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 39187 invoked by uid 89); 11 Mar 2015 18:17:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-qg0-f42.google.com Received: from mail-qg0-f42.google.com (HELO mail-qg0-f42.google.com) (209.85.192.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 11 Mar 2015 18:17:06 +0000 Received: by qgdz107 with SMTP id z107so12158332qgd.3 for <gdb-patches@sourceware.org>; Wed, 11 Mar 2015 11:17:04 -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=6aHXi00redxNjG9bOWESGX5LsdfEmyVmo6EwKVP1ecE=; b=BgN/au7RivfxCoxBdtzxFLxmt6QWoORJ3wPLTLnYEiYjvVgRhQY01bJOfOKOAd/7Ay jlvO5Jta7ae8M0uXKNn1cVN0FS1R3JhLE7ftwqdjfUMSwmFY8A5rW68aBhdKL8PzivHn 9S1K0nIsfYynQDDU5ZfAMZVthbh9TIpfvW3fDbxoVuKaJmJZTDrhVB+/LG3zOH/X80u9 DWC+yGf8sLSKWqMrZr8PgCiKXYAh9nwBwjfuxMdenPPIoybGj1VZ1oymfoYkgc5v6wx7 nrQSEIuq1Dqp2kQuqLi46v6UsLOIMCZDUl+V6mo4N4Y/UKauWtcfeTBqQ5hz1WTLiRnl K7Cw== X-Gm-Message-State: ALoCoQnbrwxeKeJRDcxGE2gD2nerccqhmUemCp/8z+B8FIuwlnJ2TkWjW4HhAnOffQDcKah8R6dG X-Received: by 10.55.55.4 with SMTP id e4mr66814119qka.97.1426097824549; Wed, 11 Mar 2015 11:17:04 -0700 (PDT) Received: from martin-galvan.dominio.tallertechnologies.com ([200.69.202.173]) by mx.google.com with ESMTPSA id n77sm3049104qha.19.2015.03.11.11.17.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Mar 2015 11:17:03 -0700 (PDT) From: Martin Galvan <martin.galvan@tallertechnologies.com> To: gdb-patches@sourceware.org, dje@google.com Subject: [PATCH v2] Python API: Fix an exception when registering a global pretty-printer in verbose mode Date: Wed, 11 Mar 2015 15:16:57 -0300 Message-Id: <1426097817-30955-1-git-send-email-martin.galvan@tallertechnologies.com> |
Commit Message
Martin Galvan
March 11, 2015, 6:16 p.m. UTC
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 My copyright assignment is on the works, but since this is a small patch I don't think it's necessary. Changes from v1: * Moved printer.name to the next line so that it won't break the 80 character limit. -- Changelog: 2015-03-11 Martin Galvan <martin.galvan@tallertechnologies.com> * python/lib/gdb/printing.py: Fix exception when registering a global pretty-printer in verbose mode.
Comments
Martin Galvan writes: > 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 > > My copyright assignment is on the works, but since this is a small patch I don't think it's necessary. > > Changes from v1: > * Moved printer.name to the next line so that it won't break the 80 character limit. > > -- > > Changelog: > > 2015-03-11 Martin Galvan <martin.galvan@tallertechnologies.com> > > * python/lib/gdb/printing.py: Fix exception when registering a global pretty-printer in verbose mode. > > diff --git a/gdb/python/lib/gdb/printing.py b/gdb2/python/lib/gdb/printing.py > index 47742a9..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"): LGTM, with two more nits. The ChangeLog entry > 80 char limit :-), and convention is to include the function name in the ChangeLog entry. E.g., 2015-03-11 Martin Galvan <martin.galvan@tallertechnologies.com> * python/lib/gdb/printing.py (register_pretty_printer): Fix exception when registering a global pretty-printer in verbose mode. No need to repost though. Ok to commit with that fixed.
On Wed, Mar 11, 2015 at 8:52 PM, Doug Evans <dje@google.com> wrote: > LGTM, with two more nits. > The ChangeLog entry > 80 char limit :-), > and convention is to include the function name in the ChangeLog entry. > > E.g., > > 2015-03-11 Martin Galvan <martin.galvan@tallertechnologies.com> > > * python/lib/gdb/printing.py (register_pretty_printer): Fix exception > when registering a global pretty-printer in verbose mode. > > No need to repost though. > Ok to commit with that fixed. Thanks a lot! I'll keep that in mind for any future patches.
On Wed, Mar 11, 2015 at 8:52 PM, Doug Evans <dje@google.com> wrote: > Martin Galvan writes: > > 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 > > > > My copyright assignment is on the works, but since this is a small patch I don't think it's necessary. > > > > Changes from v1: > > * Moved printer.name to the next line so that it won't break the 80 character limit. > > > > -- > > > > Changelog: > > > > 2015-03-11 Martin Galvan <martin.galvan@tallertechnologies.com> > > > > * python/lib/gdb/printing.py: Fix exception when registering a global pretty-printer in verbose mode. > > > > diff --git a/gdb/python/lib/gdb/printing.py b/gdb2/python/lib/gdb/printing.py > > index 47742a9..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"): > > LGTM, with two more nits. > The ChangeLog entry > 80 char limit :-), > and convention is to include the function name in the ChangeLog entry. > > E.g., > > 2015-03-11 Martin Galvan <martin.galvan@tallertechnologies.com> > > * python/lib/gdb/printing.py (register_pretty_printer): Fix exception > when registering a global pretty-printer in verbose mode. > > No need to repost though. > Ok to commit with that fixed. Sorry to bother, but I don't have write privileges on the repository; would you be so kind to commit this for me? Thanks a lot!
> > 2015-03-11 Martin Galvan <martin.galvan@tallertechnologies.com> > > > > * python/lib/gdb/printing.py (register_pretty_printer): Fix exception > > when registering a global pretty-printer in verbose mode. > > > > No need to repost though. > > Ok to commit with that fixed. > > Sorry to bother, but I don't have write privileges on the repository; > would you be so kind to commit this for me? Martin - I am going through my gdb-patches mailbox, and I am wondering if anyone pushed that patch for you? If not, would you mind rebasing your patch and sending it to us, please (with our sincerest apologies!)?
On Fri, Jan 1, 2016 at 8:32 AM, Joel Brobecker <brobecker@adacore.com> wrote: > Martin - I am going through my gdb-patches mailbox, and I am wondering > if anyone pushed that patch for you? If not, would you mind rebasing > your patch and sending it to us, please (with our sincerest apologies!)? > > -- > Joel Hi! Thanks a lot for writing. I honestly don't remember what happened to this patch :) however looking at the git master it seems that it's fixed already. In any case, I now have commit-after-approval access, so I'll test it next week and commit it myself if it's still breaking. Again, thanks a lot and happy new year!
> Hi! Thanks a lot for writing. I honestly don't remember what happened > to this patch :) however looking at the git master it seems that it's > fixed already. In any case, I now have commit-after-approval access, > so I'll test it next week and commit it myself if it's still breaking. Ah, even better! :) > Again, thanks a lot and happy new year! You are very welcome. Happy New Year to you too :).
diff --git a/gdb/python/lib/gdb/printing.py b/gdb2/python/lib/gdb/printing.py index 47742a9..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"):