Fix test names starting with uppercase output by basic functions
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / mi_catch_ex.exp
index 4bbbf5a7f7c2b366c57b7a41d67059c654afff2e..6ec06090e098fec6d8577f857f45975603ec60ec 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2011-2012 Free Software Foundation, Inc.
+# Copyright 2011-2016 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ set eol "\[\r\n\]+"
 clean_restart ${testfile}
 
 if ![runto_main] then {
-   fail "Cannot run to main, testcase aborted"
+   fail "cannot run to main, testcase aborted"
    return 0
 }
 
@@ -70,23 +70,46 @@ mi_gdb_load ${binfile}
 ####################################
 
 if ![mi_run_to_main] then {
-   fail "Cannot run to main, testcase aborted"
+   fail "cannot run to main, testcase aborted"
    return 0
 }
 
-mi_gdb_test "catch exception"
+mi_gdb_test "-catch-exception" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"all Ada exceptions\",.*}" \
+            "catch all exceptions"
 
-mi_execute_to "exec-continue" \
-              "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR" \
-              "foo" "" ".*" ".*" \
-              ".*" \
-              "continue to exception catchpoint hit"
+# Continue to caught exception.
 
-mi_execute_to "exec-continue" \
-              "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"PROGRAM_ERROR" \
-              "foo" "" ".*" ".*" \
-              ".*" \
-              "continue to exception catchpoint hit"
+proc continue_to_exception { exception_name test } {
+    global hex any_nb
+
+    mi_send_resuming_command "exec-continue" "$test"
+
+    # Match console stream output.
+    gdb_expect {
+       -re " $exception_name at $hex in foo " {
+       }
+       timeout {
+           fail "$test (timeout)"
+           return -1
+       }
+    }
+
+    # Now MI stream output.
+    mi_expect_stop \
+       "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name" \
+       "foo" "" ".*" ".*" \
+       ".*" \
+       $test
+}
+
+continue_to_exception \
+    "CONSTRAINT_ERROR" \
+    "continue until CE caught by all-exceptions catchpoint"
+
+continue_to_exception \
+    "PROGRAM_ERROR" \
+    "continue until PE caught by all-exceptions catchpoint"
 
 ################################################
 # 2. Try catching only some of the exceptions. #
@@ -103,15 +126,21 @@ mi_execute_to "exec-continue" \
 #  - continue, the program exits.
 
 if ![mi_run_to_main] then {
-   fail "Cannot run to main, testcase aborted"
+   fail "cannot run to main, testcase aborted"
    return 0
 }
 
-mi_gdb_test "catch exception Program_Error"
+mi_gdb_test "-catch-exception -e Program_Error" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"`Program_Error' Ada exception\",.*}" \
+            "catch Program_Error"
 
-mi_gdb_test "catch assert"
+mi_gdb_test "-catch-assert" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"failed Ada assertions\",.*}" \
+            "catch assert failures"
 
-mi_gdb_test "catch exception unhandled"
+mi_gdb_test "-catch-exception -u" \
+            "\\^done,bkptno=\"$decimal\",bkpt={.*disp=\"keep\",enabled=\"y\",addr=\"$hex\",what=\"unhandled Ada exceptions\",.*}" \
+            "catch unhandled exceptions"
 
 mi_execute_to "exec-continue" \
               "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"PROGRAM_ERROR" \
@@ -123,11 +152,11 @@ mi_execute_to "exec-continue" \
               "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb" \
               "foo" "" ".*" ".*" \
               ".*" \
-              "continue to exception catchpoint hit"
+              "continue to assert failure catchpoint hit"
 
 mi_execute_to "exec-continue" \
               "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR" \
               "foo" "" ".*" ".*" \
               ".*" \
-              "continue to exception catchpoint hit"
+              "continue to unhandled exception catchpoint hit"
 
This page took 0.032421 seconds and 4 git commands to generate.