Message ID | e79df44660fd3936e699d76f50607bfca6a65495.1668184173.git.aburgess@redhat.com |
---|---|
State | Committed |
Commit | 33c1395cf5e9deec7733691ba32c450e5c27f757 |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E38763842AC0 for <patchwork@sourceware.org>; Fri, 11 Nov 2022 16:37:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E38763842AC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668184629; bh=fZaYQI8YTBuJNIr8AogTwAfwQHiZIndCbIF7X3n/OZo=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=EeTJ8X2T1a6Scar4gJQ2LPg3uuvenV/zuQUBugr5MfTvPCd8NNXwG9NxosNlWCocs kryaSc82R//6T2ne02foPivyQ457dWQNOlRU7EMLpN8809QmGtC8O4LDKElduz31jf FNgZ+dufw8CwaqyT+kScp8msQuBw3a0CZJkugwvY= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 4DFE83858C27 for <gdb-patches@sourceware.org>; Fri, 11 Nov 2022 16:36:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4DFE83858C27 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-246-wdcURWxnOuioeqKoAdz6Xg-1; Fri, 11 Nov 2022 11:36:36 -0500 X-MC-Unique: wdcURWxnOuioeqKoAdz6Xg-1 Received: by mail-qk1-f197.google.com with SMTP id o13-20020a05620a2a0d00b006cf9085682dso5101282qkp.7 for <gdb-patches@sourceware.org>; Fri, 11 Nov 2022 08:36:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fZaYQI8YTBuJNIr8AogTwAfwQHiZIndCbIF7X3n/OZo=; b=Hn3J8Kfvqh7WHM7k4tIjfVKO3bCfzbJXnQHnrzUMGgPAD1TP1JiPkQh7LBo9+JNuYG vHtiRG0UJqtw9sARxgwiARTuXKkm9dPYXpLLpf4oyJOSf1foZ3FmHFNxC8VRpPSnefYl 5x2VGWv+c2/kisXyA4cDbig+onRUymsReZXS1CSNKCKQ5H5pVNXklfeUFMqc1dDTpRvf WivHNiEI+Q9JHxyUqhBZaSq4B2sL1Uw3vRGBWNAqtFfqpY/hXWNtts/W81i4bctB5qzY 30bloaBhd5K64JC50kOMTdFggdcu7icUQ/DyjKo2CIJWMYvGj3iXojBz4IRxlxD9Hf1Y eLig== X-Gm-Message-State: ANoB5plB1cOGkxPuwXG+sSHMJTcNNI93SywQJSOPR8yKGHAIQICHD+Bb mrQv2QZoYf++VTK4UuxinrLsbbEwrrCEPZ91xuV/o2xzZ2j2TuRvHDdPL0YP9VtgUqf7Nc+jeyB TQAV7EZeXOs9ciKuijidCYC+0kr0f8uLymFygJeYtXnijM9v19PC6LExWG7TyliJ9YM1aSgPmuw == X-Received: by 2002:a05:620a:c09:b0:6ce:3f1c:a4ef with SMTP id l9-20020a05620a0c0900b006ce3f1ca4efmr1768366qki.507.1668184595361; Fri, 11 Nov 2022 08:36:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5glZgb0YwcYXPlErnimQ/mFcJUgIqaVT+LfKTFRtLklNMJYfH62t7/Z/sPZNpvwxqhnYrmoA== X-Received: by 2002:a05:620a:c09:b0:6ce:3f1c:a4ef with SMTP id l9-20020a05620a0c0900b006ce3f1ca4efmr1768342qki.507.1668184595018; Fri, 11 Nov 2022 08:36:35 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id f17-20020ac859d1000000b0039467aadeb8sm1515841qtf.13.2022.11.11.08.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 08:36:34 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com> Subject: [PATCH 2/6] gdb/testsuite: fix gdb.trace/unavailable-dwarf-piece.exp with Clang Date: Fri, 11 Nov 2022 16:36:21 +0000 Message-Id: <e79df44660fd3936e699d76f50607bfca6a65495.1668184173.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <cover.1668184173.git.aburgess@redhat.com> References: <cover.1668184173.git.aburgess@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Andrew Burgess <aburgess@redhat.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
The DWARF assembler and Clang
|
|
Commit Message
Andrew Burgess
Nov. 11, 2022, 4:36 p.m. UTC
I noticed that the test gdb.trace/unavailable-dwarf-piece.exp was failing when run with Clang. Or rather, the test was not running as the test executable failed to compile. The problem is that Clang was emitting this warning: warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument] This warning is emitted when compiling the assembler file generated by the DWARF assembler. Most DWARF assembler tests generate the assembler file into a file with the '.S' extension. However, this particular test uses a '.s' extension. Now a .S file will be passed through the preprocessor, while a .s will be sent straight to the assembler. My guess is that Clang doesn't support the -fdiagnostics-color=never option for the assembler, but does for the preprocessor. That's a little annoying, but easily worked around. We don't care if our assembler file is passed through the preprocessor, so, in this commit, I just change the file extension from .s to .S, and the problem is fixed. Currently, the unavailable-dwarf-piece.exp script names the assembler file using standard_output_file, in this commit I've switched to make use of standard_testfile, as that seems to be the more common way of doing this sort of thing. With these changes the test now passes with Clang 9.0.1 and 15.0.2, and also still passes with gcc. --- gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 11/11/2022 17:36, Andrew Burgess via Gdb-patches wrote: > I noticed that the test gdb.trace/unavailable-dwarf-piece.exp was > failing when run with Clang. Or rather, the test was not running as > the test executable failed to compile. > > The problem is that Clang was emitting this warning: > > warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument] > > This warning is emitted when compiling the assembler file generated > by the DWARF assembler. > > Most DWARF assembler tests generate the assembler file into a file > with the '.S' extension. However, this particular test uses a '.s' > extension. > > Now a .S file will be passed through the preprocessor, while a .s will > be sent straight to the assembler. My guess is that Clang doesn't > support the -fdiagnostics-color=never option for the assembler, but > does for the preprocessor. > > That's a little annoying, but easily worked around. We don't care if > our assembler file is passed through the preprocessor, so, in this > commit, I just change the file extension from .s to .S, and the > problem is fixed. > > Currently, the unavailable-dwarf-piece.exp script names the assembler > file using standard_output_file, in this commit I've switched to make > use of standard_testfile, as that seems to be the more common way of > doing this sort of thing. > > With these changes the test now passes with Clang 9.0.1 and 15.0.2, > and also still passes with gcc. > --- > gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp > index f80f8005fcf..13c6f38737c 100644 > --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp > +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp > @@ -20,9 +20,9 @@ if {![dwarf2_support]} { > return 0 > } > > -standard_testfile .c > +standard_testfile .c -dbg.S > > -set asm_file [standard_output_file "${testfile}-dbg.s"] > +set asm_file $srcfile2 > set opts {} > > if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ I tried running this test with these changes using clang 14.0.5 and clang 16.0.0, and both times I got the following output: builtin_spawn -ignore SIGHUP clang-14 -fdiagnostics-color=never -Wno-unknown-warning-option -w -c -g -o /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_target-1163842.o /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_target-1163842.c /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_target-1163842.c:2:12: error: 'dummy' declared as an array with a negative size int dummy[sizeof (int) == 4 ^~~~~~~~~~~~~~~~~ 1 error generated. And I get an "unsupported" test. The error message says that the target doesn't support trace, but I'm not sure if it isn't related to the compilation failure. Do you see anything similar?
Bruno Larsen <blarsen@redhat.com> writes: > On 11/11/2022 17:36, Andrew Burgess via Gdb-patches wrote: >> I noticed that the test gdb.trace/unavailable-dwarf-piece.exp was >> failing when run with Clang. Or rather, the test was not running as >> the test executable failed to compile. >> >> The problem is that Clang was emitting this warning: >> >> warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument] >> >> This warning is emitted when compiling the assembler file generated >> by the DWARF assembler. >> >> Most DWARF assembler tests generate the assembler file into a file >> with the '.S' extension. However, this particular test uses a '.s' >> extension. >> >> Now a .S file will be passed through the preprocessor, while a .s will >> be sent straight to the assembler. My guess is that Clang doesn't >> support the -fdiagnostics-color=never option for the assembler, but >> does for the preprocessor. >> >> That's a little annoying, but easily worked around. We don't care if >> our assembler file is passed through the preprocessor, so, in this >> commit, I just change the file extension from .s to .S, and the >> problem is fixed. >> >> Currently, the unavailable-dwarf-piece.exp script names the assembler >> file using standard_output_file, in this commit I've switched to make >> use of standard_testfile, as that seems to be the more common way of >> doing this sort of thing. >> >> With these changes the test now passes with Clang 9.0.1 and 15.0.2, >> and also still passes with gcc. >> --- >> gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp >> index f80f8005fcf..13c6f38737c 100644 >> --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp >> +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp >> @@ -20,9 +20,9 @@ if {![dwarf2_support]} { >> return 0 >> } >> >> -standard_testfile .c >> +standard_testfile .c -dbg.S >> >> -set asm_file [standard_output_file "${testfile}-dbg.s"] >> +set asm_file $srcfile2 >> set opts {} >> >> if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ > > I tried running this test with these changes using clang 14.0.5 and > clang 16.0.0, and both times I got the following output: > > builtin_spawn -ignore SIGHUP clang-14 -fdiagnostics-color=never > -Wno-unknown-warning-option -w -c -g -o > /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_target-1163842.o > /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_target-1163842.c > /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_target-1163842.c:2:12: > error: 'dummy' declared as an array with a negative size > int dummy[sizeof (int) == 4 > ^~~~~~~~~~~~~~~~~ > 1 error generated. That error is part of the is_ilp32_target proc, and is a result of this C source code: int dummy[sizeof (int) == 4 && sizeof (void *) == 4 && sizeof (long) == 4 ? 1 : -1]; So on a non ilp32 target (e.g. x86-64) the array length will be -1, and the code, by design, will fail to compile. We use the failure to compile as an indication that the target is non-ilp32. > And I get an "unsupported" test. The error message says that the target > doesn't support trace, but I'm not sure if it isn't related to the > compilation failure. Do you see anything similar? The unsupported is not related to the error described above. I also see the "unsupported". But the critical thing is that previously, when compiling with Clang I didn't get to the unsupported, I instead saw a failure to compile the test program (error in the original commit message). With this fix the Clang program now compiles. There is a small chance that for [reasons] the test might fail on a target that does support tracing when compiled with Clang. But I'm going to leave that for others to figure out. Any fix for that problem would be a completely unrelated fix to the one I'm proposing here anyway, so it would always be a separate patch. Thanks, Andrew
>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
Andrew> Currently, the unavailable-dwarf-piece.exp script names the assembler
Andrew> file using standard_output_file, in this commit I've switched to make
Andrew> use of standard_testfile, as that seems to be the more common way of
Andrew> doing this sort of thing.
I think this caused the .S file to be created outside of the test's
directory. Using standard_output_file would fix this. I think it's
more normal to do this as well; searching for "set asm_file" yields a
lot of hits of the form:
set asm_file [standard_output_file $srcfile2]
So if this change isn't needed to make the test work with clang, I'd
suggest reverting this part.
Tom
Tom Tromey <tom@tromey.com> writes: >>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes: > > Andrew> Currently, the unavailable-dwarf-piece.exp script names the assembler > Andrew> file using standard_output_file, in this commit I've switched to make > Andrew> use of standard_testfile, as that seems to be the more common way of > Andrew> doing this sort of thing. > > I think this caused the .S file to be created outside of the test's > directory. Using standard_output_file would fix this. I think it's > more normal to do this as well; searching for "set asm_file" yields a > lot of hits of the form: > > set asm_file [standard_output_file $srcfile2] > > So if this change isn't needed to make the test work with clang, I'd > suggest reverting this part. Sorry for this. I pushed the patch below to fix this issue. Thanks, Andrew --- commit dc3fb44540b586c02ec2f841e106a8d2cc2a422d Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Dec 13 15:37:17 2022 +0000 gdb/testsuite: avoid creating temp file in gdb/testsuite/ directory After this commit: commit 33c1395cf5e9deec7733691ba32c450e5c27f757 Date: Fri Nov 11 15:26:46 2022 +0000 gdb/testsuite: fix gdb.trace/unavailable-dwarf-piece.exp with Clang The gdb.trace/unavailable-dwarf-piece.exp test script was creating a temporary file in the build/gdb/testsuite/ directory, instead of in the expected place in the outputs directory. Fix this by adding a call to standard_output_file. diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp index 13c6f38737c..d73b9f1e33f 100644 --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp @@ -22,7 +22,7 @@ if {![dwarf2_support]} { standard_testfile .c -dbg.S -set asm_file $srcfile2 +set asm_file [standard_output_file $srcfile2] set opts {} if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp index f80f8005fcf..13c6f38737c 100644 --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp @@ -20,9 +20,9 @@ if {![dwarf2_support]} { return 0 } -standard_testfile .c +standard_testfile .c -dbg.S -set asm_file [standard_output_file "${testfile}-dbg.s"] +set asm_file $srcfile2 set opts {} if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \