summaryrefslogtreecommitdiffstats
path: root/gdb/testsuite/lib/gdb.exp
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2002-11-22 07:00:37 +0000
committerJim Blandy <jimb@codesourcery.com>2002-11-22 07:00:37 +0000
commitb6d3ce701569389bbc78d5684ae137ad23f149ec (patch)
treef25a5038658544ad0ee6a7590b532a3c615a5715 /gdb/testsuite/lib/gdb.exp
parent9e297a9744a5d723899cc73201720ed662caea3c (diff)
downloadppe42-binutils-b6d3ce701569389bbc78d5684ae137ad23f149ec.tar.gz
ppe42-binutils-b6d3ce701569389bbc78d5684ae137ad23f149ec.zip
* gdb.base/step-line.exp: Check that GDB can handle filenames that
appear in the line number info, but not in the preprocessor macro info. * lib/gdb.exp (gdb_internal_error_regexp): New variable. (gdb_internal_error_resync): New procedure. (gdb_test): If the command results in an internal error, answer GDB's questions until we get back to a prompt.
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r--gdb/testsuite/lib/gdb.exp55
1 files changed, 55 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index aae73657a5..7be95a1a87 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -370,6 +370,56 @@ proc gdb_continue_to_breakpoint {name} {
}
+# A regular expression matching the output GDB produces when it
+# reports an internal error.
+set gdb_internal_error_regexp ".*A problem internal to GDB has been detected"
+
+
+# gdb_internal_error_resync TESTNAME
+#
+# Answer the questions GDB asks after it reports an internal error
+# until we get back to a GDB prompt, as part of the test named
+# TESTNAME. Decline to quit the debugging session, and decline to
+# create a core file.
+#
+# This procedure just answers whatever questions come up until it sees
+# a GDB prompt; it doesn't require you to have matched the input up to
+# any specific point. However, it only answers questions it sees in
+# the output itself, so if you've matched a question, you had better
+# answer it yourself before calling this.
+#
+# The variable `gdb_internal_error_regexp' is set up to match the
+# internal error message, but none of the questions that follow it, so
+# you can write code like this:
+#
+# gdb_expect {
+# ...
+# -re $gdb_internal_error_regexp {
+# gdb_internal_error_resync "$message (internal error)"
+# }
+# ...
+# }
+proc gdb_internal_error_resync {testname} {
+ global gdb_prompt
+
+ gdb_expect {
+ -re "Quit this debugging session\\? \\(y or n\\) $" {
+ send_gdb "n\n"
+ exp_continue
+ }
+ -re "Create a core file of GDB\\? \\(y or n\\) $" {
+ send_gdb "n\n"
+ exp_continue
+ }
+ -re "$gdb_prompt $" {
+ # We're resynchronized.
+ }
+ timeout {
+ fail "$testname (internal error resync timeout)"
+ }
+ }
+}
+
# gdb_test COMMAND PATTERN MESSAGE QUESTION RESPONSE
# Send a command to gdb; test the result.
@@ -395,6 +445,7 @@ proc gdb_test { args } {
global verbose
global gdb_prompt
global GDB
+ global gdb_internal_error_regexp
upvar timeout timeout
if [llength $args]>2 then {
@@ -477,6 +528,10 @@ proc gdb_test { args } {
}
}
gdb_expect $tmt {
+ -re $gdb_internal_error_regexp {
+ fail "$message"
+ gdb_internal_error_resync "$message (internal error)"
+ }
-re "\\*\\*\\* DOSEXIT code.*" {
if { $message != "" } {
fail "$message";
OpenPOWER on IntegriCloud