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 BDBD0384D1A6 for ; Mon, 12 Sep 2022 12:30:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BDBD0384D1A6 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-301-mFphbQzsMZivu9FojNzP3A-1; Mon, 12 Sep 2022 08:30:52 -0400 X-MC-Unique: mFphbQzsMZivu9FojNzP3A-1 Received: by mail-wm1-f70.google.com with SMTP id y15-20020a1c4b0f000000b003b47578405aso1827478wma.5 for ; Mon, 12 Sep 2022 05:30:51 -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; bh=jmq1fZya9SjslsKs9ph2RzAUASzfsKo+ZJuvxgrbQlU=; b=J6PK3OvSuR7ZHWg/tAVp6HF0RMXoH3xQCXMS2lPcqI35rPxJt2ksCXTm8HRy9ldMsU tDp/amV6uIVni/pwExs1xtmPkGDctcIz1P/90qi/H4h+DXGQgxjgD7D8QWfYXIjJTUiV +vzr3XqUWyAYo2W6k78rdFr+xWjt36yY9Wuaa6AnN5VsOGSGJjROT9CHWgUdBKpwtRA2 dJMXXKqy2adaHfdFsVQ8Uh8wn6qahy7Pu8XmSVubXHPbvSyzLi+xlzMlbyGW9L7o6xUe /j3nYagJZJAEEBv4yUe9G8OS9xBMX9gGZ9IlgDZEkpxKjSuRycXmiBiVpAos+1pw9bQx 43MA== X-Gm-Message-State: ACgBeo1HAcQOusYR86YoHOP405RWj58nNsDJWFi8qn72e42+WQChP20P XiYXdeSU5T1AWCSPZF7PMRaguPbsgTRXGw+7B9gCE2APYVnNitJ5LqZGIWbYQjeW9m0j1B3UxyS sYg7VxDuTmrDcKE6D2Jp3kw== X-Received: by 2002:a05:600c:3d09:b0:3a5:e408:ca19 with SMTP id bh9-20020a05600c3d0900b003a5e408ca19mr14195035wmb.135.1662985851055; Mon, 12 Sep 2022 05:30:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR5y6GeeQVyKfspp39jSMuf9DoVQoRsjCOrj+bxlz3FHRHax+KeswzTqV+YEiNNbdDRgL0RqAw== X-Received: by 2002:a05:600c:3d09:b0:3a5:e408:ca19 with SMTP id bh9-20020a05600c3d0900b003a5e408ca19mr14195020wmb.135.1662985850801; Mon, 12 Sep 2022 05:30:50 -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 m1-20020a7bcb81000000b003a4efb794d7sm9585643wmi.36.2022.09.12.05.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Sep 2022 05:30:50 -0700 (PDT) Message-ID: <88490ee2-085f-ed2e-aa1c-f04b71557ce7@redhat.com> Date: Mon, 12 Sep 2022 14:30:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH v4 09/15] gdb/testsuite: fix gdb.base/msym-bp-shl when running with Clang To: Andrew Burgess , gdb-patches@sourceware.org References: <20220720194441.168906-1-blarsen@redhat.com> <20220720194441.168906-11-blarsen@redhat.com> <87h71cluzk.fsf@redhat.com> From: Bruno Larsen In-Reply-To: <87h71cluzk.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=-14.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Mon, 12 Sep 2022 12:30:55 -0000 On 12/09/2022 12:58, Andrew Burgess wrote: > Bruno Larsen via Gdb-patches writes: > >> Because Clang's -O0 is not as unoptimized as gcc's, one of the functions >> of gdb.base/msym-bp-shl was being optimized away, making the entire test >> fail. A lot of the test fail like so: >> >> (gdb) break foo >> Breakpoint 1 at 0x401030 >> (gdb) FAIL: gdb.base/msym-bp-shl.exp: debug=0: before run: break foo >> info breakpoint >> Num Type Disp Enb Address What >> 1 breakpoint keep y 0x0000000000401030 >> (gdb) FAIL: gdb.base/msym-bp-shl.exp: debug=0: before run: info breakpoint >> >> As the test expects 2 breakpoints to be placed. This can't be easily fixed >> by adding __attribute__ ((used)) to the function, since Clang will still >> optimize away the function. Because of this, the test is skipped when >> the it detects that Clang is being used > In this mail: > > https://sourceware.org/pipermail/gdb-patches/2022-March/187197.html > > Pedro suggests using __attribute__((used)), in your follow up: > > https://sourceware.org/pipermail/gdb-patches/2022-March/187199.html > > you confirm that this approach works for you. I just checked, and the > attribute patch Pedro suggests makes the test pass for me with Clang. > > Should this patch have been updated? If not, what changed? This patch should have been updated, sorry. -- Cheers, Bruno > > Thanks, > Andrew > >> --- >> gdb/testsuite/gdb.base/msym-bp-shl.exp | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/gdb/testsuite/gdb.base/msym-bp-shl.exp b/gdb/testsuite/gdb.base/msym-bp-shl.exp >> index 42adcb191dd..dd7d05bab52 100644 >> --- a/gdb/testsuite/gdb.base/msym-bp-shl.exp >> +++ b/gdb/testsuite/gdb.base/msym-bp-shl.exp >> @@ -22,6 +22,14 @@ if {[skip_shlib_tests]} { >> return 0 >> } >> >> +# Clang will optimize away the static foo, regardless of using >> +# __attribute__((used)), so we'll always get a single breakpoint >> +# making this test useless >> +if {[test_compiler_info {clang-*-*}]} { >> + untested "Clang optimizes away one of the functions" >> + return >> +} >> + >> standard_testfile msym-bp-shl-main.c msym-bp-shl-main-2.c msym-bp-shl-lib.c >> set srcfile ${srcdir}/${subdir}/${srcfile} >> set srcfile2 ${srcdir}/${subdir}/${srcfile2} >> -- >> 2.31.1