From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17367 invoked by alias); 14 Jan 2003 18:50:02 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17342 invoked from network); 14 Jan 2003 18:49:57 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (216.138.202.10) by 209.249.29.67 with SMTP; 14 Jan 2003 18:49:57 -0000 Received: from redhat.com (totem.toronto.redhat.com [172.16.14.242]) by touchme.toronto.redhat.com (Postfix) with ESMTP id B1CD9800041; Tue, 14 Jan 2003 13:49:45 -0500 (EST) Message-ID: <3E245BC9.6020302@redhat.com> Date: Tue, 14 Jan 2003 18:50:00 -0000 From: Fernando Nasser Organization: Red Hat , Inc. - Toronto User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Fernando Nasser Cc: Jim Blandy , gdb-patches@sources.redhat.com Subject: Re: RFA: add testsuite function for answering internal error questions References: <3DECE5AB.8020400@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-01/txt/msg00526.txt.bz2 Jim, Andrew was asking me about this patch. I wonder if my reply made to the list. I see it here but I was in the recipients list... Regards, Fernando Fernando Nasser wrote:> Jim, sorry for the delay. I had some e-mail problems. > > The idea is excellent, we should have thought of this before. > I need you to make a couple of changes before checking it in, if you > don't mind: > > 1) > fail "$testname (internal error resync timeout)" > should actually be > perror "Could not resync from internal error (timeout)" > > It is a test harness failure if we were not able to resync and GDB > cannot be no lonmger used for testing. This will properly make all > tests to be unresolved until gdb is restarted. > > Note that I've also got ridden of the TESTNAME argument as well. The > test itself has been marked as failed already since an internal error > was raised. We we fail to resynch we can just issue a constant message > like: > > ERROR: Could not resync from internal error (timeout) > > > > 2) Please get rid of the global variable. You can just do: > > > + -re ".*A problem internal to GDB has been detected" { > > + # The pattern above must be set up to match the > > + # internal error message, but none of the questions > > + # that follow it > > + fail "$message" > > + gdb_internal_error_resync > > + } > > > > Thank you very much for the wonderful idea and for the patch. > > Best regards, > Fernando > > > Jim Blandy wrote: > >> [re-posting: bad changelog entry.] >> >> 2002-11-06 Jim Blandy >> >> * 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"; >> > > -- Fernando Nasser Red Hat - Toronto E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9