aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-08-26 21:45:24 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-08-26 21:45:24 +0000
commit353d1d731afffb8550c9451e783b02be4121f461 (patch)
tree96be8c17fc0bb39b58c322ab3f50deed741f526e /gdb/testsuite
parent5c07461a748143e1ad1931bd0f5054aabde9c306 (diff)
downloadgdb-353d1d731afffb8550c9451e783b02be4121f461.zip
gdb-353d1d731afffb8550c9451e783b02be4121f461.tar.gz
gdb-353d1d731afffb8550c9451e783b02be4121f461.tar.bz2
gdb/
* breakpoint.c (bpstat_do_actions): New variable cleanup_if_error, call make_bpstat_clear_actions_cleanup and discard_cleanups for it. * defs.h (make_bpstat_clear_actions_cleanup): New declaration. * exceptions.c (throw_exception): Remove the bpstat_clear_actions call. * inf-loop.c (inferior_event_handler): New variable cleanup_if_error, call make_bpstat_clear_actions_cleanup and discard_cleanups for it. Call bpstat_clear_actions for failed fetch_inferior_event_wrapper. * infrun.c (fetch_inferior_event): Call make_bpstat_clear_actions_cleanup. * top.c (execute_command): New variable cleanup_if_error, call make_bpstat_clear_actions_cleanup and discard_cleanups for it. * utils.c (do_bpstat_clear_actions_cleanup) (make_bpstat_clear_actions_cleanup): New functions. gdb/testsuite/ * gdb.base/commands.exp (error_clears_commands_left): New function. (): Call it.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/commands.exp69
2 files changed, 74 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5dc374c..cfa7227 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2011-08-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * gdb.base/commands.exp (error_clears_commands_left): New function.
+ (): Call it.
+
+2011-08-26 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* gdb.mi/mi-inheritance-syntax-error.cc (A): Make `a' public.
(C): Initialize `a'.
* gdb.mi/mi-inheritance-syntax-error.exp
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index fb9cf4e..2c57986 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -678,6 +678,74 @@ proc if_commands_test {} {
}
}
+# Verify an error during "commands" commands execution will prevent any other
+# "commands" from other breakpoints at the same location to be executed.
+
+proc error_clears_commands_left {} {
+ set test "hook-stop 1"
+ gdb_test_multiple {define hook-stop} $test {
+ -re "End with a line saying just \"end\"\\.\r\n>$" {
+ pass $test
+ }
+ }
+ set test "hook-stop 1a"
+ gdb_test_multiple {echo hook-stop1\n} $test {
+ -re "\r\n>$" {
+ pass $test
+ }
+ }
+ gdb_test_no_output "end" "hook-stop 1b"
+
+ delete_breakpoints
+ gdb_breakpoint "main"
+
+ set test "main commands 1"
+ gdb_test_multiple {commands $bpnum} $test {
+ -re "End with a line saying just \"end\"\\.\r\n>$" {
+ pass $test
+ }
+ }
+ set test "main commands 1a"
+ gdb_test_multiple {echo cmd1\n} $test {
+ -re "\r\n>$" {
+ pass $test
+ }
+ }
+ set test "main commands 1b"
+ gdb_test_multiple {errorcommandxy\n} $test {
+ -re "\r\n>$" {
+ pass $test
+ }
+ }
+ gdb_test_no_output "end" "main commands 1c"
+
+ gdb_breakpoint "main"
+ set test "main commands 2"
+ gdb_test_multiple {commands $bpnum} $test {
+ -re "End with a line saying just \"end\"\\.\r\n>$" {
+ pass $test
+ }
+ }
+ set test "main commands 2a"
+ gdb_test_multiple {echo cmd2\n} $test {
+ -re "\r\n>$" {
+ pass $test
+ }
+ }
+ set test "main commands 2b"
+ gdb_test_multiple {errorcommandyz\n} $test {
+ -re "\r\n>$" {
+ pass $test
+ }
+ }
+ gdb_test_no_output "end" "main commands 2c"
+
+ gdb_run_cmd
+ gdb_test "" "\r\nhook-stop1\r\n.*\r\ncmd1\r\nUndefined command: \"errorcommandxy\"\\. Try \"help\"\\." "cmd1 error"
+
+ gdb_test {echo idle\n} "\r\nidle" "no cmd2"
+}
+
proc redefine_hook_test {} {
global gdb_prompt
@@ -758,6 +826,7 @@ stray_arg0_test
source_file_with_indented_comment
recursive_source_test
if_commands_test
+error_clears_commands_left
redefine_hook_test
# This one should come last, as it redefines "backtrace".
redefine_backtrace_test