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 58D02385702A for ; Mon, 12 Sep 2022 10:30:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 58D02385702A Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-341-Pf6ccfXYOPyZWxp9iRKsrA-1; Mon, 12 Sep 2022 06:30:07 -0400 X-MC-Unique: Pf6ccfXYOPyZWxp9iRKsrA-1 Received: by mail-wr1-f70.google.com with SMTP id q17-20020adfab11000000b0022a44f0c5d9so1178278wrc.2 for ; Mon, 12 Sep 2022 03:30:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=t0dhIyaBal82JZKlw/tQP7Zu1W+7jxghDxUSe94Yb8Y=; b=rkz5DOS30Xc3qhwT4+F0aTYRsIXj5P8ti6ZKVTLHsdzfCJhwwz9fExadrWO1qNa+8G lZ2jECdeQEoiWg4gUxsUa/8tXQGYBzEQ5RF7JBwQ6yM0FCrrkYLameRdXioBK8sZGvzR pPfvhCUB+hnKVKAlb45Kwb9ImuY6p7hGFWg6keDLN+YY/m0NByX/Y8PYMYoTQN6fEM36 s0vhqCQUKuiOv8VwOMQFd0z6IsdTPySNs/+cqFihTkDFrxJcb6cHgSQaMhCKhcv0qrBe uhkVzjTE2jj1K2kV1+WqNVMmyrBXGR4bJKz6w+jLKZqEUrvrwI+2J3Hvng+1fcWOviO/ ezxg== X-Gm-Message-State: ACgBeo34WIwD3VmGWoGoWqbvg4M2ED6ST/c/0MUPRjP7OrzOh3/luAR7 OZ3k3Nsoo7WLlZ3jSBhye95fYdtFS9VrhGcL2DvEf+iytR2yGGU6KoBtzNQyNK5+52EQm4OD8Up 4hWdkuatwO/T8KdpnPvQwyw== X-Received: by 2002:a05:600c:1992:b0:3a6:23f6:8417 with SMTP id t18-20020a05600c199200b003a623f68417mr12785199wmq.14.1662978606501; Mon, 12 Sep 2022 03:30:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR5sgIcWn/E4UbS6XAMqrcPX6IjMdr3WSqeNIUWzh7P2rRzxjXRyaWPcZfj9BpJADp2n49PDiw== X-Received: by 2002:a05:600c:1992:b0:3a6:23f6:8417 with SMTP id t18-20020a05600c199200b003a623f68417mr12785175wmq.14.1662978606245; Mon, 12 Sep 2022 03:30:06 -0700 (PDT) Received: from localhost (52.72.115.87.dyn.plus.net. [87.115.72.52]) by smtp.gmail.com with ESMTPSA id bk12-20020a0560001d8c00b0022762b0e2a2sm7144342wrb.6.2022.09.12.03.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 03:30:05 -0700 (PDT) From: Andrew Burgess To: Bruno Larsen , gdb-patches@sourceware.org Cc: Pedro Alves Subject: Re: [PATCH v4 07/15] Fix gdb.base/call-ar-st to work with Clang In-Reply-To: <20220720194441.168906-9-blarsen@redhat.com> References: <20220720194441.168906-1-blarsen@redhat.com> <20220720194441.168906-9-blarsen@redhat.com> Date: Mon, 12 Sep 2022 11:30:04 +0100 Message-ID: <87mtb4lwb7.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 10:30:11 -0000 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