X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.ada%2Fmi_catch_ex.exp;h=60a5f6f19ee7107f289ae781a41eb8e18b7e3518;hb=b811d2c2920ddcb1adcd438da38e90912b31f45f;hp=d30d44b27b3d323af03becfc7e69b364897cd491;hpb=c968bd18df11f18121da3b22bb83d70f136e9fa8;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp index d30d44b27b..60a5f6f19e 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp @@ -1,4 +1,4 @@ -# Copyright 2011-2013 Free Software Foundation, Inc. +# Copyright 2011-2020 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\",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 until CE caught by all-exceptions catchpoint" +# Continue to caught exception. -mi_execute_to "exec-continue" \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"PROGRAM_ERROR" \ - "foo" "" ".*" ".*" \ - ".*" \ - "continue until PE caught by all-exceptions catchpoint" +proc continue_to_exception { exception_name exception_message test } { + global hex any_nb + + mi_send_resuming_command "exec-continue" "$test" + + # Match console stream output. + gdb_expect { + -re " $exception_name\( \\($exception_message\\)\)? 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\(\",exception-message=\"$exception_message\)?" \ + "foo" "" ".*" ".*" \ + ".*" \ + $test +} + +continue_to_exception \ + "CONSTRAINT_ERROR" "foo\\.adb:$decimal explicit raise" \ + "continue until CE caught by all-exceptions catchpoint" + +continue_to_exception \ + "PROGRAM_ERROR" "foo\\.adb:$decimal explicit raise" \ + "continue until PE caught by all-exceptions catchpoint" ################################################ # 2. Try catching only some of the exceptions. # @@ -103,18 +126,24 @@ 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\",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\",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\",what=\"unhandled Ada exceptions\",.*}" \ + "catch unhandled exceptions" mi_execute_to "exec-continue" \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"PROGRAM_ERROR" \ + "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"PROGRAM_ERROR(\",exception-message=\"foo\\.adb:$decimal explicit raise)?" \ "foo" "" ".*" ".*" \ ".*" \ "continue to exception catchpoint hit"