Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org,
	       Keith Seitz <keiths@redhat.com>,
	Pedro Alves <palves@redhat.com>,
	       gdb@sourceware.org
Subject: Re: [PATCH] PR59170 make pretty printers check for singular iterators
Date: Fri, 16 Dec 2016 13:32:00 -0000	[thread overview]
Message-ID: <20161216133220.GA32613@host1.jankratochvil.net> (raw)
In-Reply-To: <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


      reply	other threads:[~2016-12-16 13:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161215141817.GA22699@redhat.com>
     [not found] ` <20161215211903.GA22897@host1.jankratochvil.net>
     [not found]   ` <20161216010707.GF22266@redhat.com>
     [not found]     ` <20161216075136.GA21305@host1.jankratochvil.net>
     [not found]       ` <20161216123352.GB895@redhat.com>
2016-12-16 13:07         ` Jan Kratochvil
2016-12-16 13:17           ` Jonathan Wakely
2016-12-16 13:32             ` Jan Kratochvil [this message]

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=20161216133220.GA32613@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdb@sourceware.org \
    --cc=jwakely@redhat.com \
    --cc=keiths@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=palves@redhat.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