[python] Pretty-printers and addressprint

Paul Pluzhnikov ppluzhnikov@google.com
Tue Nov 10 19:07:00 GMT 2009


On Tue, Nov 10, 2009 at 8:53 AM, Tom Tromey <tromey@redhat.com> wrote:

> What you want instead is repr(value.string()), at least if you want to
> try this route.

That of course can't work, since it's the value.string() which
raises exception. Here is the output:

$4 = Traceback (most recent call last):
  File "../../../src/gdb/testsuite/gdb.python/py-prettyprint.py", line
27, in to_string
    return repr(self.val['whybother']['contents'].string())
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position
9: ordinal not in range(128)


It also changes other output in the way I didn't expect:

print cstring
$5 = u'const string'

print c
$6 = container u'container' with 2 elements = {
  [0] = 23,
  [1] = 72
}

Thanks,
-- 
Paul Pluzhnikov



More information about the Gdb mailing list