public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers
@ 2014-07-09 12:08 jwakely.gcc at gmail dot com
  2014-07-22 18:27 ` [Bug python/17136] " jan.kratochvil at redhat dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jwakely.gcc at gmail dot com @ 2014-07-09 12:08 UTC (permalink / raw)
  To: gdb-prs

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 <type 'exceptions.AttributeError'> '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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-03-13 13:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
2014-07-22 18:27 ` [Bug python/17136] " jan.kratochvil at redhat dot com
2014-07-24 17:17 ` keiths at redhat dot com
2015-05-29 12:06 ` jwakely.gcc at gmail dot com
2015-05-29 12:11 ` jwakely.gcc at gmail dot com
2015-06-01 19:02 ` dje at google dot com
2015-06-01 19:13 ` dje at google dot com
2015-06-01 19:22 ` dje at google dot com
2015-06-26 13:49 ` jan.kratochvil at redhat dot com
2015-08-06 16:26 ` cvs-commit at gcc dot gnu.org
2015-08-06 16:30 ` cvs-commit at gcc dot gnu.org
2015-08-06 16:35 ` dje at google dot com
2023-03-13 13:41 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).