From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E56983851508 for ; Thu, 27 Oct 2022 13:46:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E56983851508 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666878402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qihEXUrb5Ofx8Kv3uLMtZ5Gi9xPpMv6xvN42TTp3T/M=; b=duNF9iJOhbOhyTt2XRvtfwhHi+3W2xdzuDKRdx6x4HtLuPOhkB74rBLyd5HPFIrjpFkRvP rAv47zL1eA4pQjSVjIHSGQR24To95HlFUzHmx4H4J9xol1jfdtc9PCgZ1I2c3H7IpdJz/W dZ/OPDHerwM8GG6E8vEFjH2j+A5Djas= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-515-zp1Ai6KyNZiOjzCIr5PSBQ-1; Thu, 27 Oct 2022 09:46:41 -0400 X-MC-Unique: zp1Ai6KyNZiOjzCIr5PSBQ-1 Received: by mail-ej1-f72.google.com with SMTP id xh12-20020a170906da8c00b007413144e87fso1052945ejb.14 for ; Thu, 27 Oct 2022 06:46:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qihEXUrb5Ofx8Kv3uLMtZ5Gi9xPpMv6xvN42TTp3T/M=; b=KUBf+xMn9IuVnDuaqIFVdq728QSJJ8YwXG7hgQvsD22N0yCOjpVOITAubuEMtr/HUP KyLbk9Q4XMO3y3/0kwOyZjjfiLh/NAdFFbj+/Q4VbVVFV7jq1R12NhDmbVnWvGvVbMwV 8FQs1GeyPMTaE6Uk5wxCmfqICwPSodVHkg6blJtYyoYLtDilHIZWMKgEoi3bTASkyXo7 kTdYq9HHvSUgXyaOHP/8gZsD4azT8qXZQnq6Ip/Ra4/0deQH/JsNs6w6MOI/JMxlOMd5 vggdwjtPwwKURDBapQ8O3fcveBdjM0NgTNCpkSRWXblgO/CXUolbY0oK9tBz2bhJPQPk Tlvw== X-Gm-Message-State: ACrzQf3doVZTBcRWuNeasha3YPbZcZp+pRaWKt/VEGHJ1mUTv9uBJpDM af56WU1AYV1PHUp5x1jdHMS0lNnkZSf+afCmSFmWg+OUAzT54qJtmecCq3DId1toTtgNQf1x0BI PRyQPXCkFFIk2oTpsHSGKKA== X-Received: by 2002:a05:6402:11ce:b0:45c:a364:2c3d with SMTP id j14-20020a05640211ce00b0045ca3642c3dmr46344243edw.204.1666878399463; Thu, 27 Oct 2022 06:46:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Koie7L6guC+7fwMEw70YfDhLgDuC/kRLOh5Il52bTsBqmDTvjVBIlRmGeHhNpL9TPh4W2Sg== X-Received: by 2002:a05:6402:11ce:b0:45c:a364:2c3d with SMTP id j14-20020a05640211ce00b0045ca3642c3dmr46344231edw.204.1666878399211; Thu, 27 Oct 2022 06:46:39 -0700 (PDT) Received: from [10.43.2.105] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id w4-20020a05640234c400b00461bd82581asm1084928edc.84.2022.10.27.06.46.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Oct 2022 06:46:38 -0700 (PDT) Message-ID: <2bce3d97-7d9c-5ec7-15c9-a74129816ecd@redhat.com> Date: Thu, 27 Oct 2022 15:46:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 07/11] gdb/testsuite: skip gdb.cp/anon-struct.exp when using clang To: Andrew Burgess , gdb-patches@sourceware.org References: <20221004170747.154307-1-blarsen@redhat.com> <20221004170747.154307-9-blarsen@redhat.com> <87zgdi63nb.fsf@redhat.com> From: Bruno Larsen In-Reply-To: <87zgdi63nb.fsf@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 26/10/2022 16:49, Andrew Burgess wrote: > Bruno Larsen via Gdb-patches writes: > >> When clang compiles anonymous structures, it does not add linkage names in >> their dwarf representations. This is compounded by clang not adding linkage >> names to subprograms of those anonymous structs (for instance, the >> constructor). >> >> Since this isn't a bug on clang or GDB, but there is no way to make >> anon-struct.exp work when using clang, just mark that test as untested. >> >> Since I was already touching the file, I also added a comment at the top >> of the file explaining what it is testing for. >> --- >> gdb/testsuite/gdb.cp/anon-struct.exp | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/gdb/testsuite/gdb.cp/anon-struct.exp b/gdb/testsuite/gdb.cp/anon-struct.exp >> index 2c709ab9ecc..774ec882a07 100644 >> --- a/gdb/testsuite/gdb.cp/anon-struct.exp >> +++ b/gdb/testsuite/gdb.cp/anon-struct.exp >> @@ -14,12 +14,20 @@ >> # You should have received a copy of the GNU General Public License >> # along with this program. If not, see . >> >> +# This test is used to verify GDB's abiility to refer to linkage names >> +# for types and functions. > Type: 'ability'. > > Also, I wonder if this comment should explicitly say something like: > > "...for types and functions within anonymous structs." > > maybe? Yeah, good call. > >> + >> standard_testfile .cc >> >> if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } { >> return -1 >> } >> >> +if {[test_compiler_info clang-*-*]} { > Missing the language argument to test_compiler_info. > >> + untested "clang does not use linkage name in this case" >> + return > You specifically call out the missing linkage name here, but both the > DW_AT_name and DW_AT_linkage name are filled in by GCC, and not with > Clang. Is it the linkage name in particular that is critical here? Well, I guess I need to workshop my explanation. The problem is that GCC generates a linkage name (t in this case), and uses this name for the constructor, so we can use t::t() to refer to the anonymous structure's constructor. Clang doesn't use the linkage name to generate the name of the constructor (or give it any name at all) so it ends with the constructor t::(), which isn't a valid expression for GDB. I decided not to fix this because I'm not convinced calling the constructor of an anonymous structure makes much sense, but I'm open to being convinced. Cheers, Bruno > > Either way, I wonder if a more extended comment within this if block > might be useful, just touching on the differences in behaviour between > GCC and Clang, and why than means this test will not work with Clang. > > Thanks, > Andrew > > >> +} >> + >> if { [is_aarch32_target] } { >> gdb_test "ptype t::t" "type = struct t {\r\n C m;\r\n} \\*\\(t \\* const\\)" \ >> "print type of t::t" >> -- >> 2.37.3