This is the mail archive of the gdb@sourceware.org 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]

Re: Python Pretty printing a struct


On 16/03/2010 3:38 AM, Tom Tromey wrote:
"Chris" == Chris Johns<chris@contemporary.net.au> writes:

Chris> def to_string(self): Chris> return 'to_string'

This seems like a strange definition for this method.

I am not sure I follow. The 'to_string' text was just to show where the output appeared.


Try removing it.

Commenting out the function produced:


(gdb) p the_semaphore->Object.id
$4 = AttributeError: object_id_printer instance has no attribute 'to_string'
 = {
  id = 436273170,
  node = 1,
  api = classic,
  class = semaphores,
  index = 18
}

Trying:

    def to_string(self):
        return None

and

    def to_string(self):
        pass

gave:

(gdb) p the_semaphore->Object.id
$5 = TypeError: Could not convert Python object: None
 = {
  id = 436273170,
  node = 1,
  api = classic,
  class = semaphores,
  index = 18
}


Chris> Should I raise a bug report ?


Sure.


Bug #11380.



This is probably due to http://sourceware.org/bugzilla/show_bug.cgi?id=10660



Agreed.


Chris


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