This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Python API: Fix an exception when registering a global pretty-printer in verbose mode
- From: Martin Galvan <martin dot galvan at tallertechnologies dot com>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Sat, 28 Mar 2015 17:39:54 -0300
- Subject: Re: [PATCH v2] Python API: Fix an exception when registering a global pretty-printer in verbose mode
- Authentication-results: sourceware.org; auth=none
- References: <1426097817-30955-1-git-send-email-martin dot galvan at tallertechnologies dot com> <21760 dot 54598 dot 126480 dot 383468 at ruffy2 dot mtv dot corp dot google dot com>
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!
--
Martin Galvan
Software Engineer
Taller Technologies Argentina
San Lorenzo 47, 3rd Floor, Office 5
CÃrdoba, Argentina
Phone: 54 351 4217888 / +54 351 4218211