From patchwork Thu Oct 17 17:56:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinevere Larsen X-Patchwork-Id: 99097 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 BD0A5385843D for ; Thu, 17 Oct 2024 18:01:52 +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.129.124]) by sourceware.org (Postfix) with ESMTP id E3F823858D20 for ; Thu, 17 Oct 2024 18:01:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3F823858D20 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 E3F823858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729188090; cv=none; b=izkue/e4iLg+cT/J9GzvEBk237wL++qgmaLwsCqk4ZmqFJ6fzQPVvzALI9BgIJDkoUJKtQqaqB+K0NwxRBkC5PTujkP/GCPGJHoab2w10sFh7cYfLERjA5dOEwAxtWl+2+xD2OCBGNwOs6UZ3a7MFwc6pVWLblpIxxXheCFS1/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729188090; c=relaxed/simple; bh=HcCeztw1mEO0DGn4mGUwG5V/5uPv0hrsMaMIdrs3Iv4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AVDgd725ORkoHvW9K8N7myuIcEBqUwNMJ8DGR4LTV2Rfo795hctIawwMlFuoKBbFoxcszhGC0RrmEPSnRbQ/PyHIKJZiRKjM/Wl19i24kSfg7bQiCyIKW4ZbcaibYHtrb5qIaqHbxmJzzF5GeLmDb5kaoR6HT/H9/5jiLa1AGiA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729188087; 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=Z3qA97L7s5x0Z7ktKysYZ6GgxjuyfNKN7vJRJ8PzW5E=; b=WdJMdu6RoWg1bY283YOH/4JUQG4rUCmkxJZ0UAbPLS9x/tUexi90Cn8aTKHjHrM1vqttBV K6Gupgi23pi3iMyZpoAxEC+BKj4xs6b8Z2QObfZhCHY8D2ud5D7ENdw2uk9tyl2+0F1B3r DCWkBP+EMbCKq+0dnturIBS/gz5xbl4= Received: from mx-prod-mc-05.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-183-Yu6_BkQ5MVqUwWhp4M7Hxw-1; Thu, 17 Oct 2024 14:01:26 -0400 X-MC-Unique: Yu6_BkQ5MVqUwWhp4M7Hxw-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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 162071955F65 for ; Thu, 17 Oct 2024 18:01:25 +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 B9B1A1956086; Thu, 17 Oct 2024 18:01:23 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH v3 1/3] gdb/testsuite: fix XPASSes when testing with clang Date: Thu, 17 Oct 2024 14:56:20 -0300 Message-ID: <20241017175620.5876-4-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 Clang used to not add access specifiers for typedefs, and the tests gdb.cp/ptype-flags.exp and gdb.cp/classes.exp both set XFAILs if clang is being used to test. This was fixed on the clang 16.0.0 release, generating many XPASSes. This current commit checks the clang version used for testing, and only emits XFAIL on when a bad clang version is used. The testsuite didn't have a good way to check if an arbitrary compiler is newer than a given release, so this commit also adds a TCL proc to do just that. The new proc must receive the desired version as a list, then optionally the compiler and language. Reviewed-by: Keith Seitz --- gdb/testsuite/gdb.cp/classes.exp | 16 +++++++++------- gdb/testsuite/gdb.cp/ptype-flags.exp | 11 +++++------ gdb/testsuite/lib/gdb.exp | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp index 4d29bf5ab5c..98e1c44411a 100644 --- a/gdb/testsuite/gdb.cp/classes.exp +++ b/gdb/testsuite/gdb.cp/classes.exp @@ -25,9 +25,11 @@ load_lib "cp-support.exp" standard_testfile .cc set flags [list debug c++] -set clang_used false +set using_broken_clang false if { [test_compiler_info "clang-*" "c++"] } { - set clang_used true + if { [compiler_version_lower_than [list "16" "0" "0"] "clang" "c++"] } { + set using_broken_clang true + } if { [gcc_major_version "clang-*" "c++"] >= 11} { lappend flags additional_flags=-Wno-non-c-typedef-for-linkage } @@ -330,7 +332,7 @@ proc test_ptype_class_objects {} { # Clang does not add access information for typedefs in classes. # More information on: https://github.com/llvm/llvm-project/issues/57608 - if {$::clang_used} { + if {$::using_broken_clang} { setup_xfail "clang 57608" *-*-* } @@ -354,7 +356,7 @@ proc test_ptype_class_objects {} { { typedef private "typedef int private_int;" } } - if {$::clang_used} { + if {$::using_broken_clang} { setup_xfail "clang 57608" *-*-* } @@ -366,7 +368,7 @@ proc test_ptype_class_objects {} { { typedef public "typedef int INT;" } } - if {$::clang_used} { + if {$::using_broken_clang} { setup_xfail "clang 57608" *-*-* } @@ -378,7 +380,7 @@ proc test_ptype_class_objects {} { { typedef protected "typedef int INT;" } } - if {$::clang_used} { + if {$::using_broken_clang} { setup_xfail "clang 57608" *-*-* } @@ -390,7 +392,7 @@ proc test_ptype_class_objects {} { { typedef protected "typedef int INT;" } } - if {$::clang_used} { + if {$::using_broken_clang} { setup_xfail "clang 57608" *-*-* } diff --git a/gdb/testsuite/gdb.cp/ptype-flags.exp b/gdb/testsuite/gdb.cp/ptype-flags.exp index bb92da6122a..661a6355248 100644 --- a/gdb/testsuite/gdb.cp/ptype-flags.exp +++ b/gdb/testsuite/gdb.cp/ptype-flags.exp @@ -29,10 +29,9 @@ if {![runto_main]} { return } -if {[test_compiler_info {clang-*-*} c++]} { - set using_clang true -} else { - set using_clang false +set using_broken_clang false +if {[compiler_version_lower_than [list "16" "0" "0"] "clang" "c++"]} { + set using_broken_clang true } gdb_test_no_output "set language c++" "" @@ -40,7 +39,7 @@ gdb_test_no_output "set width 0" "" proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1} {raw 0}} { - global using_clang + global using_broken_clang set contents { { base "public Base" } @@ -57,7 +56,7 @@ proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1} if {$show_typedefs} { # Clang does not add accessibility information for typedefs: # https://github.com/llvm/llvm-project/issues/57608 - if {$using_clang} { + if {$using_broken_clang} { setup_xfail "clang 57608" *-*-* } lappend contents { typedef public "typedef Simple > Z;" } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f0a89394b87..0335956c64e 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5392,6 +5392,27 @@ proc gcc_major_version { {compiler "gcc-*"} {language "c"} } { return $major.$minor } +# Calculate if the compiler version is higer than VERSION. +# If the proc can't tell or the provided compiler is different +# to what is being used to run the tests, it returns false. +# VERSION must be a list like "$major $minor". + +proc compiler_version_lower_than { version {compiler "gcc"} \ + {language "c"} } { + global decimal + + set res [regexp $compiler-($decimal)-($decimal)-($decimal) \ + [test_compiler_info "" $language] dummy major minor point] + + # We either can't determine the compiler, or the compiler is + # different than provided + if { $res != 1} { + return false + } + + return [version_compare [list $major $minor $point] "<" $version] +} + proc current_target_name { } { global target_info if [info exists target_info(target,name)] { From patchwork Thu Oct 17 17:56:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guinevere Larsen X-Patchwork-Id: 99098 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 174043858404 for ; Thu, 17 Oct 2024 18:02:13 +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 12ECE3858431 for ; Thu, 17 Oct 2024 18:01:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12ECE3858431 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 12ECE3858431 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=1729188109; cv=none; b=Kn90FtHaoj7znY6Ab8f3Uv3cL88UHgTXZN5O22nu03GbzHQjqYXXsRV6vETJnrg8+0mwQiku0vT4kcO22tk29VdhDtoy9n63G/K+6w4W+g0nWyDTyARyO0PrfVIPzRn3sFyi2A3bs+KMhHqwmHzs3fZmqKv7oZs1MdjzmZfOwEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729188109; c=relaxed/simple; bh=Saa/iRTWNfticbnaBvnySoCUknAZT81qCH11Jq1kjgA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qbKVIZ4hvBWBefa1OqTfJ1/YayjK9hJJEkwOf0vhSvTS69uH/zUYX87LmHc8fYtHbedKy7jU1/So6fGPMEXP04s/beCqR+20g+xRXz3kZBji0dZp0mPCixz2r9+3Ob74BewfvnEoqmUw77B7GHq0THB6g7yAsyhX7YPS8ghxd0U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729188107; 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=tKhkxF0aXgdy4tGGM0aG+v/Hu14MbajtC1M2cPwUByM=; b=RngiXhHIycHqsiX7HzjhVDAHlBKZNPrhMqVDL1Coxl7lH8VjrO75Wd+aoUi3HbAYjg3jgQ trWaMnfF9jur7HIcxxLgT57Sxb1GPeYz0PkXkd36F9eBgJ6dPaheoqyCuSFo5XHLA0bBFD DPBnSyEPt5wcL509VlWPfRaJygUFbNE= Received: from mx-prod-mc-05.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-376-BmIWZ-EiMRe0XuF7KC-PmQ-1; Thu, 17 Oct 2024 14:01:46 -0400 X-MC-Unique: BmIWZ-EiMRe0XuF7KC-PmQ-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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C042F195608A for ; Thu, 17 Oct 2024 18:01:45 +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 435791956086; Thu, 17 Oct 2024 18:01:44 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH v3 2/3] gdb/testsuite: ask for DWARF5 in gdb.cp/pass-by-ref.exp Date: Thu, 17 Oct 2024 14:56:22 -0300 Message-ID: <20241017175620.5876-6-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 Some test from gdb.cp/pass-by-ref.exp rely on the attributes DW_AT_deleted and DW_AT_defaulted, which were only added in DWARF 5. However, it seems that GCC emits those attributes since version 7, no matter the requested DWARF version. Clang, on the other hand, only produces those attributes if it emits DWARF5, which is the default on newer clangs, and notably in the fedora version used by buildbot. Thhis patch updates the code setting up an XFAIL so that, instead of setting it up for all clangs used, it only does so if clang is NOT using dwarf 5. Reviewed-by: Keith Seitz --- gdb/testsuite/gdb.cp/pass-by-ref.exp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp index a1f1df4f3e7..503e67b34c8 100644 --- a/gdb/testsuite/gdb.cp/pass-by-ref.exp +++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp @@ -343,6 +343,9 @@ if {![runto_main]} { return -1 } +get_debug_format +set using_dwarf5 [test_debug_format "DWARF 5"] + set bp_location [gdb_get_line_number "stop here"] gdb_breakpoint $bp_location gdb_continue_to_breakpoint "end of main" ".*return .*;" @@ -412,7 +415,8 @@ proc test_for_class { prefix states cbvfun data_field length} { "destructor should be called" } } else { - if {$cctor == "deleted" && ($is_gcc_6_or_older || $is_clang)} { + if {$cctor == "deleted" + && ($is_gcc_6_or_older || ($is_clang && !$::using_dwarf5))} { setup_xfail "*-*-*" } gdb_test "print ${cbvfun}<$name> (${name}_var)" \ 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 }