]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use gnat_runtime_has_debug_info in Ada catchpoint tests
authorTom Tromey <tromey@adacore.com>
Thu, 20 Apr 2023 17:28:51 +0000 (11:28 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 12 Jun 2023 17:51:52 +0000 (11:51 -0600)
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
gdb/testsuite/gdb.ada/catch_ex.exp
gdb/testsuite/gdb.ada/catch_ex_std.exp
gdb/testsuite/gdb.ada/excep_handle.exp
gdb/testsuite/gdb.ada/mi_catch_assert.exp
gdb/testsuite/gdb.ada/mi_catch_ex.exp
gdb/testsuite/gdb.ada/mi_catch_ex_hand.exp
gdb/testsuite/gdb.ada/mi_ex_cond.exp

index f5b6096ecb082930339dd393c681cee579fd5360..4078fa408d17b423d8ca180e1fbcfc48b1dd7e84 100644 (file)
@@ -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
index de1e53243fbd6aa1b8f2ffabb40bb40a091e514f..388eb949e37715a358943d4c8cad8fad7a3a79bd 100644 (file)
@@ -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" \
index 73cbdaf90ca7779b7fe48f48ab4174a6e77dd98f..3a2b10a8c13253ed67c8a64ff8ff07077c4b2512 100644 (file)
@@ -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"
index 2cc80fbb988d4502f6ea74ec60ce0e359311dd19..deb3ace298738e982b7518daa7be7eff0ae8f262 100644 (file)
@@ -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" \
index c3673fab8e8f6cefe32afd027c49374786d41c95..7586e0a4256d8c3014e43d5c01585253a713f432 100644 (file)
@@ -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"
 
index d0dfbd59764a9f8d6d6d20fbfa9d98bf7b3cef46..8cbcbe7e1a88da56a09e496000610e64145a6478 100644 (file)
@@ -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"
index 2cd175f098b72cb85ec887e4c0910ab1622b9a46..ae081448553ddb09129201a9163e23003126404f 100644 (file)
@@ -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"
 
index 54aa6b54ee14b1bb7ba36f3f9c0d8a710e26a03f..c0bc079f5f94dac300b9f19b094da3c2a746be2a 100644 (file)
@@ -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"