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.133.124]) by sourceware.org (Postfix) with ESMTPS id 1CE44383802A for ; Thu, 31 Mar 2022 19:13:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CE44383802A Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-422-3vYsHM5eMeGu9qfk44LMIQ-1; Thu, 31 Mar 2022 15:13:53 -0400 X-MC-Unique: 3vYsHM5eMeGu9qfk44LMIQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 62FA31C0692A; Thu, 31 Mar 2022 19:13:52 +0000 (UTC) Received: from [10.97.116.41] (ovpn-116-41.gru2.redhat.com [10.97.116.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAF7E40CF8F2; Thu, 31 Mar 2022 19:13:48 +0000 (UTC) Message-ID: <97b583eb-c61a-3e43-7c5f-567b74e26300@redhat.com> Date: Thu, 31 Mar 2022 16:13:44 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 09/11] gdb/testsuite: don't test gdb.base/msym-bp-shl with clang To: Pedro Alves , gdb-patches@sourceware.org References: <20220126195053.69559-1-blarsen@redhat.com> <20220126195053.69559-10-blarsen@redhat.com> <9c0115ea-7178-91ee-9614-586d243b578c@redhat.com> From: Bruno Larsen In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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: 8bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2022 19:13:57 -0000 On 3/31/22 15:49, Pedro Alves wrote: > On 2022-03-30 13:19, Bruno Larsen wrote: >> On 3/2/22 16:33, Pedro Alves wrote: >>> On 2022-01-26 19:50, Bruno Larsen via Gdb-patches wrote: >>>> Clang will optimize away the static function in one of the files, and >>>> the test is here to specifically test GDB's behavior when that function >>>> is present, so it makes no sense to have this test run with that >>>> compiler. >>> >>> Please expand this info to include a snippet of the failing test. >>> Also, it's best if the the body of the commit log, doesn't assume the subject is read >>> as part of it.  You will notice that if you read the body in isolation, without the >>> subject line, and also without the diff context, the commit log is vague as is. >> >> Will do! Sorry for the delay, got sidetracked with another issue. >> >>> >>>> --- >>>>   gdb/testsuite/gdb.base/msym-bp-shl.exp | 7 +++++++ >>>>   1 file changed, 7 insertions(+) >>>> >>>> diff --git a/gdb/testsuite/gdb.base/msym-bp-shl.exp b/gdb/testsuite/gdb.base/msym-bp-shl.exp >>>> index 42adcb191dd..95d5c393505 100644 >>>> --- a/gdb/testsuite/gdb.base/msym-bp-shl.exp >>>> +++ b/gdb/testsuite/gdb.base/msym-bp-shl.exp >>>> @@ -22,6 +22,13 @@ if {[skip_shlib_tests]} { >>>>       return 0 >>>>   } >>>>   +# clang will optimize away the static foo, making a single breakpoint >>>> +# so there is no point testing it here. >>> >>> Uppercase Clang. >>> >>> The patch doesn't give enough info to understand why this is the best approach. >>> I could imagine using atttribute used to make sure the function isn't optimized >>> away, as alternative approach, for example.  Please make the case for the approach >>> taken. >> >> I tried using the attribute approach (after you mentioned it here), but clang still optimized the static foo away. I'll document it on the commit message and the comment here for v2. > > Odd, this makes it pass for me, with both Clang 10 and Clang 14: > > ~~~ > diff --git c/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c w/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c > index e047ac1145a..009656fd9ea 100644 > --- c/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c > +++ w/gdb/testsuite/gdb.base/msym-bp-shl-main-2.c > @@ -15,7 +15,7 @@ > You should have received a copy of the GNU General Public License > along with this program. If not, see . */ > > -static void > +static void __attribute__ ((used)) > foo (void) > { > } > ~~~ > > Can you double check? > My turn to Doh! I am not sure what I did wrong, but this time it worked. I'll use the attribute instead. -- Cheers! Bruno Larsen