From patchwork Thu Oct 17 17:56:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinevere Larsen X-Patchwork-Id: 99099 Return-Path: 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 A614C3858429 for ; Thu, 17 Oct 2024 18:02:28 +0000 (GMT) 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 ESMTP id 55D2F385840A for ; Thu, 17 Oct 2024 18:02:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55D2F385840A 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 55D2F385840A 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=1729188126; cv=none; b=Be46HVtZhtGv/AtmjgrIn5zPNKHO/ZrAOZSaudpQBKe45zO+TV1bagjtCY1l9UKasGtcLAOT99Zqf8SQYsLQhzcD+Q2jEQJc7DuUg3wFudj7ZIQDYXm6U52VGbA2ChhInHXMj/sPwGXCsu6ErQ9M/W+DnydpqNzT1qzvlFY0bTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729188126; c=relaxed/simple; bh=YbO4tT+hufzJ9Y3EmAaQNvoQrab7luYnn0PMxXLCtSA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=atyqXAR3e7SfKSDgetwdmaCHU1gsGGKL8PVII9roPM+kJ/2x/cS5MJYwPZ13GZlPv6dcAmHSrTfRO9jZ2Rm6whF3UOowfE+e24ozevXGRats/eYihO4Z/GmLLMPnJmhTPlXEWb/QnXmtZwI0NfkJ+jdeEyFVl1rzsj3tpT4Tb7Q= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729188122; 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=wE0zaR2JQx8l8TA16QLefM53cEqkacLUkDw69qCrsfM=; b=aKXIIMX22Z6gGNY12wfg1WLdEP0z4J9yK2Ijlv9G88yZphnEfhSWBYcNdFNNUDDxfUkRME XX7yojCZKWZMbPp1sC2+dsjCl7MLJvd0KF9uDk6GVsezmHYunNBQQK8S8qpZ8jrhjt4P6M WEU9J/wT48zoRkylDqSAzjIXItwfgsw= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-526-BOPz1JNQOy2KgL4Lxm6KXA-1; Thu, 17 Oct 2024 14:02:00 -0400 X-MC-Unique: BOPz1JNQOy2KgL4Lxm6KXA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EB8BA19560B7 for ; Thu, 17 Oct 2024 18:01:59 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.67]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 898D51956086; Thu, 17 Oct 2024 18:01:58 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen , Keith Seitz Subject: [PATCH v3 3/3] gdb/testsuite: introduce dwarf5 option to gdb_compile Date: Thu, 17 Oct 2024 14:56:24 -0300 Message-ID: <20241017175620.5876-8-guinevere@redhat.com> In-Reply-To: <20241017175620.5876-2-guinevere@redhat.com> References: <20241017175620.5876-2-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-9.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_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org 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. Reviewed-by: Keith Seitz --- 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 0335956c64e..cedb59ca5f6 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5654,6 +5654,7 @@ proc quote_for_host { args } { # - no-build-id: Ensure the final binary does not include 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: @@ -5914,6 +5915,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 }