This is the mail archive of the archer@sourceware.org mailing list for the Archer 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] Should pretty-printer affect resulting gdb-history value?


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


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