From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MBxdLq4jH2MDZTgAWB0awg (envelope-from ) for ; Mon, 12 Sep 2022 08:18:54 -0400 Received: by simark.ca (Postfix, from userid 112) id BB5851E110; Mon, 12 Sep 2022 08:18:54 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=EsdY9u8w; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 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 5E2701E0D3 for ; Mon, 12 Sep 2022 08:18:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B336D3851A8A for ; Mon, 12 Sep 2022 12:18:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B336D3851A8A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1662985133; bh=P6csWgiGi2KPK4A7LoRfNUOjNyC6TZBXfM11lGASXhg=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=EsdY9u8wH/irLED7UgQn0kxrCfeygmuiLM+4UGhl6dJ3YRnXw3YoOFxU0TO9OfLGf OgtlsiQccQWzkx9qZd73bx1KdU+a+KbM6tfsZv4fPV3qqwYPtViCck1mrPrinXIkty 1RtdA7/XWeBiMv+oAhgcViZ2+pke7G9P9VTQUGGY= 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 100483856960 for ; Mon, 12 Sep 2022 12:18:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 100483856960 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-663-uv4MHnUJPLe2Lo2U-WXXvA-1; Mon, 12 Sep 2022 08:18:05 -0400 X-MC-Unique: uv4MHnUJPLe2Lo2U-WXXvA-1 Received: by mail-wm1-f72.google.com with SMTP id p9-20020a05600c23c900b003b48dc0cef1so903891wmb.1 for ; Mon, 12 Sep 2022 05:18:05 -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:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=P6csWgiGi2KPK4A7LoRfNUOjNyC6TZBXfM11lGASXhg=; b=viP2lpy2GkF4CB0RATGETEx7th6ggK/8uT68EbkI/qVgSCu5YpDkd9/yyAyktTKhen QoZk5pnpBYkpb0SAJg3iFRiEWD9MlEcCZ7697E8cpk3dufPrC3zI8M7tliSeJiswRqp5 A6U45vhnhTc2/qQZSxGEWW/8TwDwoNDbj90CknvvTkHqIxmMwae4YHyNOlGBwg4CVzqx YMhpbg/QeOJjwMB1EZvkjT37PNLN/qCPJEwLCZzurlmsvsKlEwcpybsDYrTRW5Xn5aBI fvSr8KvTV91ZpHEJ3bYF66MsEC86cOylB3NrAIyCbG6VjPFNxNet5g9DuoWt2nAT+hC9 G21Q== X-Gm-Message-State: ACgBeo3OWYPWBSBJ+YOzgwufexgpJuXuNhFO1eJRJdSgvjQrnoyT5MLm CfjbNmb+ImxScYSHcZQAjh1x+5OZGlBXMGfGswuh2Sx+PysL7hhE+nMkz0EEqmMhmMUjzw3J0RR KFrhnihomHqP1ryZqEff+/w== X-Received: by 2002:a5d:4284:0:b0:22a:291e:fa8f with SMTP id k4-20020a5d4284000000b0022a291efa8fmr13334346wrq.553.1662985084450; Mon, 12 Sep 2022 05:18:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR47rFIJC/FS730VnBd0AElPNtyUTaYd4ZiV57WN8F/ZRSpYR0ipZWubfKHGeAwQbMcM8hFimA== X-Received: by 2002:a5d:4284:0:b0:22a:291e:fa8f with SMTP id k4-20020a5d4284000000b0022a291efa8fmr13334333wrq.553.1662985084201; Mon, 12 Sep 2022 05:18:04 -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 w1-20020a5d6081000000b0022a2dbc80fdsm7422471wrt.10.2022.09.12.05.18.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Sep 2022 05:18:03 -0700 (PDT) Message-ID: <2270bf07-cbee-dfba-91ca-47f79e47b85d@redhat.com> Date: Mon, 12 Sep 2022 14:18:03 +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 07/15] Fix gdb.base/call-ar-st to work with Clang To: Andrew Burgess , gdb-patches@sourceware.org References: <20220720194441.168906-1-blarsen@redhat.com> <20220720194441.168906-9-blarsen@redhat.com> <87mtb4lwb7.fsf@redhat.com> In-Reply-To: <87mtb4lwb7.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-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: , From: Bruno Larsen via Gdb-patches Reply-To: Bruno Larsen Cc: Pedro Alves Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" thanks, pushed! Cheers, Bruno On 12/09/2022 12:30, Andrew Burgess wrote: > Bruno Larsen via Gdb-patches writes: > >> When running gdb.base/call-ar-st.exp against Clang, we see one FAIL, >> like so: >> >> print_all_arrays (array_i=, array_c= "ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa >> ZaZaZaZaZaZaZaZaZaZaZaZa", array_f=, array_d=) at ../../../src/gdb/testsuite/gdb.base/call-ar-st.c:274 >> 274 print_int_array(array_i); /* -step1- */ >> (gdb) FAIL: gdb.base/call-ar-st.exp: step inside print_all_arrays >> >> With GCC we instead see: >> >> print_all_arrays (array_i=, array_c= "ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa", array_f=, array_d=) at /home/pedro/gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.base/call-ar-st.c:274 >> 274 print_int_array(array_i); /* -step1- */ >> (gdb) PASS: gdb.base/call-ar-st.exp: step inside print_all_arrays >> >> The difference is that with Clang we get: >> >> array_i=, ... >> >> instead of >> >> array_i = , ... >> >> These symbols are local static variables, and "main" is the name of >> the function they are defined in. GCC instead appends a sequence >> number to the linkage name: >> >> $ nm -A call-ar-st.gcc | grep integer_ >> call-ar-st/call-ar-st:00000000000061a0 b integer_array.3968 >> >> $ nm -A call-ar-st.clang | grep integer_ >> call-ar-st:00000000004061a0 b main.integer_array >> >> This commit changes the testcase to accept both outputs, as they are >> functionally identical. >> >> Co-Authored-By: Pedro Alves >> Change-Id: Iaf2ccdb9d5996e0268ed12f595a6e04b368bfcb4 > LGTM. I think this could be merged. > > Thanks, > Andrew > > >> --- >> gdb/testsuite/gdb.base/call-ar-st.exp | 13 ++++++++++++- >> 1 file changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp >> index 7c80ec7c0b8..2da438ccd96 100644 >> --- a/gdb/testsuite/gdb.base/call-ar-st.exp >> +++ b/gdb/testsuite/gdb.base/call-ar-st.exp >> @@ -147,10 +147,21 @@ if {!$skip_float_test && \ >> gdb_test "continue" ".*" "" >> } >> >> +# Return a regexp that matches the linkage name of SYM, assuming SYM >> +# is a local static variable inside the main function. >> +proc main_static_local_re {sym} { >> + # Clang prepends the function name + '.'. >> + return "(main\\.)?${sym}" >> +} >> + >> #step >> set stop_line [gdb_get_line_number "-step1-"] >> gdb_test "step" \ >> - "print_all_arrays \\(array_i=, array_c= .ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*$srcfile:$stop_line\[ \t\r\n\]+$stop_line.*print_int_array\\(array_i\\);.*" \ >> + "print_all_arrays \\(array_i=<[main_static_local_re integer_array]>,\ >> + array_c=<[main_static_local_re char_array]> .ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa.,\ >> + array_f=<[main_static_local_re float_array]>,\ >> + array_d=<[main_static_local_re double_array]>\\)\ >> + at .*$srcfile:$stop_line\[ \t\r\n\]+$stop_line.*print_int_array\\(array_i\\);.*" \ >> "step inside print_all_arrays" >> >> #step -over >> -- >> 2.31.1