Patchwork [PUSHED] gdb/testsuite/ada: Handle missing debug info case

login
register
mail settings
Submitter Andrew Burgess
Date Oct. 7, 2019, 12:19 p.m.
Message ID <20191007121942.22849-1-andrew.burgess@embecosm.com>
Download mbox | patch
Permalink /patch/34841/
State New
Headers show

Comments

Andrew Burgess - Oct. 7, 2019, 12:19 p.m.
Update a test script to handle the case where missing Ada debug
information means we can't catch exceptions.  This was discussed on
the list here:

  https://sourceware.org/ml/gdb-patches/2019-08/msg00607.html

And is similar to code that already exists in the test scripts
gdb.ada/catch_ex.exp and gdb.ada/mi_catch_ex.exp.

gdb/testsuite/ChangeLog:

	* gdb.ada/catch_ex_std.exp: Handle being unabled to catch Ada
	exceptions due to missing debug information.
---
 gdb/testsuite/ChangeLog                |  5 +++++
 gdb/testsuite/gdb.ada/catch_ex_std.exp | 25 ++++++++++++++++++-------
 2 files changed, 23 insertions(+), 7 deletions(-)
Tom Tromey - Oct. 7, 2019, 5:17 p.m.
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> Update a test script to handle the case where missing Ada debug
Andrew> information means we can't catch exceptions.  This was discussed on
Andrew> the list here:

Andrew>   https://sourceware.org/ml/gdb-patches/2019-08/msg00607.html

Andrew> And is similar to code that already exists in the test scripts
Andrew> gdb.ada/catch_ex.exp and gdb.ada/mi_catch_ex.exp.

Thanks for doing this.

Tom

Patch

diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
index 839d0bb092f..f3a4e59d4b9 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp
@@ -95,12 +95,23 @@  if {![runto_main]} then {
    return 0
 }
 
-gdb_test "catch exception some_kind_of_error" \
-    "Catchpoint \[0-9\]+: `some_kind_of_error' Ada exception"
+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 "cont" \
-    "Catchpoint \[0-9\]+, .* at .*foo\.adb:\[0-9\]+.*" \
-    "caught the 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
+    }
+}
 
-gdb_test "print \$_ada_exception = some_package.some_kind_of_error'Address" \
-    " = true"
+if { $can_catch_exceptions } {
+    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"
+}