From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4F5hLZQz0mAKZAAAWB0awg (envelope-from ) for ; Tue, 22 Jun 2021 15:01:40 -0400 Received: by simark.ca (Postfix, from userid 112) id B6DB51F1F2; Tue, 22 Jun 2021 15:01:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DEA9E1EE14 for ; Tue, 22 Jun 2021 15:01:39 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A04B93951E7E for ; Tue, 22 Jun 2021 19:01:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A04B93951E7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1624388499; bh=pQRmz3g40rBPsrmTh2l+CLBWDKZTQHJJVg8qAlKFwO8=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qa1ZjvtDX5GQGxbf4XhBDJ8WKsXAVRY44vV4aBSFzkMiFjcoxWC/4cl4EKwL50zHn l290SI+kHFJ8t6IYRGvG6fPLKzGQDL2YrNrrH5Zk7AyQzIVjzLJdJwHtpqLrG4Kmka cB3ansBlYDebsNYf7vr3h/w5iz2GPNOerDOM9XPk= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id B67D03939C23 for ; Tue, 22 Jun 2021 19:01:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B67D03939C23 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 15MJ14BO022367 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 15:01:09 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 15MJ14BO022367 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id C1A9B1EE14; Tue, 22 Jun 2021 15:01:04 -0400 (EDT) Subject: Re: C++ nested class bug/questions To: "Willgerodt, Felix" , "gdb@sourceware.org" References: <391f40b3730d4f2486b3fcd324cf4c31@intel.com> Message-ID: <5d280321-c8b7-46b7-8dad-c55601afdc30@polymtl.ca> Date: Tue, 22 Jun 2021 15:01:04 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <391f40b3730d4f2486b3fcd324cf4c31@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 22 Jun 2021 19:01:04 +0000 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb Reply-To: Simon Marchi Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" 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