This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [PATCH] PR59170 make pretty printers check for singular iterators
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, Keith Seitz <keiths at redhat dot com>, Pedro Alves <palves at redhat dot com>, gdb at sourceware dot org
- Date: Fri, 16 Dec 2016 14:32:20 +0100
- Subject: Re: [PATCH] PR59170 make pretty printers check for singular iterators
- Authentication-results: sourceware.org; auth=none
- References: <20161215141817.GA22699@redhat.com> <20161215211903.GA22897@host1.jankratochvil.net> <20161216010707.GF22266@redhat.com> <20161216075136.GA21305@host1.jankratochvil.net> <20161216123352.GB895@redhat.com> <20161216130645.GA27556@host1.jankratochvil.net> <20161216131732.GE895@redhat.com>
On Fri, 16 Dec 2016 14:17:32 +0100, Jonathan Wakely wrote:
> On 16/12/16 14:06 +0100, Jan Kratochvil wrote:
> > (gdb) p bb.c.d
> > $4 = (D &) @0x601028: {e = 0x601060 <ee>}
>
> Wat?
>
> bb.c.d is not a valid expression.
>
> B::c is a pointer, it should be bb.c->d
>
> Is it GDB policy to make invalid expressions like that "work"?
Yes, this is a GDB extension from the times of plain C. In C++ it became
a problem. That was not the topic of this example for the initial
dereferencing operator.
> I had no idea this even worked, I'd have used bb.c->d.e->i because
> that's the correct expression for accessing that variable.
There was a plan to make the 'compile' project backward compatible with these
confusing GDB universal dot operators.
Jan