diff options
author | Joel Brobecker <brobecker@adacore.com> | 2017-11-24 17:09:42 -0500 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2017-11-24 17:15:30 -0500 |
commit | e547c119d043f2ecffb70452020ab9150d083a91 (patch) | |
tree | a10b51c4f842670ed00ce3970ee54adbafa9d55a /gdb/testsuite/gdb.ada | |
parent | 5f1ca24acd8fd4e21c4f6f3ed2bbc4e2365215fe (diff) | |
download | binutils-gdb-e547c119d043f2ecffb70452020ab9150d083a91.tar.gz |
(Ada) provide the exception message when hitting an exception catchpoint
This patch enhances the debugger to print the exception message, when
available, as part of an exception catchpoint hit notification (both
GDB/CLI and GDB/MI). For instance, with the following code...
procedure A is
begin
raise Constraint_Error with "hello world";
end A;
... instead of printing...
Catchpoint 1, CONSTRAINT_ERROR at 0x000000000040245c in a () at a.adb:3
... it now prints:
Catchpoint 1, CONSTRAINT_ERROR (hello world) at 0x000000000040245c in a ()
^^^^^^^^^^^^^
This enhancement requires runtime support. If not present, the debugger
just behaves as before.
In GDB/MI mode, if the exception message is available, it is provided
as an extra field named "exception-message" in the catchpoint notification:
*stopped,bkptno="1",[...],exception-name="CONSTRAINT_ERROR",
exception-message="hello world",[...]
gdb/ChangeLog:
* ada-lang.c (ada_exception_message_1, ada_exception_message):
New functions.
(print_it_exception): If available, display the exception
message as well.
* NEWS: Document new feature.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Ada Exception Information): Document
new "exception-message" field.
gdb/testsuite/ChangeLog:
* gdb.ada/catch_ex.exp, gdb.ada/mi_catch_ex.exp,
gdb.ada/mi_ex_cond.exp: Accept optional exception message in
when hitting an exception catchpoint.
Diffstat (limited to 'gdb/testsuite/gdb.ada')
-rw-r--r-- | gdb/testsuite/gdb.ada/catch_ex.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/mi_catch_ex.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/mi_ex_cond.exp | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp index 5313e77dd79..3797601d12c 100644 --- a/gdb/testsuite/gdb.ada/catch_ex.exp +++ b/gdb/testsuite/gdb.ada/catch_ex.exp @@ -62,13 +62,13 @@ gdb_test "info break" \ "info break, catch all Ada exceptions" set catchpoint_msg \ - "Catchpoint $any_nb, CONSTRAINT_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" + "Catchpoint $any_nb, CONSTRAINT_ERROR (\\\(foo\\.adb:$decimal explicit raise\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" gdb_test "continue" \ "Continuing\.$eol$catchpoint_msg$eol.*SPOT1" \ "continuing to first exception" set catchpoint_msg \ - "Catchpoint $any_nb, PROGRAM_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" + "Catchpoint $any_nb, PROGRAM_ERROR (\\\(foo\\.adb:$decimal explicit raise\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" gdb_test "continue" \ "Continuing\.$eol$catchpoint_msg$eol.*SPOT2" \ "continuing to second exception" @@ -116,7 +116,7 @@ gdb_test "info break" \ "info break, second run" set catchpoint_msg \ - "Catchpoint $any_nb, PROGRAM_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" + "Catchpoint $any_nb, PROGRAM_ERROR (\\\(foo.adb:$decimal explicit raise\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" gdb_test "continue" \ "Continuing\.$eol$catchpoint_msg$eol.*SPOT2" \ "continuing to Program_Error exception" @@ -157,7 +157,7 @@ gdb_test "tcatch exception" \ "Temporary catchpoint $any_nb: all Ada exceptions" set temp_catchpoint_msg \ - "Temporary catchpoint $any_nb, CONSTRAINT_ERROR at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" + "Temporary catchpoint $any_nb, CONSTRAINT_ERROR (\\\(.*\\\) )?at $any_addr in foo \\\(\\\).*at .*foo.adb:$any_nb" gdb_test "continue" \ "Continuing\.$eol$temp_catchpoint_msg$eol.*SPOT1" \ "continuing to temporary catchpoint" diff --git a/gdb/testsuite/gdb.ada/mi_catch_ex.exp b/gdb/testsuite/gdb.ada/mi_catch_ex.exp index c9dd6161c31..2ca3b6c38fd 100644 --- a/gdb/testsuite/gdb.ada/mi_catch_ex.exp +++ b/gdb/testsuite/gdb.ada/mi_catch_ex.exp @@ -80,7 +80,7 @@ mi_gdb_test "-catch-exception" \ # Continue to caught exception. -proc continue_to_exception { exception_name test } { +proc continue_to_exception { exception_name exception_message test } { global hex any_nb mi_send_resuming_command "exec-continue" "$test" @@ -97,18 +97,18 @@ proc continue_to_exception { exception_name test } { # Now MI stream output. mi_expect_stop \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name" \ + "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"$exception_name(\",exception-message=\"$exception_message)?" \ "foo" "" ".*" ".*" \ ".*" \ $test } continue_to_exception \ - "CONSTRAINT_ERROR" \ + "CONSTRAINT_ERROR" "foo\\.adb:$decimal explicit raise" \ "continue until CE caught by all-exceptions catchpoint" continue_to_exception \ - "PROGRAM_ERROR" \ + "PROGRAM_ERROR" "foo\\.adb:$decimal explicit raise" \ "continue until PE caught by all-exceptions catchpoint" ################################################ @@ -143,7 +143,7 @@ mi_gdb_test "-catch-exception -u" \ "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" diff --git a/gdb/testsuite/gdb.ada/mi_ex_cond.exp b/gdb/testsuite/gdb.ada/mi_ex_cond.exp index 78765be9011..369f155f8a7 100644 --- a/gdb/testsuite/gdb.ada/mi_ex_cond.exp +++ b/gdb/testsuite/gdb.ada/mi_ex_cond.exp @@ -81,7 +81,7 @@ mi_gdb_test "-catch-exception -c \"i = 2\" -e constraint_error" \ mi_run_cmd mi_expect_stop \ - "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR" \ + "breakpoint-hit\",disp=\"keep\",bkptno=\"$any_nb\",exception-name=\"CONSTRAINT_ERROR(\",exception-message=\"foo\\.adb:$decimal explicit raise)?" \ "foo" "" ".*" ".*" \ ".*" \ "run to exception catchpoint hit" |