This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix 'info type-printers' Python error - PR 17136


by Clem Dickey and Jonathan Wakely:

if you debug any program then register the type printer with the current
objfile, running 'info type-printers' results in a python exception:

(gdb) info type-printers
Python Exception <type 'exceptions.AttributeError'> 'gdb.Objfile' object has no attribute 'name': 
Error occurred in Python command: 'gdb.Objfile' object has no attribute 'name'
(gdb) info type-printers 
Type printers for /lib64/

The exception doesn't happen if the type printer is registered globally, by
passing None instead of gdb.current_objfile().

The patch can be checked in IMO.
Given that I don't have the time to write a testcase myself
I'm not going to force someone else to.
Another reviewer may require one though.

2015-06-26  Clem Dickey <>

	Fix 'info type-printers' Python error.
	* python/lib/gdb/command/ (InfoTypePrinter): Fix typo.

diff --git a/gdb/python/lib/gdb/command/ b/gdb/python/lib/gdb/command/
index 0ef7686..1203989 100644
--- a/gdb/python/lib/gdb/command/
+++ b/gdb/python/lib/gdb/command/
@@ -47,7 +47,7 @@ class InfoTypePrinter(gdb.Command):
         sep = ''
         for objfile in gdb.objfiles():
             if objfile.type_printers:
-                print ("%sType printers for %s:" % (sep,
+                print ("%sType printers for %s:" % (sep, objfile.filename))
                 sep = '\n'
         if gdb.current_progspace().type_printers:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]