This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: [python] Should pretty-printer affect resulting gdb-history value?
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: archer at sourceware dot org
- Date: Wed, 17 Dec 2008 14:38:42 -0800
- Subject: Re: [python] Should pretty-printer affect resulting gdb-history value?
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1229553525; bh=SaZXVJtEIC+ier/rfIJ11Jnk3wo=;h=DomainKey-Signature:MIME-Version:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type: Content-Transfer-Encoding; b=eGEHanezDzplEl07WtQr/n4UErqfyj6mYQcJltIsF2rccBHy/smFwmtuI1rafXWVRom1YHos//XI09NzeYwsmg==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=mime-version:in-reply-to:references:date:message-id:subject:from:to:cc:content-type:content-transfer-encoding;b=gT0mAUKA4aOlh7E85i2Q9qjlNJQGKnTUfnp6vIx95AIwd7yUjsAEqrbDW+eOQ73d5hpX4PU8xo5bzeCDAlCIwQ==
- References: <20081217202204.822303A6B3C@localhost> <m3ej06o5pk.fsf@fleche.redhat.com>
On Wed, Dec 17, 2008 at 1:24 PM, Tom Tromey <tromey@redhat.com> wrote:
> So according to the original plan it would look like:
>
> (gdb) print s
> $3.ptr = 0x7fffffffe5dc
Ah, I see...
> I'm not sure where we should go.
>
> On the one hand, yeah, pretty-printing shows a strange view of the
> world: it changes the printout but then you can't operate directly on
> what you see.
>
> On the other hand, it also seems strange for an expression's value to
> change.
What if to_string() returned a tuple: (LHS, value).
With LHS = None, you get the same result you get today.
For smart pointers, you get something usable if pretty-printer returns
".ptr" in LHS.
> Also, we have to consider sub-values. Suppose you also had
>
> struct T { struct S s; } t;
>
> Then, e.g.:
>
> (gdb) print t
> $1 = {
> s = 0x7fffffffe5dc
> }
With tuple return, this would be displayed as
$1 = {
s.ptr = 0x7fffffffe5dc
}
and that would make clear to the user that he needs to
'print *t.s.ptr' ...
For a "C linked list" pretty-printer, set LHS to None.
Comments?
--
Paul Pluzhnikov