public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: "Willgerodt, Felix" <felix.willgerodt@intel.com>,
	"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: C++ nested class bug/questions
Date: Tue, 22 Jun 2021 15:01:04 -0400	[thread overview]
Message-ID: <5d280321-c8b7-46b7-8dad-c55601afdc30@polymtl.ca> (raw)
In-Reply-To: <391f40b3730d4f2486b3fcd324cf4c31@intel.com>

On 2021-06-22 7:27 a.m., Willgerodt, Felix via Gdb wrote:
> Hello everyone,
> 
> I was debugging a program similar to the one attached and noticed a couple
> of unexpected things happening. I compiled it with ”-g -O0” and g++ 11.1.0
> (clang showed similar behaviour) and saw this:
> 
> (gdb) bt
> #0  DF::vvv (this=0x7fffffffd120) at foo.cc:11
> #1  0x0000555555555180 in foo () at foo.cc:16
> #2  0x00005555555551a7 in main () at foo.cc:20
> (gdb) ptype abcd
> type = class DF::FFFF {
>   private:
>     int ffff;
> }
> (gdb) ptype FFFF
> No symbol "FFFF" in current context.
> (gdb) ptype DF::
> FFFF   vvv()  
> (gdb) ptype DF::FFFF
> There is no field named FFFF
> (gdb) ptype 'DF::FFFF'
> type = class DF::FFFF {
>   private:
>     int ffff;
> }
> (gdb)
> 
> (The fourth command shows tab completion.)
> 
> The problems I see are:
> 1) I think it shouldn’t be DF::FFFF.
> 2) 'ptype FFFF’ should just work as it is in the current scope.
> 3) There shouldn’t be a need to quote DF:FFFF, right? Although that might just be a side-effect here.
> 4) The fact that a suggestion from tab completion doesn’t work is annoying. This is probably also be a side-effect.
> 
> Before debugging this further, I wanted to see if there are any comments/suggestions.
> Am I even right about point 1? I couldn’t really find anything definitive
> in my favourite cpp reference on this type of nesting. g++ and clang output FFFF as
> foo()::DF::vvv()::FFFF as far as I can see.
> 
> I don’t see any obvious problems in the dwarf that is produced.
> 
> Thanks,
> Felix

I'm not a reference on this topic, but at first glance I agree with you.

Simon

  reply	other threads:[~2021-06-22 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 11:27 Willgerodt, Felix
2021-06-22 19:01 ` Simon Marchi [this message]
2021-06-23 13:59   ` Willgerodt, Felix

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=5d280321-c8b7-46b7-8dad-c55601afdc30@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=felix.willgerodt@intel.com \
    --cc=gdb@sourceware.org \
    /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).