From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19569 invoked by alias); 9 Jul 2014 12:08:29 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 19534 invoked by uid 48); 9 Jul 2014 12:08:28 -0000 From: "jwakely.gcc at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers Date: Wed, 09 Jul 2014 12:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: 7.7 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jwakely.gcc at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q3/txt/msg00032.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17136 Bug ID: 17136 Summary: 'info type-printers' causes an exception when there are per-objfile printers Product: gdb Version: 7.7 Status: NEW Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: jwakely.gcc at gmail dot com Given this type printer defined somewhere like .gdbinit class Printer(object): def __init__ (self): self.name = 'Printer' self.enabled = True class _recognizer(object): def recognize(self, type_obj): if type_obj.tag == "Foo": return "Bar" return None def instantiate(self): return self._recognizer() if you debug any program then register the type printer with the current objfile, running 'info type-printers' results in a python exception: (gdb) start Temporary breakpoint 1 at 0x4005b4: file bug.cc, line 4. Starting program: /tmp/a.out Temporary breakpoint 1, main () at bug.cc:4 4 return 0; (gdb) python gdb.types.register_type_printer(gdb.current_objfile(), Printer()) (gdb) info type-printers Python Exception 'gdb.Objfile' object has no attribute 'name': Error occurred in Python command: 'gdb.Objfile' object has no attribute 'name' The exception doesn't happen if the type printer is registered globally, by passing None instead of gdb.current_objfile(). -- You are receiving this mail because: You are on the CC list for the bug.