From patchwork Wed May 24 16:36:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 69967 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 0A13238708C6 for ; Wed, 24 May 2023 16:38:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A13238708C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684946304; bh=wmrvQoz/meROnEs2GDDjC8jTnokOUlTQCTozAkSj7CM=; h=Date:Subject:References:In-Reply-To:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=BOPqanpy38St7P9odZqJe1HyxH/u1BGUIzEB/EGH0muQcZCPxFnhWa8nOxqRRKH0J 5G2l3CsEFc0i3Q5Q4NeQfVC+jFSIOw9pWFJ1oeiIFgtnGvhczF+9wkhZbzFhD4ixzO x1NxJn2h3CSUan5WE+oXS+CnQK2MCnHz5ZQ6Im8o= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by sourceware.org (Postfix) with ESMTPS id 5BF163858C5E for ; Wed, 24 May 2023 16:37:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BF163858C5E Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-76c64da0e46so36172639f.0 for ; Wed, 24 May 2023 09:37:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684946245; x=1687538245; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wmrvQoz/meROnEs2GDDjC8jTnokOUlTQCTozAkSj7CM=; b=NVEgOSkTm74TnW/8gbzGPNXPpyDcucLidhKnKIWfx39WU7lESH/jp/tpOEDDMpo0Lf 2FP6Bu2fi2t/OsM1GeYiNaDs12j70fYh/1IW7c7W5QiCPFxUwuB7SBBHERBBkLb5/qjy PCNGwvBC6zQgFPoJGDDKqFv8iPmNaVj9YwOSrdOI4ldd7LdUh7swn2ESND6eDeb4plwD DvieIMI+wxDf2qCSMlT5yl+zj5srHy4g4VJObSHc5JK/tognZjuv2IVj3MSI1lubEXaF 5nOnHNvtQb5ZEALm+Vp672uZZEYpo1LFWwcLs8nJ38lfo09ZeeuL3f02fg+XtPs9CA8R 2Q8g== X-Gm-Message-State: AC+VfDwpTX7HVa+3aay6cVmFl/9XREGv4iN54WIEURje/UeEDYm5n1hW QuidHPEWtx5o8ri10bWh4f6zIyNUYDNyLeP64fyfrg== X-Google-Smtp-Source: ACHHUZ6MeBrCp2gDfqV02Z2pN1Nci7CGlHJNg+eOnuDvo8UcKFRZa19SqMjEjt0OPEkb7WRZuiBh9g== X-Received: by 2002:a5e:c102:0:b0:763:bb4d:a415 with SMTP id v2-20020a5ec102000000b00763bb4da415mr12036425iol.18.1684946245205; Wed, 24 May 2023 09:37:25 -0700 (PDT) Received: from localhost.localdomain (71-211-130-244.hlrn.qwest.net. [71.211.130.244]) by smtp.gmail.com with ESMTPSA id o22-20020a6bcf16000000b0076c81bf2731sm3397266ioa.20.2023.05.24.09.37.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 May 2023 09:37:24 -0700 (PDT) Date: Wed, 24 May 2023 10:36:53 -0600 Subject: [PATCH 02/25] Use gnat_runtime_has_debug_info in Ada catchpoint tests MIME-Version: 1.0 Message-Id: <20230427-ada-catch-exception-v1-2-947caa9905e3@adacore.com> References: <20230427-ada-catch-exception-v1-0-947caa9905e3@adacore.com> In-Reply-To: <20230427-ada-catch-exception-v1-0-947caa9905e3@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This changes the Ada catchpoint tests to use gnat_runtime_has_debug_info. This simplifies the code. --- gdb/testsuite/gdb.ada/catch_assert_if.exp | 28 +------------------------ gdb/testsuite/gdb.ada/catch_ex.exp | 18 ++++------------ gdb/testsuite/gdb.ada/catch_ex_std.exp | 27 ++++++++---------------- gdb/testsuite/gdb.ada/excep_handle.exp | 24 +++++----------------- gdb/testsuite/gdb.ada/mi_catch_assert.exp | 33 +----------------------------- gdb/testsuite/gdb.ada/mi_catch_ex.exp | 31 ++-------------------------- gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp | 32 +---------------------------- gdb/testsuite/gdb.ada/mi_ex_cond.exp | 33 +++--------------------------- 8 files changed, 25 insertions(+), 201 deletions(-) diff --git a/gdb/testsuite/gdb.ada/catch_assert_if.exp b/gdb/testsuite/gdb.ada/catch_assert_if.exp index f5b6096ecb0..4078fa408d1 100644 --- a/gdb/testsuite/gdb.ada/catch_assert_if.exp +++ b/gdb/testsuite/gdb.ada/catch_assert_if.exp @@ -15,7 +15,7 @@ load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile bla @@ -25,35 +25,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional clean_restart ${testfile} -###################################################################### -# 1. Try catching all exceptions to check that runtime supports it. # -###################################################################### - set eol "\[\r\n\]+" set sp "\[ \t\]*" -if {![runto_main]} { - return 0 -} - -set msg "insert catchpoint on all Ada exceptions" -gdb_test_multiple "catch exception" $msg { - -re "Catchpoint $decimal: all Ada exceptions$eol$gdb_prompt $" { - pass $msg - } - -re "Your Ada runtime appears to be missing some debugging information.*$eol$gdb_prompt $" { - # If the runtime was not built with enough debug information, - # or if it was stripped, we can not test exception - # catchpoints. - unsupported $msg - return -1 - } -} - -################################################## -# 2. Try catching conditional failed assertion. # -################################################## - # Here is the scenario: # - Restart the debugger from scratch, runto_main # We'll catch assertions if Global_Var = 2 diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp index de1e53243fb..388eb949e37 100644 --- a/gdb/testsuite/gdb.ada/catch_ex.exp +++ b/gdb/testsuite/gdb.ada/catch_ex.exp @@ -15,7 +15,7 @@ load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile foo @@ -44,19 +44,9 @@ if {![runto_main]} { return 0 } -set msg "insert catchpoint on all Ada exceptions" -gdb_test_multiple "catch exception" $msg { - -re "Catchpoint $any_nb: all Ada exceptions$eol$gdb_prompt $" { - pass $msg - } - -re "Your Ada runtime appears to be missing some debugging information.*$eol$gdb_prompt $" { - # If the runtime was not built with enough debug information, - # or if it was stripped, we can not test exception - # catchpoints. - unsupported $msg - return -1 - } -} +gdb_test "catch exception" \ + "Catchpoint $any_nb: all Ada exceptions" \ + "insert catchpoint on all Ada exceptions" gdb_test "info break" \ "$info_break_header$eol.*$catch_exception_info" \ diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp index 73cbdaf90ca..3a2b10a8c13 100644 --- a/gdb/testsuite/gdb.ada/catch_ex_std.exp +++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp @@ -17,7 +17,7 @@ require allow_shlib_tests load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile foo @@ -69,23 +69,12 @@ if {![runto_main]} { return 0 } -set can_catch_exceptions 0 -gdb_test_multiple "catch exception some_kind_of_error" "" { - -re "Catchpoint \[0-9\]+: `some_kind_of_error' Ada exception\r\n$gdb_prompt $" { - pass $gdb_test_name - set can_catch_exceptions 1 - } +gdb_test "catch exception some_kind_of_error" \ + "Catchpoint \[0-9\]+: `some_kind_of_error' Ada exception" - -re "Your Ada runtime appears to be missing some debugging information.\r\nCannot insert Ada exception catchpoint in this configuration.\r\n$gdb_prompt $" { - unsupported $gdb_test_name - } -} - -if { $can_catch_exceptions } { - gdb_test "cont" \ - "Catchpoint \[0-9\]+, .* at .*foo\.adb:\[0-9\]+.*" \ - "caught the exception" +gdb_test "cont" \ + "Catchpoint \[0-9\]+, .* at .*foo\.adb:\[0-9\]+.*" \ + "caught the exception" - gdb_test "print \$_ada_exception = some_package.some_kind_of_error'Address" \ - " = true" -} +gdb_test "print \$_ada_exception = some_package.some_kind_of_error'Address" \ + " = true" diff --git a/gdb/testsuite/gdb.ada/excep_handle.exp b/gdb/testsuite/gdb.ada/excep_handle.exp index 2cc80fbb988..deb3ace2987 100644 --- a/gdb/testsuite/gdb.ada/excep_handle.exp +++ b/gdb/testsuite/gdb.ada/excep_handle.exp @@ -15,7 +15,7 @@ load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile foo @@ -40,32 +40,18 @@ set catchpoint_program_error_msg \ set catchpoint_storage_error_msg \ "Catchpoint $decimal, exception at $hex in foo \\\(\\\).*at .*foo.adb:$decimal$eol$decimal$sp$when Storage_Error =>" -############################################ -# Check that runtime supports catchpoint. # -############################################ - if {![runto_main]} { return 0 } -set msg "insert catchpoint on all Ada exceptions handlers" -gdb_test_multiple "catch handlers" $msg { - -re "Catchpoint $decimal: all Ada exceptions handlers$eol$gdb_prompt $" { - pass $msg - } - -re "Your Ada runtime appears to be missing some debugging information.*$eol$gdb_prompt $" { - # If the runtime was not built with enough debug information, - # or if it was stripped, we can not test exception handlers - # catchpoints. - unsupported $msg - return -1 - } -} - ############################################ # 1. Try catching all exceptions handlers. # ############################################ +gdb_test "catch handlers" \ + "Catchpoint $decimal: all Ada exceptions handlers" \ + "insert catchpoint on all Ada exceptions handlers" + # Continue. The program should stop at first exception handling. gdb_test "continue" \ diff --git a/gdb/testsuite/gdb.ada/mi_catch_assert.exp b/gdb/testsuite/gdb.ada/mi_catch_assert.exp index c3673fab8e8..7586e0a4256 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_assert.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_assert.exp @@ -15,7 +15,7 @@ load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile bla @@ -23,37 +23,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional return -1 } -# Some global variables used to simplify the maintenance of some of -# the regular expressions below. -set eol "\[\r\n\]+" -set sp "\[ \t\]*" - -# Before going any further, verify that we can insert exception -# catchpoints... That way, we won't have to do this while doing -# the actual GDB/MI testing. - -clean_restart ${testfile} - -if {![runto_main]} { - return 0 -} - -set msg "insert catchpoint on all Ada exceptions" -gdb_test_multiple "catch exception" $msg { - -re "Catchpoint $decimal: all Ada exceptions$eol$gdb_prompt $" { - pass $msg - } - -re "Your Ada runtime appears to be missing some debugging information.*\[\r\n\]+$gdb_prompt $" { - # If the runtime was not built with enough debug information, - # or if it was stripped, we can not test exception - # catchpoints. - unsupported $msg - return -1 - } -} - -# Now, we can start the GDB/MI testing itself... - load_lib mi-support.exp set MIFLAGS "-i=mi" diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp index d0dfbd59764..8cbcbe7e1a8 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp @@ -15,7 +15,7 @@ load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile foo @@ -23,36 +23,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional return -1 } -# Some global variables used to simplify the maintenance of some of +# A global variable used to simplify the maintenance of some of # the regular expressions below. set any_nb "\[0-9\]+" -set eol "\[\r\n\]+" - -# Before going any further, verify that we can insert exception -# catchpoints... That way, we won't have to do this while doing -# the actual GDB/MI testing. - -clean_restart ${testfile} - -if {![runto_main]} { - return 0 -} - -set msg "insert catchpoint on all Ada exceptions" -gdb_test_multiple "catch exception" $msg { - -re "Catchpoint $any_nb: all Ada exceptions$eol$gdb_prompt $" { - pass $msg - } - -re "Your Ada runtime appears to be missing some debugging information.*\[\r\n\]+$gdb_prompt $" { - # If the runtime was not built with enough debug information, - # or if it was stripped, we can not test exception - # catchpoints. - unsupported $msg - return -1 - } -} - -# Now, we can start the GDB/MI testing itself... load_lib mi-support.exp set MIFLAGS "-i=mi" diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp index 2cd175f098b..ae081448553 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp @@ -15,7 +15,7 @@ load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile foo @@ -23,36 +23,6 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional return -1 } -# A global variable used to simplify the maintenance of some of -# the regular expressions below. -set eol "\[\r\n\]+" - -# Before going any further, verify that we can insert exception -# handlers catchpoints... That way, we won't have to do this while -# doing the actual GDB/MI testing. - -clean_restart ${testfile} - -if {![runto_main]} { - return 0 -} - -set msg "insert catchpoint on all Ada exceptions handlers" -gdb_test_multiple "catch handlers" $msg { - -re "Catchpoint $decimal: all Ada exceptions handlers$eol$gdb_prompt $" { - pass $msg - } - -re "Your Ada runtime appears to be missing some debugging information.*\[\r\n\]+$gdb_prompt $" { - # If the runtime was not built with enough debug information, - # or if it was stripped, we can not test exception - # catchpoints. - unsupported $msg - return -1 - } -} - -# Now, we can start the GDB/MI testing itself... - load_lib mi-support.exp set MIFLAGS "-i=mi" diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond.exp b/gdb/testsuite/gdb.ada/mi_ex_cond.exp index 54aa6b54ee1..c0bc079f5f9 100644 --- a/gdb/testsuite/gdb.ada/mi_ex_cond.exp +++ b/gdb/testsuite/gdb.ada/mi_ex_cond.exp @@ -15,7 +15,7 @@ load_lib "ada.exp" -require allow_ada_tests +require allow_ada_tests gnat_runtime_has_debug_info standard_ada_testfile foo @@ -23,36 +23,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional return -1 } -# # Some global variables used to simplify the maintenance of some of -# # the regular expressions below. +# A global variable used to simplify the maintenance of some of +# the regular expressions below. set any_nb "\[0-9\]+" -set eol "\[\r\n\]+" - -# Before going any further, verify that we can insert exception -# catchpoints... That way, we won't have to do this while doing -# the actual GDB/MI testing. - -clean_restart ${testfile} - -if {![runto_main]} { - return 0 -} - -set msg "insert catchpoint on all Ada exceptions" -gdb_test_multiple "catch exception" $msg { - -re "Catchpoint $any_nb: all Ada exceptions$eol$gdb_prompt $" { - pass $msg - } - -re "Your Ada runtime appears to be missing some debugging information.*\[\r\n\]+$gdb_prompt $" { - # If the runtime was not built with enough debug information, - # or if it was stripped, we can not test exception - # catchpoints. - unsupported $msg - return -1 - } -} - -# Now, we can start the GDB/MI testing itself... load_lib mi-support.exp set MIFLAGS "-i=mi"