From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: RFA: add testsuite function for answering internal error questions
Date: Wed, 06 Nov 2002 12:28:00 -0000 [thread overview]
Message-ID: <vt2bs52focy.fsf@zenia.red-bean.com> (raw)
[re-posting: bad changelog entry.]
2002-11-06 Jim Blandy <jimb@redhat.com>
* 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.
Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.27
diff -c -r1.27 gdb.exp
*** gdb/testsuite/lib/gdb.exp 18 Sep 2002 15:34:10 -0000 1.27
--- gdb/testsuite/lib/gdb.exp 6 Nov 2002 20:21:58 -0000
***************
*** 370,375 ****
--- 370,425 ----
}
+ # 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,400 ****
--- 445,451 ----
global verbose
global gdb_prompt
global GDB
+ global gdb_internal_error_regexp
upvar timeout timeout
if [llength $args]>2 then {
***************
*** 477,482 ****
--- 528,537 ----
}
}
gdb_expect $tmt {
+ -re $gdb_internal_error_regexp {
+ fail "$message"
+ gdb_internal_error_resync "$message (internal error)"
+ }
-re "\\*\\*\\* DOSEXIT code.*" {
if { $message != "" } {
fail "$message";
next reply other threads:[~2002-11-06 20:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-06 12:28 Jim Blandy [this message]
2002-11-21 23:01 ` Jim Blandy
2002-11-22 11:09 ` Jim Blandy
2002-11-22 11:36 ` Jim Blandy
2002-12-03 9:00 ` Fernando Nasser
2003-01-14 18:50 ` Fernando Nasser
2003-02-04 22:33 ` Jim Blandy
2003-09-22 23:46 ` # " Jim Blandy
2003-09-23 23:48 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vt2bs52focy.fsf@zenia.red-bean.com \
--to=jimb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox