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 4CFC03895FEA for ; Thu, 17 Nov 2022 11:06:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4CFC03895FEA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668683184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QZSYahXktd+H6mk47JVA7eUnJHlp1/7kWOM+pJlYJjU=; b=c6ujmESxDg1nma4iMdAqdYpnXPHgKjpcRq9V5goIr/5xbSfK92DaeD32Ohc0OF/pLZs/vb dpbF9+hXYG8lwbNlp6lp1mbBYxQiVf7jr1Uc1TRyec+MzH7eXbVsp2oToP2xDvpY1yiG4i VrWVbO9HV5mEcrhzxmPM5EgrXiiZyMA= 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-323-2zCuxsfGNFq7MV2IsguUcw-1; Thu, 17 Nov 2022 06:06:23 -0500 X-MC-Unique: 2zCuxsfGNFq7MV2IsguUcw-1 Received: by mail-wm1-f72.google.com with SMTP id c187-20020a1c35c4000000b003cfee3c91cdso480483wma.6 for ; Thu, 17 Nov 2022 03:06:23 -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:message-id:date:references :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=ijuIuw75yn0AwbGXyL+GMij5kxzfI3+b1jYUVo/Tmgw=; b=sR+OrrwRIFgi0JD5hXU359FUgzINbJmpYC46AuCXCaCJqwnhWIzh/039u3L/kdkx0j naqS69s8JDe3ovOR2cbUwOPUjuGjX/E5l9xOwgds0u5OiYCUMGfmaWWWKSO6+m21xVB3 JTdfjJWpvhr0ufPCmdVKM2zbR0mONvDHtRlzEImjPJx1nk7rHs+ETq2saefg/qynFB9Z 6YchgpSFW0tX5R2h8Ce3iYRDBnn41zpSG4/FV7uk7Fqzhq1pl59jUTfvs+bjDzTpSiT2 YsR9MwtiEaPdZpP+3MKFM7r7ryu/tqOYlm+owuGeXCV+y8CZuoCdf9AIAbkPfyCZLWvg 0lrA== X-Gm-Message-State: ANoB5pmfHmD+PdaAZ5J8YfOw9BzHT3KTPRQjVPMDGRVI6HpDiEnGTS54 euhgetbQCLJEri9/LcnB+X/LbcHxQrSCiEMTLoWHrZlcyH7JSpsJ5vuwMQINCjtVow4RYyYTz4T BZiuXylsKh8uuhzIYyD2Izw== X-Received: by 2002:a05:600c:21c6:b0:3c7:19a6:8146 with SMTP id x6-20020a05600c21c600b003c719a68146mr1350469wmj.158.1668683182376; Thu, 17 Nov 2022 03:06:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4H7xSFk9sEFzGAGcQe/YdmTxuhlvG+xsOlRWLsadcqHjCjt70GruigsFlZhinWuNuwllm+/Q== X-Received: by 2002:a05:600c:21c6:b0:3c7:19a6:8146 with SMTP id x6-20020a05600c21c600b003c719a68146mr1350451wmj.158.1668683182168; Thu, 17 Nov 2022 03:06:22 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id r13-20020a05600c458d00b003c7087f6c9asm5528643wmo.32.2022.11.17.03.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 03:06:21 -0800 (PST) From: Andrew Burgess To: Bruno Larsen , gdb-patches@sourceware.org Subject: Re: [PATCH 2/6] gdb/testsuite: fix gdb.trace/unavailable-dwarf-piece.exp with Clang In-Reply-To: <00ef5863-fcb6-9a56-2c80-b6a726904a30@redhat.com> References: <00ef5863-fcb6-9a56-2c80-b6a726904a30@redhat.com> Date: Thu, 17 Nov 2022 11:06:20 +0000 Message-ID: <87tu2x96xf.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.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,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 List-Id: Bruno Larsen 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=3Dn= ever' [-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=3Dnever 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/t= estsuite/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 >> } >> =20 >> -standard_testfile .c >> +standard_testfile .c -dbg.S >> =20 >> -set asm_file [standard_output_file "${testfile}-dbg.s"] >> +set asm_file $srcfile2 >> set opts {} >> =20 >> if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ > > I tried running this test with these changes using clang 14.0.5 and=20 > clang 16.0.0, and both times I got the following output: > > builtin_spawn -ignore SIGHUP clang-14 -fdiagnostics-color=3Dnever=20 > -Wno-unknown-warning-option -w -c -g -o=20 > /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_tar= get-1163842.o=20 > /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_tar= get-1163842.c > /home/blarsen/Documents/fsf_build/gdb/testsuite/temp/1163842/is_ilp32_tar= get-1163842.c:2:12:=20 > error: 'dummy' declared as an array with a negative size > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int dummy[sizeof (int) =3D=3D= 4 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~~~~~~~~~~~~~~~~ > 1 error generated. That error is part of the is_ilp32_target proc, and is a result of this C source code: =09int dummy[sizeof (int) =3D=3D 4 =09=09 && sizeof (void *) =3D=3D 4 =09=09 && sizeof (long) =3D=3D 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= =20 > doesn't support trace, but I'm not sure if it isn't related to the=20 > 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