From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: "Elmenthaler, Jens" <jens.elmenthaler@verigy.com>
Cc: gdb@sourceware.org, archer@sourceware.org, dje@google.com
Subject: Re: [python] Pretty-printers and addressprint
Date: Tue, 10 Nov 2009 08:06:00 -0000 [thread overview]
Message-ID: <8ac60eac0911100006yc31e2acmba7bf9fde33ddfa@mail.gmail.com> (raw)
In-Reply-To: <58596C4646708B4BB990C44839973330013A61DE@usplmvpbe001.ent.rt.verigy.net>
On Mon, Nov 9, 2009 at 11:25 PM, Elmenthaler, Jens
<jens.elmenthaler@verigy.com> wrote:
> The gdb.Value class has a string() method, you could try this in your to_string method:
> return self.val['whybother']['contents'].string()
That doesn't quite do what I want, but this almost does:
return '"' + self.val['whybother']['contents'].string() + '"'
However, consider a modification of the original test:
- string x = make_string ("this is x");
+ string x = make_string ("this is x\201\202\203\204");
With the original pretty-printer, this produces:
$4 = 0x4007e0 "this is x\201\202\203\204"
which is exactly what I want, if only it didn't have the address. With
proposed patch, it produces exactly what I want:
$4 = "this is x\201\202\203\204"
But this value can't be converted to a python string in ASCII charset:
the modified printer produces this:
$4 = Traceback (most recent call last):
File "../../../src/gdb/testsuite/gdb.python/py-prettyprint.py",
line 27, in to_string
return self.val['whybother']['contents'].string()
UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position
9: ordinal not in range(128)
Unfortunately I frequently deal with non-ascii strings, and the
problem just wouldn't go away :-(
Previous threads on this subject, e.g.
http://sourceware.org/ml/archer/2008-q4/msg00180.html didn't appear to
have reached a satisfactory conclusion.
Thanks,
--
Paul Pluzhnikov
next prev parent reply other threads:[~2009-11-10 8:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 2:12 Paul Pluzhnikov
2009-11-10 7:25 ` Elmenthaler, Jens
2009-11-10 8:06 ` Paul Pluzhnikov [this message]
2009-11-10 8:37 ` Phil Muldoon
2009-11-10 11:53 ` Paul Koning
2009-11-10 15:45 ` Paul Pluzhnikov
2009-11-10 15:53 ` Paul Koning
2009-11-10 16:53 ` Tom Tromey
2009-11-10 17:03 ` Paul Pluzhnikov
2009-11-10 20:49 ` Tom Tromey
2009-11-10 15:12 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ac60eac0911100006yc31e2acmba7bf9fde33ddfa@mail.gmail.com \
--to=ppluzhnikov@google.com \
--cc=archer@sourceware.org \
--cc=dje@google.com \
--cc=gdb@sourceware.org \
--cc=jens.elmenthaler@verigy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).