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.133.124]) by sourceware.org (Postfix) with ESMTPS id 600FE384AB5D for ; Thu, 2 May 2024 18:26:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 600FE384AB5D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 600FE384AB5D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714674382; cv=none; b=jqjO7Dk/2dby3mnfRaBZiAhLcKNz7Hm8SHjUgHHa/oGnC9nGL8El88XLOeMExPBAlrSiWcGJCOD2k9b4yToM3OtaDTzy5nxrX1KAm9lLWCKr4cIsUYvcHXnnILmxPawj3Q9PZMyFbjoigKjicXSfD7aExdBrK2vjD3lfcKiAev0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714674382; c=relaxed/simple; bh=AMf5EUyTZgx5crP9qq/PkL4VPPGMmTMqU17WFm/LwaA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YKePiubD5ohZ5DMJnRskB4433TWVC/RsbSnaqGMQulnIu1LP2locUa/r0iKaLgTA01kO3/Q5xu3gKj8lg+F/8EL/4BfpLVnr/dM7g3WW2r8TC0645gwL65xVz+9ojlrEXrmtaqY9SbcczmLhXBXpwW0i/EDOURE09D746Biydio= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714674380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zhnei9Go42Fmrj8Kduou0CwRHVIA5rIO4pMZSBh/Iig=; b=DecevZ7V278pY0FWA+lTJNodY3UEQRtmpCzPynaOAXCbyu2/sbdHLdoKV4NC3fAAUIpwW/ lGlusNVjYDaqPf0Cp4HQWNOn3m/QIQo5SexF2luVLCoYUVIxMaKmfPAttbRT+6uBuuhi3X 89tLwL5hhmlaV0KitY62fU/Fbc12mLI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-Phkmsb2cMp23K-nkaVpTyw-1; Thu, 02 May 2024 14:26:18 -0400 X-MC-Unique: Phkmsb2cMp23K-nkaVpTyw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 543BF803E4B for ; Thu, 2 May 2024 18:26:18 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.128]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93B31492BC7; Thu, 2 May 2024 18:26:17 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH 3/3] gdb/testsuite: introduce dwarf5 option to gdb_compile Date: Thu, 2 May 2024 15:25:49 -0300 Message-ID: <20240502182549.1607075-4-blarsen@redhat.com> In-Reply-To: <20240502182549.1607075-1-blarsen@redhat.com> References: <20240502182549.1607075-1-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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=-12.2 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_H4,RCVD_IN_MSPIKE_WL,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: A few tests on the testsuite require dwarf5 to work. Up until now, the way to do this was to explicitly add the command line flag -gdwarf-5. This isn't very portable, in case a compiler requires a different flag to emit dwarf5. This commit adds a new option to gdb_compile that would be able to add the correct flag (if known) or error out in case we are unable to tell which flag to use. It also changes the existing tests to use this general option instead of hard coding -gdwarf-5. --- gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp | 2 +- gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp | 3 +-- gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp | 2 +- gdb/testsuite/gdb.fortran/assumedrank.exp | 2 +- gdb/testsuite/lib/gdb.exp | 8 ++++++++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp index 344c4abe456..5078d0c2b9a 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp @@ -19,7 +19,7 @@ set opts {} if [info exists COMPILE] { # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1" standard_testfile .c .c - lappend opts optimize=-O2 additional_flags=-gdwarf-5 + lappend opts optimize=-O2 dwarf5 } else { require is_x86_64_m64_target } diff --git a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp index a6a99e86858..a7ca334869f 100644 --- a/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp +++ b/gdb/testsuite/gdb.dwarf2/dw5-rnglist-test.exp @@ -24,8 +24,7 @@ standard_testfile .cc # we let that be the test of whether the target supports it. if { [prepare_for_testing "failed to prepare" "${testfile}" \ - $srcfile {debug c++ additional_flags=-gdwarf-5 \ - additional_flags=-O0}] } { + $srcfile {debug c++ dwarf5 additional_flags=-O0}] } { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp index 540e770a3bf..b97b55468e4 100644 --- a/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp +++ b/gdb/testsuite/gdb.dwarf2/gdb-index-types-dwarf5.exp @@ -17,7 +17,7 @@ standard_testfile set flags {} lappend flags {additional_flags=-fdebug-types-section} -lappend flags {additional_flags=-gdwarf-5} +lappend flags {dwarf5} if { [prepare_for_testing "failed to prepare" ${testfile} \ $srcfile $flags] } { diff --git a/gdb/testsuite/gdb.fortran/assumedrank.exp b/gdb/testsuite/gdb.fortran/assumedrank.exp index 957dfefc7c7..32fd9d29ca7 100644 --- a/gdb/testsuite/gdb.fortran/assumedrank.exp +++ b/gdb/testsuite/gdb.fortran/assumedrank.exp @@ -28,7 +28,7 @@ if { [test_compiler_info {gfortran-*} f90] && } if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ - {debug f90 additional_flags=-gdwarf-5}]} { + {debug f90 dwarf5}]} { return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 67d5aef9343..b310d125626 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5256,6 +5256,7 @@ proc quote_for_host { args } { # - build-id: Ensure the final binary includes a build-id. # - column-info/no-column-info: Enable/Disable generation of column table # information. +# - dwarf5: Force compilation with dwarf-5 debug information. # # And here are some of the not too obscure options understood by DejaGnu that # influence the compilation: @@ -5497,6 +5498,13 @@ proc gdb_compile {source dest type options} { error "Option gno-column-info not supported by compiler." } + } elseif { $opt == "dwarf5" } { + if {[test_compiler_info {gcc-*}] \ + || [test_compiler_info {clang-*}]} { + lappend new_options "additional_flags=-gdwarf-5" + } else { + error "No idea how to force DWARF-5 in this compiler" + } } else { lappend new_options $opt } -- 2.44.0