Patchwork [v3] Python API: Fix an exception when registering a global pretty-printer in verbose mode

mail settings
Submitter Martin Galvan
Date April 16, 2015, 1:55 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/6262/
State New
Headers show


Martin Galvan - April 16, 2015, 1:55 p.m.
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/", 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 (, 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 to the next line so that it won't break the 80 character limit.


2015-04-16  Martin Galvan  <>

	* python/lib/gdb/ (register_pretty_printer): Fix exception
	when registering a global pretty-printer in verbose mode.
 gdb/python/lib/gdb/ | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



diff --git a/gdb/python/lib/gdb/ b/gdb/python/lib/gdb/
index e384e41..c935333 100644
--- a/gdb/python/lib/gdb/
+++ b/gdb/python/lib/gdb/
@@ -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" %
         obj = gdb
         if gdb.parameter("verbose"):