Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] testsuite: Fix rerun_to_main to allow restarting
@ 2002-09-14  2:51 Corinna Vinschen
  2002-09-18  2:13 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2002-09-14  2:51 UTC (permalink / raw)
  To: gdb-patches

Hi,

the following patch fixes an error in the testsuite lib.  In lib/gdb.exp,
the proc rerun_to_main() doesn't take into account, that some targets
never actually exit, but instead are programatically trapped in some
_exit function.

This means that rerun_to_main() must be able to manage the situation
that gdb not just reruns, but first asks

  The program being debugged has been started already.
  Start it from the beginning? (y or n)

The following patch allows exactly that.

As a side effect, this eliminates the superfluous and identical
implementation of rerun_to_main() in gdb.base/ena-dis-br.exp.

Corinna

	* lib/gdb.exp (rerun_to_main): Allow restarting application.
	* gdb.base/ena-dis-br.exp (rerun_to_main): Eliminate.

Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.26
diff -u -p -r1.26 gdb.exp
--- lib/gdb.exp	13 Sep 2002 17:20:11 -0000	1.26
+++ lib/gdb.exp	14 Sep 2002 09:44:44 -0000
@@ -1685,6 +1685,10 @@ proc rerun_to_main {} {
   } else {
     send_gdb "run\n"
     gdb_expect {
+      -re "The program .* has been started already.*y or n. $" {
+	  send_gdb "y\n"
+	  exp_continue
+      }
       -re "Starting program.*$gdb_prompt $"\
 	      {pass "rerun to main" ; return 0}
       -re "$gdb_prompt $"\
Index: gdb.base/ena-dis-br.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ena-dis-br.exp,v
retrieving revision 1.2
diff -u -p -r1.2 ena-dis-br.exp
--- gdb.base/ena-dis-br.exp	6 Mar 2001 08:21:50 -0000	1.2
+++ gdb.base/ena-dis-br.exp	14 Sep 2002 09:44:44 -0000
@@ -38,30 +38,6 @@ if  { [gdb_compile "${srcdir}/${subdir}/
      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
 }
 
-proc rerun_to_main {} {
-  global gdb_prompt
-
-  if [target_info exists use_gdb_stub] {
-    gdb_run_cmd
-    gdb_expect {
-      -re ".*Breakpoint .*main .*$gdb_prompt $"\
-	      {pass "rerun to main" ; return 0}
-      -re "$gdb_prompt $"\
-	      {fail "rerun to main" ; return 0}
-      timeout {fail "(timeout) rerun to main" ; return 0}
-    }
-  } else {
-    send_gdb "run\n"
-    gdb_expect {
-      -re "Starting program.*$gdb_prompt $"\
-	      {pass "rerun to main" ; return 0}
-      -re "$gdb_prompt $"\
-	      {fail "rerun to main" ; return 0}
-      timeout {fail "(timeout) rerun to main" ; return 0}
-    }
-  }
-}
-
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-09-18 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-14  2:51 [RFA] testsuite: Fix rerun_to_main to allow restarting Corinna Vinschen
2002-09-18  2:13 ` Corinna Vinschen
2002-09-18  7:56   ` Fernando Nasser
2002-09-18  8:34     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox