public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* RFC: change "program exited" message
@ 2011-03-03 20:52 Tom Tromey
  2011-03-03 21:18 ` Michael Snyder
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Tom Tromey @ 2011-03-03 20:52 UTC (permalink / raw)
  To: gdb-patches

I would appreciate comments on this patch.
In the absence of comments I will check it in.

If you do multi-inferior debugging, you can wind up with output like
(actual cut-and-paste):

    [New process 24959]
    [New process 24960]

    Program exited with code 0177.

    Program exited with code 0177.
    [New process 24961]
    [New process 24962]

    Program exited normally.

    Program exited normally.

It is hard to see what is going on, because the PID is not reported in
the exit message.

This patch changes GDB to print:

    [Inferior 25036 exited normally]

Most of the work was updating the test suite and writing the ChangeLog.

Built and regtested on x86-64 (compile farm).

Tom

2011-03-03  Tom Tromey  <tromey@redhat.com>

	* infrun.c (print_exited_reason): Include inferior PID in
	message.

2011-03-03  Tom Tromey  <tromey@redhat.com>

	* lib/opencl.exp (skip_opencl_tests): Update for exit message
	change.
	* lib/mi-support.exp (mi_gdb_test): Update for exit message
	change.
	* lib/gdb.exp (gdb_test_multiple): Update comment.  Update for
	exit message change.
	(skip_altivec_tests): Update for exit message change.
	(skip_vsx_tests): Likewise.
	(gdb_continue_to_end): Likewise.
	(gdb_continue_off_end): New proc.
	* lib/cell.exp (skip_cell_tests): Update for exit message change.
	* gdb.threads/tls.exp: Update for exit message change.
	* gdb.threads/thread-unwindonsignal.exp: Use
	gdb_continue_off_end.
	* gdb.threads/step.exp (step_it): Update for exit message change.
	(continue_all): Likewise.
	* gdb.threads/print-threads.exp (test_all_threads): Update for
	exit message change.
	* gdb.threads/interrupted-hand-call.exp: Use
	gdb_continue_off_end.
	* gdb.threads/execl.exp: Use gdb_continue_off_end.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Use
	gdb_continue_off_end.
	* gdb.hp/gdb.objdbg/objdbg02.exp: Use gdb_continue_off_end.
	* gdb.hp/gdb.objdbg/objdbg01.exp: Use gdb_continue_off_end.
	* gdb.hp/gdb.defects/solib-d.exp: Update for exit message change.
	* gdb.cp/method.exp: Update for exit message change.
	* gdb.cp/mb-templates.exp: Update for exit message change.
	* gdb.cp/mb-inline.exp: Use gdb_continue_off_end.
	* gdb.cp/annota3.exp: Update for exit message change.
	* gdb.cp/annota2.exp: Update for exit message change.
	* gdb.cell/fork.exp: Use gdb_continue_off_end.
	* gdb.base/term.exp: Update for exit message change.
	* gdb.base/step-test.exp (test_i): Update for exit message change.
	* gdb.base/sigstep.exp (advance): Update for exit message change.
	(advancei): Likewise.
	* gdb.base/siginfo.exp: Update for exit message change.
	* gdb.base/shlib-call.exp: Use gdb_continue_off_end.
	* gdb.base/reread.exp: Use gdb_continue_off_end.
	* gdb.base/langs.exp: Use gdb_continue_off_end.
	* gdb.base/interrupt.exp: Update for exit message change.
	* gdb.base/gdb1555.exp: Update for exit message change.
	* gdb.base/exe-lock.exp: Use gdb_continue_off_end.
	* gdb.base/ending-run.exp: Update for exit message change.
	* gdb.base/chng-syms.exp: Update for exit message change.
	* gdb.base/checkpoint.exp: Update for exit message change.
	* gdb.base/catch-syscall.exp (check_for_program_end): Use
	gdb_continue_off_end.
	(test_catch_syscall_with_wrong_args): Likewise.
	* gdb.base/call-signal-resume.exp: Use gdb_continue_off_end.
	* gdb.base/break-interp.exp (test_ld): Update for exit message
	change.
	* gdb.base/bang.exp: Update for exit message change.
	* gdb.base/attach.exp (do_attach_tests): Use gdb_continue_off_end.
	(do_call_attach_tests): Likewise.
	* gdb.base/a2-run.exp: Update for exit message change.
	* gdb.arch/ppc-dfp.exp: Update for exit message change.
	* gdb.ada/tasks.exp: Use gdb_continue_off_end.
	* gdb.ada/catch_ex.exp: Use gdb_continue_off_end.


diff --git a/gdb/infrun.c b/gdb/infrun.c
index 274082d..09569af 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5488,22 +5488,28 @@ print_signal_exited_reason (enum target_signal siggnal)
 static void
 print_exited_reason (int exitstatus)
 {
+  struct inferior *inf = current_inferior ();
+
   annotate_exited (exitstatus);
   if (exitstatus)
     {
       if (ui_out_is_mi_like_p (uiout))
 	ui_out_field_string (uiout, "reason", 
 			     async_reason_lookup (EXEC_ASYNC_EXITED));
-      ui_out_text (uiout, "\nProgram exited with code ");
+      ui_out_text (uiout, "[Inferior ");
+      ui_out_text (uiout, plongest (inf->pid));
+      ui_out_text (uiout, " exited with code ");
       ui_out_field_fmt (uiout, "exit-code", "0%o", (unsigned int) exitstatus);
-      ui_out_text (uiout, ".\n");
+      ui_out_text (uiout, "]\n");
     }
   else
     {
       if (ui_out_is_mi_like_p (uiout))
 	ui_out_field_string
 	  (uiout, "reason", async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
-      ui_out_text (uiout, "\nProgram exited normally.\n");
+      ui_out_text (uiout, "[Inferior ");
+      ui_out_text (uiout, plongest (inf->pid));
+      ui_out_text (uiout, " exited normally]\n");
     }
   /* Support the --return-child-result option.  */
   return_child_result_value = exitstatus;
diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index b0a4000..d692aca 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -141,8 +141,6 @@ gdb_test "continue" \
          "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
          "continuing to unhandled exception"
 
-gdb_test "continue" \
-         "Continuing\..*Program exited.*" \
-         "continuing to program completion"
+gdb_continue_off_end "continue" "continuing to program completion"
 
 
diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp
index bced9f8..166f18c 100644
--- a/gdb/testsuite/gdb.ada/tasks.exp
+++ b/gdb/testsuite/gdb.ada/tasks.exp
@@ -70,7 +70,5 @@ gdb_test "info tasks" \
 # Now, resume the execution and make sure that GDB does not stop when
 # task 4 hits the breakpoint. Continuing thus results in our program
 # running to completion.
-gdb_test "continue" \
-         ".*Program exited normally\..*" \
-         "continue until end of program"
+gdb_continue_off_end "continue" "continue until end of program"
 
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
index 10fbd3c..3a57b10 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -59,7 +59,7 @@ gdb_run_cmd
 # When the prompt comes back we'll be at the Set DFP rounding mode breakpoint.
 # Unless the program bails out after checking AT_HWCAP.
 gdb_expect {
-  -re "Program exited with code 01.\[\r\n\]+$gdb_prompt $" {
+  -re "Inferior \[0-9\]+ exited with code 01.\[\r\n\]+$gdb_prompt $" {
     unsupported "This machine doesn't support Decimal Floating Point."
     return -1
   }
diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
index d26a202..fbbf7a4 100644
--- a/gdb/testsuite/gdb.base/a2-run.exp
+++ b/gdb/testsuite/gdb.base/a2-run.exp
@@ -42,7 +42,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "Inferior \[0-9\]+ exited normally" {
 	    unresolved "run \"$testfile\" with no args"
 	}
 	 -re "usage:  factorial <number>" {
@@ -57,19 +57,19 @@ if [istarget "*-*-vxworks*"] then {
     gdb_expect -re "$gdb_prompt $" {}
 } else {
     gdb_expect {
-	-re ".*usage:  factorial <number>.*Program exited with code 01\.\r\n$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.*Inferior \[0-9\]+ exited with code 01.\r\n$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args"
 	    pass "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.*Program exited with code 01.*$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.*Inferior \[0-9\]+ exited with code 01.*$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args"
 	    fail "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally\.\r\n$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.* EXIT code 1.*Inferior \[0-9\]+ exited normally.\r\n$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args (exit wrapper)"
 	    pass "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally.*$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.* EXIT code 1.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args (exit wrapper)"
 	    fail "no spurious messages at program exit"
 	}
@@ -97,7 +97,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "Inferior \[0-9\]+ exited normally" {
 	    unresolved "run \"$testfile\" with arg"
 	}
 	 "120" {
@@ -129,7 +129,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "Inferior \[0-9\]+ exited normally" {
 	    unresolved "run \"$testfile\" again with same args"
 	}
 	 "120" { pass "run \"$testfile\" again with same args" }
@@ -161,7 +161,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "Inferior \[0-9\]+ exited normally" {
 	    unresolved "run after setting args to nil"
 	}
 	 "usage:  factorial <number>" {
@@ -202,7 +202,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "Inferior \[0-9\]+ exited normally" {
 	    unresolved "run \"$testfile\" again after setting args"
 	}
 	 "720" {
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 78df003..10656c0 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -258,7 +258,7 @@ proc do_attach_tests {} {
 
     # Allow the test process to exit, to cleanup after ourselves.
 
-    gdb_test "continue" "Program exited normally." "after attach2, exit"
+    gdb_continue_off_end "continue" "after attach2, exit"
 
     # Make sure we don't leave a process around to confuse
     # the next test run (and prevent the compile by keeping
@@ -365,7 +365,7 @@ proc do_call_attach_tests {} {
     # Get rid of the process
     
     gdb_test "p should_exit = 1"
-    gdb_test "c" "Program exited normally."
+    gdb_continue_off_end
    
     # Be paranoid
    
diff --git a/gdb/testsuite/gdb.base/bang.exp b/gdb/testsuite/gdb.base/bang.exp
index efe2295..cf953a1 100644
--- a/gdb/testsuite/gdb.base/bang.exp
+++ b/gdb/testsuite/gdb.base/bang.exp
@@ -39,7 +39,7 @@ gdb_load ${binfile}
 
 gdb_run_cmd
 gdb_expect {
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
         pass "run program"
     }
     timeout {
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 3df4dcb..fd1a768 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -494,7 +494,7 @@ proc test_ld {file ifmain trynosym displacement} {
 		}
 		exp_continue
 	    }
-	    -re "Program exited (normally|with code \[0-9\]+)\\.\r\n$gdb_prompt $" {
+	    -re "Inferior \[0-9\]+ exited (normally|with code \[0-9\]+).\r\n$gdb_prompt $" {
 		# Do not check the binary filename as it may be truncated.
 		pass $test
 	    }
diff --git a/gdb/testsuite/gdb.base/call-signal-resume.exp b/gdb/testsuite/gdb.base/call-signal-resume.exp
index b85691c..c9b2176 100644
--- a/gdb/testsuite/gdb.base/call-signal-resume.exp
+++ b/gdb/testsuite/gdb.base/call-signal-resume.exp
@@ -146,7 +146,6 @@ gdb_test "continue" "Breakpoint \[0-9\]*, handle_signal.*" \
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_off_end
 
 return 0
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index d25df17..a8a5d54 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -167,7 +167,7 @@ proc check_for_program_end {} {
     delete_breakpoints
 
     set thistest "successful program end"
-    gdb_test "continue" "Program exited normally.*" $thistest
+    gdb_continue_off_end continue $thistest
 
 }
 
@@ -231,7 +231,7 @@ proc test_catch_syscall_with_wrong_args {} {
     # If it doesn't, everything is right (since we don't have
     # a syscall named "mlock" in it).  Otherwise, this is a failure.
     set thistest "catch syscall with unused syscall ($syscall_name)"
-    gdb_test "continue" "Program exited normally.*" $thistest
+    gdb_continue_off_end "continue" $thistest
 }
 
 proc test_catch_syscall_restarting_inferior {} {
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index f34b0d1..6f15fa9 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -277,23 +277,23 @@ gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 10"
 
 delete_breakpoints
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
     "Exit, dropped into next fork one"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
     "Exit, dropped into next fork two"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
     "Exit, dropped into next fork three"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
     "Exit, dropped into next fork four"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
     "Exit, dropped into next fork five"
 
 #
diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp
index d2567e7..aca075e 100644
--- a/gdb/testsuite/gdb.base/chng-syms.exp
+++ b/gdb/testsuite/gdb.base/chng-syms.exp
@@ -100,7 +100,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 
     gdb_run_cmd
     gdb_expect {
-	-re ".*Program exited normally.*$gdb_prompt $" {
+	-re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	    pass "running with invalidated bpt condition after executable changes" 
 	}
 	-re ".*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index 43c46f8..782c206 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -146,7 +146,7 @@ gdb_test_multiple "next" "step out of main" {
 	# This is what happens on mingw32ce.
 	pass "step out of main"
     }
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	# This is what happens on Linux i86 (and I would expect others)
 	set program_exited 1
 	pass "step out of main"
@@ -209,21 +209,21 @@ if {! [target_info exists use_gdb_stub]
     global program_exited;
     if {[eval expr $program_exited == 0]} {
 	gdb_test_multiple "n" "step to end of run" {
-	    -re "Program exited normally.*$gdb_prompt $" {
+	    -re "Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 		# If we actually have debug info for the start function,
 		# then we won't get the "Single-stepping until function
 		# exit" message.
 		pass "step to end of run"
 		set program_exited_normally 1
 	    }
-	    -re "Single.*EXIT code 0\r\n.*Program exited normally.*$gdb_prompt $" {
+	    -re "Single.*EXIT code 0\r\n.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 		pass "step to end of run (status wrapper)"
 		set program_exited_normally 1
 	    }
 	    -re "Single.*EXIT code 0\r\n.*$gdb_prompt $" {
 		pass "step to end of run (status wrapper)"
 	    }
-	    -re ".*Single.*Program exited.*$gdb_prompt $" {
+	    -re ".*Single.*Inferior \[0-9\]+ exited.*$gdb_prompt $" {
 		pass "step to end of run"
 		set program_exited_normally 1
 	    }
diff --git a/gdb/testsuite/gdb.base/exe-lock.exp b/gdb/testsuite/gdb.base/exe-lock.exp
index e4bbbbe..011b9d2 100644
--- a/gdb/testsuite/gdb.base/exe-lock.exp
+++ b/gdb/testsuite/gdb.base/exe-lock.exp
@@ -50,9 +50,7 @@ if ![runto_main] then {
     continue
 }
 
-gdb_test "continue" \
-         ".*Program exited normally\\." \
-         "continue until program exits"
+gdb_continue_off_end
 
 # Try deleting the executable file, now that the program has exited,
 # and make sure that the deletion worked by verifying that the exe
diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp
index 8c3e8ba..21891f8 100644
--- a/gdb/testsuite/gdb.base/gdb1555.exp
+++ b/gdb/testsuite/gdb.base/gdb1555.exp
@@ -77,7 +77,7 @@ gdb_test_multiple "n" $name \
     -re "\[0-9\]+.*return a;.*$gdb_prompt $" {
 	pass $name
     }
-    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { 
+    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nInferior \[0-9\]+ exited normally.*$gdb_prompt $" { 
 	kfail "gdb/1555" $name 
     }
 }
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index cce7fca..aabc316 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -201,7 +201,7 @@ if ![file exists $binfile] then {
 
 	send_gdb "\004"
 	gdb_expect {
-	    -re "end of file.*Program exited normally.*$gdb_prompt $" {
+	    -re "end of file.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 		pass "send end of file"
 	    }
 	    -re "$gdb_prompt $" { fail "send end of file" }
diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
index a42f2d8..e3c3847 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -146,8 +146,7 @@ if [runto csub] then {
 	gdb_breakpoint "exit"
 	gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
     } else {
-	gdb_test "cont" "Program exited normally\\..*" \
-		"continue to exit in langs.exp"
+	gdb_continue_off_end
     }
 }
 
diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp
index e562285..8f499e7 100644
--- a/gdb/testsuite/gdb.base/reread.exp
+++ b/gdb/testsuite/gdb.base/reread.exp
@@ -149,8 +149,7 @@ if [is_remote target] {
 
     # This time, let the program run to completion.  If GDB checks the
     # executable file's timestamp now, it won't notice any change.
-    gdb_test "continue" ".*Program exited.*" \
-            "second pass: continue to completion"
+    gdb_continue_off_end "continue" "second pass: continue to completion"
     
     # Now move the newer executable into place, and re-run.  GDB
     # should still notice that the executable file has changed,
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index f8601c7..230942d 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -182,12 +182,12 @@ if ![is_remote target] {
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"run to bp in shared library"
 
-  gdb_test "cont" ".*Program exited normally..*"
+  gdb_continue_off_end
 
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"re-run to bp in shared library (PR's 16495, 18213)"
 
-  gdb_test "cont" ".*Program exited normally..*"
+  gdb_continue_off_end
 }
 
 return 0
diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
index db9fd5c..8b4a233 100644
--- a/gdb/testsuite/gdb.base/siginfo.exp
+++ b/gdb/testsuite/gdb.base/siginfo.exp
@@ -83,7 +83,7 @@ gdb_test_multiple "step" "${test}" {
 	send_gdb "step\n"
 	exp_continue
     }
-    -re "Program exited normally.*${gdb_prompt} $" {
+    -re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
 	kfail gdb/1613 "$test (program exited)"
     }
     -re "(while ..done|return 0).*${gdb_prompt} $" {
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index 98e0e3d..ae33330 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -88,7 +88,7 @@ proc advance { i } {
 	    send_gdb "$i\n"
 	    exp_continue -continue_timer
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
 	    setup_kfail gdb/1639 powerpc-*-*bsd*
 	    fail "$test (program exited)"
 	}
@@ -144,7 +144,7 @@ proc advancei { i } {
 	-re "main .*${gdb_prompt} $" {
 	    fail "$test (in main)"
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
 	    fail "$test (program exited)"
 	    set program_exited 1
 	}
@@ -170,7 +170,7 @@ proc advancei { i } {
 	    send_gdb "y\n"
 	    exp_continue -continue_timer
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
 	    kfail gdb/1639 "$test (program exited)"
 	    set program_exited 1
 	}
diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
index 1c48812..6432e51 100644
--- a/gdb/testsuite/gdb.base/step-test.exp
+++ b/gdb/testsuite/gdb.base/step-test.exp
@@ -150,7 +150,7 @@ gdb_test_multiple "finish" "$test" {
     -re ".*${decimal}.*callee.*NEXTI.*$gdb_prompt $" {
 	pass "$test"
     }
-    -re ".*(Program received|Program exited).*$gdb_prompt $" {
+    -re ".*(Program received|Inferior exited).*$gdb_prompt $" {
 	# Oops... We ran to the end of the program...  Better reset     
 	if {![runto_main]} then {
 	    fail "$test (Can't run to main)"
diff --git a/gdb/testsuite/gdb.base/term.exp b/gdb/testsuite/gdb.base/term.exp
index 049a88b..aca1f58 100644
--- a/gdb/testsuite/gdb.base/term.exp
+++ b/gdb/testsuite/gdb.base/term.exp
@@ -47,7 +47,7 @@ gdb_test_no_output "set width 0"
 gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
 gdb_run_cmd 5
 gdb_expect {
-    -re ".*120.*Program exited normally.*$gdb_prompt $" {
+    -re ".*120.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	gdb_test "info terminal" "No saved terminal information.*" "test info terminal #2"
     }
     default {
diff --git a/gdb/testsuite/gdb.cell/fork.exp b/gdb/testsuite/gdb.cell/fork.exp
index 3fdfc25..b3d40d5 100644
--- a/gdb/testsuite/gdb.cell/fork.exp
+++ b/gdb/testsuite/gdb.cell/fork.exp
@@ -77,8 +77,7 @@ gdb_test_no_output "delete \$bpnum" "delete watchpoint"
 gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, func \\(\\) at .*$spu_file.c:.*" \
 	 "run until breakpoint hit"
 
-gdb_test "continue" "Continuing\\..*Program exited normally.*" \
-	 "run until end"
+gdb_continue_off_end
 
 gdb_exit
 
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index a48e2ea..390ff35 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -116,7 +116,7 @@ gdb_test_multiple "print a" "print class" {
 # `a.x is 1' is asynchronous regarding to `frames-invalid'.
 #
 gdb_test_multiple "continue" "continue until exit" {
-    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n.Inferior \[0-9\]+ exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
 	pass "continue until exit"
     }
 }
diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
index 17021fb..2744d17 100644
--- a/gdb/testsuite/gdb.cp/annota3.exp
+++ b/gdb/testsuite/gdb.cp/annota3.exp
@@ -122,8 +122,7 @@ gdb_expect_list "continue to exit" "$gdb_prompt$" {
     "\r\n\032\032starting\r\n"
     "a.x is 1\r\n"
     "\r\n\032\032exited 0\r\n"
-    "\r\n"
-    "Program exited normally.\r\n"
+    ".Inferior \[0-9\]+ exited normally.\r\n"
     "\r\n\032\032stopped\r\n"
 }
 
diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
index 46d7cc2..bd8ea63 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.exp
+++ b/gdb/testsuite/gdb.cp/mb-inline.exp
@@ -101,9 +101,7 @@ gdb_expect {
     }
 }
 
-gdb_test "continue" \
-    ".*Program exited normally.*" \
-    "continue with disabled breakpoint 1.2"
+gdb_continue_off_end "continue" "continue with disabled breakpoint 1.2"
 
 # Make sure we can set a breakpoint on a source statement that spans
 # multiple lines.
diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp
index 2f8f091..779918e 100644
--- a/gdb/testsuite/gdb.cp/mb-templates.exp
+++ b/gdb/testsuite/gdb.cp/mb-templates.exp
@@ -129,7 +129,7 @@ gdb_test_no_output "disable 1" "disable breakpoint: disable"
 
 gdb_run_cmd
 gdb_expect {
-    -re "Program exited normally.*$gdb_prompt $" {
+    -re "Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	pass "disable breakpoint: run to breakpoint"
     }
     -re "$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp
index 848a06d..ec000c7 100644
--- a/gdb/testsuite/gdb.cp/method.exp
+++ b/gdb/testsuite/gdb.cp/method.exp
@@ -175,10 +175,10 @@ gdb_test_multiple "ptype A" "ptype A" {
 }
 
 gdb_test_multiple "cont" "finish program" {
-    -re "Continuing.\r\n\r\nProgram exited normally.*$gdb_prompt $" {
+    -re "Continuing.\r\nInferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	pass "finish program"
     }
-    -re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" {
+    -re "Continuing.* EXIT code 0.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	pass "finish program (exit wrapper)" 
     }
 }
diff --git a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
index 497f7de..6be6d44 100644
--- a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
+++ b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
@@ -132,7 +132,7 @@ gdb_expect {
     -re ".*solib-d1.*$gdb_prompt $" {
         pass "Catch implicit load at startup"
     }
-    -re "Program exited.*$gdb_prompt $" {
+    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
         fail "CLLbs14756 || CLLbs16090 came back ???"
     }
     timeout { fail "(timeout) implicit library load" }
@@ -228,7 +228,7 @@ gdb_expect {
     -re "Stopped due to shared library event.*$gdb_prompt $" {
         pass "stop for shlib event"
     }
-    -re "Program exited.*$gdb_prompt $" {
+    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
         fail "Bug CLLbs16090 came back ?"
     }
     timeout { fail "(timeout) stop for shlib event " }
diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
index f743825..566ae26 100644
--- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
+++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
@@ -130,10 +130,10 @@ for {set filenum 0} {$filenum < 2} {incr filenum 1} {
         gdb_test "s 1" ".*25.*"
         if [istarget "hppa64-*-*"] {
             gdb_test "s 1" "0x\[0-9a-f\]+ in .*"
-            gdb_test "c" ".*Program exited normally.*"
+	    gdb_continue_off_end
         } else {
             gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
-            gdb_test "s 1" ".*Program exited normally.*"
+            gdb_continue_off_end "s 1"
         }
     }
 
diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
index c336498..4c197f5 100644
--- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
+++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
@@ -78,9 +78,9 @@ gdb_test "s 1" "main .*/x1.cc:15.*"
 gdb_test "s 1" ".*16.*"
 if [istarget "hppa64-*-*"] {
     gdb_test "s 1" "0x\[0-9a-f\]+ in .*START.*"
-    gdb_test "c" ".*Program exited normally.*"
+    gdb_continue_off_end
 } else {
     gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
-    gdb_test "s 1" ".*Program exited normally.*"
+    gdb_continue_off_end "s 1"
 }
 
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 81de5a2..89c8791 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -105,7 +105,7 @@ proc run_lang_tests {lang} {
     gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \
 	"print nstype on one line"
 
-    gdb_test "continue" "Program exited normally\."
+    gdb_continue_off_end
 
     remote_file host delete ${remote_python_file}
 }
diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
index 863c7cf..c2322ac 100644
--- a/gdb/testsuite/gdb.threads/execl.exp
+++ b/gdb/testsuite/gdb.threads/execl.exp
@@ -71,5 +71,4 @@ gdb_test_multiple "info threads" "$test" {
     }
 }
 
-gdb_test "continue" ".*Program exited normally\\." \
-    "continue to end"
+gdb_continue_off_end
diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
index cb0bc3d..e41326b 100644
--- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
+++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
@@ -86,7 +86,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_off_end
 
 return 0
diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp
index d221fbd..c715cc7 100644
--- a/gdb/testsuite/gdb.threads/print-threads.exp
+++ b/gdb/testsuite/gdb.threads/print-threads.exp
@@ -80,7 +80,7 @@ proc test_all_threads { name kill } {
 	    send_gdb "continue\n"
 	    exp_continue
 	}
-	-re "Program exited normally\\.\[\r\n\]+$gdb_prompt" {
+	-re "Inferior \[0-9\]+ exited normally.\[\r\n\]+$gdb_prompt" {
 	    pass "program exited normally"
 	    if {$i == 5} {
 		pass "all threads ran once ($name)"
diff --git a/gdb/testsuite/gdb.threads/step.exp b/gdb/testsuite/gdb.threads/step.exp
index c051196..20a4def 100644
--- a/gdb/testsuite/gdb.threads/step.exp
+++ b/gdb/testsuite/gdb.threads/step.exp
@@ -62,7 +62,7 @@ proc step_it { cmd } {
     gdb_expect {
 	-re "0x\[0-9A-Fa-f\]* *in.*\r\n$gdb_prompt $" { pass "step_it"; return 0 }
 	-re "0x\[0-9A-Fa-f\]* *\[0-9\]*.*\r\n$gdb_prompt $" { pass "step_it"; return 1 }
-	-re "Program exited .*\n$gdb_prompt $" {
+	-re "Inferior \[0-9\]+ exited .*\n$gdb_prompt $" {
 		set program_exited 1
 		return -1
 	    }
@@ -88,7 +88,7 @@ proc continue_all {} {
 	    pass "continue_all"
 	    return 0
 	}
-	-re "Program exited .*\n$gdb_prompt $" {
+	-re "Inferior \[0-9\]+ exited .*\n$gdb_prompt $" {
 	    set program_exited 1
 	    return 1;
 	}
diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
index 6faabf5..232258e 100644
--- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
+++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
@@ -110,7 +110,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_off_end
 
 return 0
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index 0e63120..ff294ff 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -177,7 +177,7 @@ gdb_expect {
         unsupported "continue to first thread: system does not support TLS"
         return -1
     }
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
         fail "continue to first thread: program runaway"
     }
     -re ".*Pass 0 done.*Pass 1 done.*$gdb_prompt $" {
diff --git a/gdb/testsuite/lib/cell.exp b/gdb/testsuite/lib/cell.exp
index 4cc7ee0..86f77b2 100644
--- a/gdb/testsuite/lib/cell.exp
+++ b/gdb/testsuite/lib/cell.exp
@@ -136,11 +136,11 @@ proc skip_cell_tests {} {
     gdb_load "$exe"
     gdb_run_cmd
     gdb_expect {
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
             verbose -log "\n$me: Cell/B.E. hardware detected"
             set skip_cell_tests_saved 0
         }
-        -re ".*Program exited with code.*${gdb_prompt} $" {
+        -re ".*Inferior \[0-9\]+ exited with code.*${gdb_prompt} $" {
             verbose -log "\n$me: Cell/B.E. hardware not detected"
             set skip_cell_tests_saved 1
         }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 44d449a..91ddad5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -572,7 +572,7 @@ proc gdb_internal_error_resync {} {
 #    }
 # }
 #
-# The standard patterns, such as "Program exited..." and "A problem
+# The standard patterns, such as "Inferior exited..." and "A problem
 # ...", all being implicitly appended to that list.
 #
 proc gdb_test_multiple { command message user_code } {
@@ -755,7 +755,7 @@ proc gdb_test_multiple { command message user_code } {
             fail "$message"
 	    set result 1
 	}
-	 -re "Program exited with code \[0-9\]+.*$gdb_prompt $" {
+	 -re "Inferior \[0-9\]+ exited with code \[0-9\]+.*$gdb_prompt $" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
@@ -764,7 +764,7 @@ proc gdb_test_multiple { command message user_code } {
 	    fail "$errmsg"
 	    set result -1
 	}
-	 -re "Program exited normally.*$gdb_prompt $" {
+	 -re "Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
@@ -1640,7 +1640,7 @@ proc skip_altivec_tests {} {
             verbose -log "\n$me altivec hardware not detected" 
             set skip_vmx_tests_saved 1
         }
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
             verbose -log "\n$me: altivec hardware detected" 
             set skip_vmx_tests_saved 0
         }
@@ -1727,7 +1727,7 @@ proc skip_vsx_tests {} {
             verbose -log "\n$me VSX hardware not detected"
             set skip_vsx_tests_saved 1
         }
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
             verbose -log "\n$me: VSX hardware detected"
             set skip_vsx_tests_saved 0
         }
@@ -3069,11 +3069,18 @@ proc gdb_continue_to_end {mssg} {
     # Don't bother to check the output of the program, that may be
     # extremely tough for some remote systems.
     gdb_test "continue"\
-      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|Program exited normally\\.).*"\
+      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|Inferior \[0-9\]+ exited normally).*"\
       "continue until exit at $mssg"
   }
 }
 
+# Invoke COMMAND, by default "continue", and expect GDB to exit
+# normally.  TESTNAME is an optional test name.
+proc gdb_continue_off_end {{command continue}
+			   {testname "continue to program exit"}} {
+    gdb_test $command "Inferior \[0-9\]+ exited normally." $testname
+}
+
 proc rerun_to_main {} {
   global gdb_prompt
 
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 6b25f69..8d30a9f 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -698,7 +698,7 @@ proc mi_gdb_test { args } {
             fail "$message"
 	    set result 1
 	}
-	 -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
+	 -re "Inferior \[0-9\]+ exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
diff --git a/gdb/testsuite/lib/opencl.exp b/gdb/testsuite/lib/opencl.exp
index c1b5291..b722ba3 100644
--- a/gdb/testsuite/lib/opencl.exp
+++ b/gdb/testsuite/lib/opencl.exp
@@ -59,11 +59,11 @@ proc skip_opencl_tests {} {
     clean_restart "$executable"
     gdb_run_cmd
     gdb_expect 30 {
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
             verbose -log "\n$me: OpenCL support detected"
             set skip_opencl_tests_saved($board) 0
         }
-        -re ".*Program exited with code.*${gdb_prompt} $" {
+        -re ".*Inferior \[0-9\]+ exited code.*${gdb_prompt} $" {
             verbose -log "\n$me: OpenCL support not detected"
             set skip_opencl_tests_saved($board) 1
         }

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

* Re: RFC: change "program exited" message
  2011-03-03 20:52 RFC: change "program exited" message Tom Tromey
@ 2011-03-03 21:18 ` Michael Snyder
  2011-03-03 21:20 ` Pedro Alves
  2011-03-04  9:12 ` RFC: change "program exited" message Mark Kettenis
  2 siblings, 0 replies; 20+ messages in thread
From: Michael Snyder @ 2011-03-03 21:18 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

Tom Tromey wrote:
> I would appreciate comments on this patch.
> In the absence of comments I will check it in.
> 
> If you do multi-inferior debugging, you can wind up with output like
> (actual cut-and-paste):
> 
>     [New process 24959]
>     [New process 24960]
> 
>     Program exited with code 0177.
> 
>     Program exited with code 0177.
>     [New process 24961]
>     [New process 24962]
> 
>     Program exited normally.
> 
>     Program exited normally.
> 
> It is hard to see what is going on, because the PID is not reported in
> the exit message.
> 
> This patch changes GDB to print:
> 
>     [Inferior 25036 exited normally]

Can I suggest "Process 25036"?

> 
> Most of the work was updating the test suite and writing the ChangeLog.
> 
> Built and regtested on x86-64 (compile farm).
> 
> Tom
> 
> 2011-03-03  Tom Tromey  <tromey@redhat.com>
> 
>         * infrun.c (print_exited_reason): Include inferior PID in
>         message.
> 
> 2011-03-03  Tom Tromey  <tromey@redhat.com>
> 
>         * lib/opencl.exp (skip_opencl_tests): Update for exit message
>         change.
>         * lib/mi-support.exp (mi_gdb_test): Update for exit message
>         change.
>         * lib/gdb.exp (gdb_test_multiple): Update comment.  Update for
>         exit message change.
>         (skip_altivec_tests): Update for exit message change.
>         (skip_vsx_tests): Likewise.
>         (gdb_continue_to_end): Likewise.
>         (gdb_continue_off_end): New proc.
>         * lib/cell.exp (skip_cell_tests): Update for exit message change.
>         * gdb.threads/tls.exp: Update for exit message change.
>         * gdb.threads/thread-unwindonsignal.exp: Use
>         gdb_continue_off_end.
>         * gdb.threads/step.exp (step_it): Update for exit message change.
>         (continue_all): Likewise.
>         * gdb.threads/print-threads.exp (test_all_threads): Update for
>         exit message change.
>         * gdb.threads/interrupted-hand-call.exp: Use
>         gdb_continue_off_end.
>         * gdb.threads/execl.exp: Use gdb_continue_off_end.
>         * gdb.python/py-prettyprint.exp (run_lang_tests): Use
>         gdb_continue_off_end.
>         * gdb.hp/gdb.objdbg/objdbg02.exp: Use gdb_continue_off_end.
>         * gdb.hp/gdb.objdbg/objdbg01.exp: Use gdb_continue_off_end.
>         * gdb.hp/gdb.defects/solib-d.exp: Update for exit message change.
>         * gdb.cp/method.exp: Update for exit message change.
>         * gdb.cp/mb-templates.exp: Update for exit message change.
>         * gdb.cp/mb-inline.exp: Use gdb_continue_off_end.
>         * gdb.cp/annota3.exp: Update for exit message change.
>         * gdb.cp/annota2.exp: Update for exit message change.
>         * gdb.cell/fork.exp: Use gdb_continue_off_end.
>         * gdb.base/term.exp: Update for exit message change.
>         * gdb.base/step-test.exp (test_i): Update for exit message change.
>         * gdb.base/sigstep.exp (advance): Update for exit message change.
>         (advancei): Likewise.
>         * gdb.base/siginfo.exp: Update for exit message change.
>         * gdb.base/shlib-call.exp: Use gdb_continue_off_end.
>         * gdb.base/reread.exp: Use gdb_continue_off_end.
>         * gdb.base/langs.exp: Use gdb_continue_off_end.
>         * gdb.base/interrupt.exp: Update for exit message change.
>         * gdb.base/gdb1555.exp: Update for exit message change.
>         * gdb.base/exe-lock.exp: Use gdb_continue_off_end.
>         * gdb.base/ending-run.exp: Update for exit message change.
>         * gdb.base/chng-syms.exp: Update for exit message change.
>         * gdb.base/checkpoint.exp: Update for exit message change.
>         * gdb.base/catch-syscall.exp (check_for_program_end): Use
>         gdb_continue_off_end.
>         (test_catch_syscall_with_wrong_args): Likewise.
>         * gdb.base/call-signal-resume.exp: Use gdb_continue_off_end.
>         * gdb.base/break-interp.exp (test_ld): Update for exit message
>         change.
>         * gdb.base/bang.exp: Update for exit message change.
>         * gdb.base/attach.exp (do_attach_tests): Use gdb_continue_off_end.
>         (do_call_attach_tests): Likewise.
>         * gdb.base/a2-run.exp: Update for exit message change.
>         * gdb.arch/ppc-dfp.exp: Update for exit message change.
>         * gdb.ada/tasks.exp: Use gdb_continue_off_end.
>         * gdb.ada/catch_ex.exp: Use gdb_continue_off_end.
> 
> 
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index 274082d..09569af 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -5488,22 +5488,28 @@ print_signal_exited_reason (enum target_signal siggnal)
>  static void
>  print_exited_reason (int exitstatus)
>  {
> +  struct inferior *inf = current_inferior ();
> +
>    annotate_exited (exitstatus);
>    if (exitstatus)
>      {
>        if (ui_out_is_mi_like_p (uiout))
>         ui_out_field_string (uiout, "reason",
>                              async_reason_lookup (EXEC_ASYNC_EXITED));
> -      ui_out_text (uiout, "\nProgram exited with code ");
> +      ui_out_text (uiout, "[Inferior ");
> +      ui_out_text (uiout, plongest (inf->pid));
> +      ui_out_text (uiout, " exited with code ");
>        ui_out_field_fmt (uiout, "exit-code", "0%o", (unsigned int) exitstatus);
> -      ui_out_text (uiout, ".\n");
> +      ui_out_text (uiout, "]\n");
>      }
>    else
>      {
>        if (ui_out_is_mi_like_p (uiout))
>         ui_out_field_string
>           (uiout, "reason", async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
> -      ui_out_text (uiout, "\nProgram exited normally.\n");
> +      ui_out_text (uiout, "[Inferior ");
> +      ui_out_text (uiout, plongest (inf->pid));
> +      ui_out_text (uiout, " exited normally]\n");
>      }
>    /* Support the --return-child-result option.  */
>    return_child_result_value = exitstatus;
> diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
> index b0a4000..d692aca 100644
> --- a/gdb/testsuite/gdb.ada/catch_ex.exp
> +++ b/gdb/testsuite/gdb.ada/catch_ex.exp
> @@ -141,8 +141,6 @@ gdb_test "continue" \
>           "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
>           "continuing to unhandled exception"
> 
> -gdb_test "continue" \
> -         "Continuing\..*Program exited.*" \
> -         "continuing to program completion"
> +gdb_continue_off_end "continue" "continuing to program completion"
> 
> 
> diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp
> index bced9f8..166f18c 100644
> --- a/gdb/testsuite/gdb.ada/tasks.exp
> +++ b/gdb/testsuite/gdb.ada/tasks.exp
> @@ -70,7 +70,5 @@ gdb_test "info tasks" \
>  # Now, resume the execution and make sure that GDB does not stop when
>  # task 4 hits the breakpoint. Continuing thus results in our program
>  # running to completion.
> -gdb_test "continue" \
> -         ".*Program exited normally\..*" \
> -         "continue until end of program"
> +gdb_continue_off_end "continue" "continue until end of program"
> 
> diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
> index 10fbd3c..3a57b10 100644
> --- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
> +++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
> @@ -59,7 +59,7 @@ gdb_run_cmd
>  # When the prompt comes back we'll be at the Set DFP rounding mode breakpoint.
>  # Unless the program bails out after checking AT_HWCAP.
>  gdb_expect {
> -  -re "Program exited with code 01.\[\r\n\]+$gdb_prompt $" {
> +  -re "Inferior \[0-9\]+ exited with code 01.\[\r\n\]+$gdb_prompt $" {
>      unsupported "This machine doesn't support Decimal Floating Point."
>      return -1
>    }
> diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
> index d26a202..fbbf7a4 100644
> --- a/gdb/testsuite/gdb.base/a2-run.exp
> +++ b/gdb/testsuite/gdb.base/a2-run.exp
> @@ -42,7 +42,7 @@ if [istarget "*-*-vxworks*"] then {
>      set timeout 120
>      verbose "Timeout is now $timeout seconds" 2
>      gdb_expect {
> -        "Program exited normally" {
> +        "Inferior \[0-9\]+ exited normally" {
>             unresolved "run \"$testfile\" with no args"
>         }
>          -re "usage:  factorial <number>" {
> @@ -57,19 +57,19 @@ if [istarget "*-*-vxworks*"] then {
>      gdb_expect -re "$gdb_prompt $" {}
>  } else {
>      gdb_expect {
> -       -re ".*usage:  factorial <number>.*Program exited with code 01\.\r\n$gdb_prompt $" {
> +       -re ".*usage:  factorial <number>.*Inferior \[0-9\]+ exited with code 01.\r\n$gdb_prompt $" {
>             pass "run \"$testfile\" with no args"
>             pass "no spurious messages at program exit"
>         }
> -       -re ".*usage:  factorial <number>.*Program exited with code 01.*$gdb_prompt $" {
> +       -re ".*usage:  factorial <number>.*Inferior \[0-9\]+ exited with code 01.*$gdb_prompt $" {
>             pass "run \"$testfile\" with no args"
>             fail "no spurious messages at program exit"
>         }
> -       -re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally\.\r\n$gdb_prompt $" {
> +       -re ".*usage:  factorial <number>.* EXIT code 1.*Inferior \[0-9\]+ exited normally.\r\n$gdb_prompt $" {
>             pass "run \"$testfile\" with no args (exit wrapper)"
>             pass "no spurious messages at program exit"
>         }
> -       -re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally.*$gdb_prompt $" {
> +       -re ".*usage:  factorial <number>.* EXIT code 1.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>             pass "run \"$testfile\" with no args (exit wrapper)"
>             fail "no spurious messages at program exit"
>         }
> @@ -97,7 +97,7 @@ if [istarget "*-*-vxworks*"] then {
>      set timeout 120
>      verbose "Timeout is now $timeout seconds" 2
>      gdb_expect {
> -        "Program exited normally" {
> +        "Inferior \[0-9\]+ exited normally" {
>             unresolved "run \"$testfile\" with arg"
>         }
>          "120" {
> @@ -129,7 +129,7 @@ if [istarget "*-*-vxworks*"] then {
>      set timeout 120
>      verbose "Timeout is now $timeout seconds" 2
>      gdb_expect {
> -        "Program exited normally" {
> +        "Inferior \[0-9\]+ exited normally" {
>             unresolved "run \"$testfile\" again with same args"
>         }
>          "120" { pass "run \"$testfile\" again with same args" }
> @@ -161,7 +161,7 @@ if [istarget "*-*-vxworks*"] then {
>      set timeout 120
>      verbose "Timeout is now $timeout seconds" 2
>      gdb_expect {
> -        "Program exited normally" {
> +        "Inferior \[0-9\]+ exited normally" {
>             unresolved "run after setting args to nil"
>         }
>          "usage:  factorial <number>" {
> @@ -202,7 +202,7 @@ if [istarget "*-*-vxworks*"] then {
>      set timeout 120
>      verbose "Timeout is now $timeout seconds" 2
>      gdb_expect {
> -        "Program exited normally" {
> +        "Inferior \[0-9\]+ exited normally" {
>             unresolved "run \"$testfile\" again after setting args"
>         }
>          "720" {
> diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
> index 78df003..10656c0 100644
> --- a/gdb/testsuite/gdb.base/attach.exp
> +++ b/gdb/testsuite/gdb.base/attach.exp
> @@ -258,7 +258,7 @@ proc do_attach_tests {} {
> 
>      # Allow the test process to exit, to cleanup after ourselves.
> 
> -    gdb_test "continue" "Program exited normally." "after attach2, exit"
> +    gdb_continue_off_end "continue" "after attach2, exit"
> 
>      # Make sure we don't leave a process around to confuse
>      # the next test run (and prevent the compile by keeping
> @@ -365,7 +365,7 @@ proc do_call_attach_tests {} {
>      # Get rid of the process
> 
>      gdb_test "p should_exit = 1"
> -    gdb_test "c" "Program exited normally."
> +    gdb_continue_off_end
> 
>      # Be paranoid
> 
> diff --git a/gdb/testsuite/gdb.base/bang.exp b/gdb/testsuite/gdb.base/bang.exp
> index efe2295..cf953a1 100644
> --- a/gdb/testsuite/gdb.base/bang.exp
> +++ b/gdb/testsuite/gdb.base/bang.exp
> @@ -39,7 +39,7 @@ gdb_load ${binfile}
> 
>  gdb_run_cmd
>  gdb_expect {
> -    -re ".*Program exited normally.*$gdb_prompt $" {
> +    -re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>          pass "run program"
>      }
>      timeout {
> diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
> index 3df4dcb..fd1a768 100644
> --- a/gdb/testsuite/gdb.base/break-interp.exp
> +++ b/gdb/testsuite/gdb.base/break-interp.exp
> @@ -494,7 +494,7 @@ proc test_ld {file ifmain trynosym displacement} {
>                 }
>                 exp_continue
>             }
> -           -re "Program exited (normally|with code \[0-9\]+)\\.\r\n$gdb_prompt $" {
> +           -re "Inferior \[0-9\]+ exited (normally|with code \[0-9\]+).\r\n$gdb_prompt $" {
>                 # Do not check the binary filename as it may be truncated.
>                 pass $test
>             }
> diff --git a/gdb/testsuite/gdb.base/call-signal-resume.exp b/gdb/testsuite/gdb.base/call-signal-resume.exp
> index b85691c..c9b2176 100644
> --- a/gdb/testsuite/gdb.base/call-signal-resume.exp
> +++ b/gdb/testsuite/gdb.base/call-signal-resume.exp
> @@ -146,7 +146,6 @@ gdb_test "continue" "Breakpoint \[0-9\]*, handle_signal.*" \
> 
>  # Continue one last time, the program should exit normally.
> 
> -gdb_test "continue" "Program exited normally." \
> -    "continue to program exit"
> +gdb_continue_off_end
> 
>  return 0
> diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
> index d25df17..a8a5d54 100644
> --- a/gdb/testsuite/gdb.base/catch-syscall.exp
> +++ b/gdb/testsuite/gdb.base/catch-syscall.exp
> @@ -167,7 +167,7 @@ proc check_for_program_end {} {
>      delete_breakpoints
> 
>      set thistest "successful program end"
> -    gdb_test "continue" "Program exited normally.*" $thistest
> +    gdb_continue_off_end continue $thistest
> 
>  }
> 
> @@ -231,7 +231,7 @@ proc test_catch_syscall_with_wrong_args {} {
>      # If it doesn't, everything is right (since we don't have
>      # a syscall named "mlock" in it).  Otherwise, this is a failure.
>      set thistest "catch syscall with unused syscall ($syscall_name)"
> -    gdb_test "continue" "Program exited normally.*" $thistest
> +    gdb_continue_off_end "continue" $thistest
>  }
> 
>  proc test_catch_syscall_restarting_inferior {} {
> diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
> index f34b0d1..6f15fa9 100644
> --- a/gdb/testsuite/gdb.base/checkpoint.exp
> +++ b/gdb/testsuite/gdb.base/checkpoint.exp
> @@ -277,23 +277,23 @@ gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 10"
> 
>  delete_breakpoints
>  gdb_test "continue" \
> -    "Deleting copy.*Program exited normally.*Switching to.*" \
> +    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
>      "Exit, dropped into next fork one"
> 
>  gdb_test "continue" \
> -    "Deleting copy.*Program exited normally.*Switching to.*" \
> +    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
>      "Exit, dropped into next fork two"
> 
>  gdb_test "continue" \
> -    "Deleting copy.*Program exited normally.*Switching to.*" \
> +    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
>      "Exit, dropped into next fork three"
> 
>  gdb_test "continue" \
> -    "Deleting copy.*Program exited normally.*Switching to.*" \
> +    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
>      "Exit, dropped into next fork four"
> 
>  gdb_test "continue" \
> -    "Deleting copy.*Program exited normally.*Switching to.*" \
> +    "Deleting copy.*Inferior \[0-9\]+ exited normally.*Switching to.*" \
>      "Exit, dropped into next fork five"
> 
>  #
> diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp
> index d2567e7..aca075e 100644
> --- a/gdb/testsuite/gdb.base/chng-syms.exp
> +++ b/gdb/testsuite/gdb.base/chng-syms.exp
> @@ -100,7 +100,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
> 
>      gdb_run_cmd
>      gdb_expect {
> -       -re ".*Program exited normally.*$gdb_prompt $" {
> +       -re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>             pass "running with invalidated bpt condition after executable changes"
>         }
>         -re ".*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
> diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
> index 43c46f8..782c206 100644
> --- a/gdb/testsuite/gdb.base/ending-run.exp
> +++ b/gdb/testsuite/gdb.base/ending-run.exp
> @@ -146,7 +146,7 @@ gdb_test_multiple "next" "step out of main" {
>         # This is what happens on mingw32ce.
>         pass "step out of main"
>      }
> -    -re ".*Program exited normally.*$gdb_prompt $" {
> +    -re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>         # This is what happens on Linux i86 (and I would expect others)
>         set program_exited 1
>         pass "step out of main"
> @@ -209,21 +209,21 @@ if {! [target_info exists use_gdb_stub]
>      global program_exited;
>      if {[eval expr $program_exited == 0]} {
>         gdb_test_multiple "n" "step to end of run" {
> -           -re "Program exited normally.*$gdb_prompt $" {
> +           -re "Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>                 # If we actually have debug info for the start function,
>                 # then we won't get the "Single-stepping until function
>                 # exit" message.
>                 pass "step to end of run"
>                 set program_exited_normally 1
>             }
> -           -re "Single.*EXIT code 0\r\n.*Program exited normally.*$gdb_prompt $" {
> +           -re "Single.*EXIT code 0\r\n.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>                 pass "step to end of run (status wrapper)"
>                 set program_exited_normally 1
>             }
>             -re "Single.*EXIT code 0\r\n.*$gdb_prompt $" {
>                 pass "step to end of run (status wrapper)"
>             }
> -           -re ".*Single.*Program exited.*$gdb_prompt $" {
> +           -re ".*Single.*Inferior \[0-9\]+ exited.*$gdb_prompt $" {
>                 pass "step to end of run"
>                 set program_exited_normally 1
>             }
> diff --git a/gdb/testsuite/gdb.base/exe-lock.exp b/gdb/testsuite/gdb.base/exe-lock.exp
> index e4bbbbe..011b9d2 100644
> --- a/gdb/testsuite/gdb.base/exe-lock.exp
> +++ b/gdb/testsuite/gdb.base/exe-lock.exp
> @@ -50,9 +50,7 @@ if ![runto_main] then {
>      continue
>  }
> 
> -gdb_test "continue" \
> -         ".*Program exited normally\\." \
> -         "continue until program exits"
> +gdb_continue_off_end
> 
>  # Try deleting the executable file, now that the program has exited,
>  # and make sure that the deletion worked by verifying that the exe
> diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp
> index 8c3e8ba..21891f8 100644
> --- a/gdb/testsuite/gdb.base/gdb1555.exp
> +++ b/gdb/testsuite/gdb.base/gdb1555.exp
> @@ -77,7 +77,7 @@ gdb_test_multiple "n" $name \
>      -re "\[0-9\]+.*return a;.*$gdb_prompt $" {
>         pass $name
>      }
> -    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" {
> +    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nInferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>         kfail "gdb/1555" $name
>      }
>  }
> diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
> index cce7fca..aabc316 100644
> --- a/gdb/testsuite/gdb.base/interrupt.exp
> +++ b/gdb/testsuite/gdb.base/interrupt.exp
> @@ -201,7 +201,7 @@ if ![file exists $binfile] then {
> 
>         send_gdb "\004"
>         gdb_expect {
> -           -re "end of file.*Program exited normally.*$gdb_prompt $" {
> +           -re "end of file.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>                 pass "send end of file"
>             }
>             -re "$gdb_prompt $" { fail "send end of file" }
> diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
> index a42f2d8..e3c3847 100644
> --- a/gdb/testsuite/gdb.base/langs.exp
> +++ b/gdb/testsuite/gdb.base/langs.exp
> @@ -146,8 +146,7 @@ if [runto csub] then {
>         gdb_breakpoint "exit"
>         gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
>      } else {
> -       gdb_test "cont" "Program exited normally\\..*" \
> -               "continue to exit in langs.exp"
> +       gdb_continue_off_end
>      }
>  }
> 
> diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp
> index e562285..8f499e7 100644
> --- a/gdb/testsuite/gdb.base/reread.exp
> +++ b/gdb/testsuite/gdb.base/reread.exp
> @@ -149,8 +149,7 @@ if [is_remote target] {
> 
>      # This time, let the program run to completion.  If GDB checks the
>      # executable file's timestamp now, it won't notice any change.
> -    gdb_test "continue" ".*Program exited.*" \
> -            "second pass: continue to completion"
> +    gdb_continue_off_end "continue" "second pass: continue to completion"
> 
>      # Now move the newer executable into place, and re-run.  GDB
>      # should still notice that the executable file has changed,
> diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
> index f8601c7..230942d 100644
> --- a/gdb/testsuite/gdb.base/shlib-call.exp
> +++ b/gdb/testsuite/gdb.base/shlib-call.exp
> @@ -182,12 +182,12 @@ if ![is_remote target] {
>    gdb_test "run" "Starting program:.*Breakpoint .,.*" \
>         "run to bp in shared library"
> 
> -  gdb_test "cont" ".*Program exited normally..*"
> +  gdb_continue_off_end
> 
>    gdb_test "run" "Starting program:.*Breakpoint .,.*" \
>         "re-run to bp in shared library (PR's 16495, 18213)"
> 
> -  gdb_test "cont" ".*Program exited normally..*"
> +  gdb_continue_off_end
>  }
> 
>  return 0
> diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
> index db9fd5c..8b4a233 100644
> --- a/gdb/testsuite/gdb.base/siginfo.exp
> +++ b/gdb/testsuite/gdb.base/siginfo.exp
> @@ -83,7 +83,7 @@ gdb_test_multiple "step" "${test}" {
>         send_gdb "step\n"
>         exp_continue
>      }
> -    -re "Program exited normally.*${gdb_prompt} $" {
> +    -re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>         kfail gdb/1613 "$test (program exited)"
>      }
>      -re "(while ..done|return 0).*${gdb_prompt} $" {
> diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
> index 98e0e3d..ae33330 100644
> --- a/gdb/testsuite/gdb.base/sigstep.exp
> +++ b/gdb/testsuite/gdb.base/sigstep.exp
> @@ -88,7 +88,7 @@ proc advance { i } {
>             send_gdb "$i\n"
>             exp_continue -continue_timer
>         }
> -       -re "Program exited normally.*${gdb_prompt} $" {
> +       -re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>             setup_kfail gdb/1639 powerpc-*-*bsd*
>             fail "$test (program exited)"
>         }
> @@ -144,7 +144,7 @@ proc advancei { i } {
>         -re "main .*${gdb_prompt} $" {
>             fail "$test (in main)"
>         }
> -       -re "Program exited normally.*${gdb_prompt} $" {
> +       -re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>             fail "$test (program exited)"
>             set program_exited 1
>         }
> @@ -170,7 +170,7 @@ proc advancei { i } {
>             send_gdb "y\n"
>             exp_continue -continue_timer
>         }
> -       -re "Program exited normally.*${gdb_prompt} $" {
> +       -re "Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>             kfail gdb/1639 "$test (program exited)"
>             set program_exited 1
>         }
> diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
> index 1c48812..6432e51 100644
> --- a/gdb/testsuite/gdb.base/step-test.exp
> +++ b/gdb/testsuite/gdb.base/step-test.exp
> @@ -150,7 +150,7 @@ gdb_test_multiple "finish" "$test" {
>      -re ".*${decimal}.*callee.*NEXTI.*$gdb_prompt $" {
>         pass "$test"
>      }
> -    -re ".*(Program received|Program exited).*$gdb_prompt $" {
> +    -re ".*(Program received|Inferior exited).*$gdb_prompt $" {
>         # Oops... We ran to the end of the program...  Better reset
>         if {![runto_main]} then {
>             fail "$test (Can't run to main)"
> diff --git a/gdb/testsuite/gdb.base/term.exp b/gdb/testsuite/gdb.base/term.exp
> index 049a88b..aca1f58 100644
> --- a/gdb/testsuite/gdb.base/term.exp
> +++ b/gdb/testsuite/gdb.base/term.exp
> @@ -47,7 +47,7 @@ gdb_test_no_output "set width 0"
>  gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
>  gdb_run_cmd 5
>  gdb_expect {
> -    -re ".*120.*Program exited normally.*$gdb_prompt $" {
> +    -re ".*120.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>         gdb_test "info terminal" "No saved terminal information.*" "test info terminal #2"
>      }
>      default {
> diff --git a/gdb/testsuite/gdb.cell/fork.exp b/gdb/testsuite/gdb.cell/fork.exp
> index 3fdfc25..b3d40d5 100644
> --- a/gdb/testsuite/gdb.cell/fork.exp
> +++ b/gdb/testsuite/gdb.cell/fork.exp
> @@ -77,8 +77,7 @@ gdb_test_no_output "delete \$bpnum" "delete watchpoint"
>  gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, func \\(\\) at .*$spu_file.c:.*" \
>          "run until breakpoint hit"
> 
> -gdb_test "continue" "Continuing\\..*Program exited normally.*" \
> -        "run until end"
> +gdb_continue_off_end
> 
>  gdb_exit
> 
> diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
> index a48e2ea..390ff35 100644
> --- a/gdb/testsuite/gdb.cp/annota2.exp
> +++ b/gdb/testsuite/gdb.cp/annota2.exp
> @@ -116,7 +116,7 @@ gdb_test_multiple "print a" "print class" {
>  # `a.x is 1' is asynchronous regarding to `frames-invalid'.
>  #
>  gdb_test_multiple "continue" "continue until exit" {
> -    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
> +    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n.Inferior \[0-9\]+ exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
>         pass "continue until exit"
>      }
>  }
> diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
> index 17021fb..2744d17 100644
> --- a/gdb/testsuite/gdb.cp/annota3.exp
> +++ b/gdb/testsuite/gdb.cp/annota3.exp
> @@ -122,8 +122,7 @@ gdb_expect_list "continue to exit" "$gdb_prompt$" {
>      "\r\n\032\032starting\r\n"
>      "a.x is 1\r\n"
>      "\r\n\032\032exited 0\r\n"
> -    "\r\n"
> -    "Program exited normally.\r\n"
> +    ".Inferior \[0-9\]+ exited normally.\r\n"
>      "\r\n\032\032stopped\r\n"
>  }
> 
> diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
> index 46d7cc2..bd8ea63 100644
> --- a/gdb/testsuite/gdb.cp/mb-inline.exp
> +++ b/gdb/testsuite/gdb.cp/mb-inline.exp
> @@ -101,9 +101,7 @@ gdb_expect {
>      }
>  }
> 
> -gdb_test "continue" \
> -    ".*Program exited normally.*" \
> -    "continue with disabled breakpoint 1.2"
> +gdb_continue_off_end "continue" "continue with disabled breakpoint 1.2"
> 
>  # Make sure we can set a breakpoint on a source statement that spans
>  # multiple lines.
> diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp
> index 2f8f091..779918e 100644
> --- a/gdb/testsuite/gdb.cp/mb-templates.exp
> +++ b/gdb/testsuite/gdb.cp/mb-templates.exp
> @@ -129,7 +129,7 @@ gdb_test_no_output "disable 1" "disable breakpoint: disable"
> 
>  gdb_run_cmd
>  gdb_expect {
> -    -re "Program exited normally.*$gdb_prompt $" {
> +    -re "Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>         pass "disable breakpoint: run to breakpoint"
>      }
>      -re "$gdb_prompt $" {
> diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp
> index 848a06d..ec000c7 100644
> --- a/gdb/testsuite/gdb.cp/method.exp
> +++ b/gdb/testsuite/gdb.cp/method.exp
> @@ -175,10 +175,10 @@ gdb_test_multiple "ptype A" "ptype A" {
>  }
> 
>  gdb_test_multiple "cont" "finish program" {
> -    -re "Continuing.\r\n\r\nProgram exited normally.*$gdb_prompt $" {
> +    -re "Continuing.\r\nInferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>         pass "finish program"
>      }
> -    -re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" {
> +    -re "Continuing.* EXIT code 0.*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>         pass "finish program (exit wrapper)"
>      }
>  }
> diff --git a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
> index 497f7de..6be6d44 100644
> --- a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
> +++ b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
> @@ -132,7 +132,7 @@ gdb_expect {
>      -re ".*solib-d1.*$gdb_prompt $" {
>          pass "Catch implicit load at startup"
>      }
> -    -re "Program exited.*$gdb_prompt $" {
> +    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
>          fail "CLLbs14756 || CLLbs16090 came back ???"
>      }
>      timeout { fail "(timeout) implicit library load" }
> @@ -228,7 +228,7 @@ gdb_expect {
>      -re "Stopped due to shared library event.*$gdb_prompt $" {
>          pass "stop for shlib event"
>      }
> -    -re "Program exited.*$gdb_prompt $" {
> +    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
>          fail "Bug CLLbs16090 came back ?"
>      }
>      timeout { fail "(timeout) stop for shlib event " }
> diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
> index f743825..566ae26 100644
> --- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
> +++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
> @@ -130,10 +130,10 @@ for {set filenum 0} {$filenum < 2} {incr filenum 1} {
>          gdb_test "s 1" ".*25.*"
>          if [istarget "hppa64-*-*"] {
>              gdb_test "s 1" "0x\[0-9a-f\]+ in .*"
> -            gdb_test "c" ".*Program exited normally.*"
> +           gdb_continue_off_end
>          } else {
>              gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
> -            gdb_test "s 1" ".*Program exited normally.*"
> +            gdb_continue_off_end "s 1"
>          }
>      }
> 
> diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
> index c336498..4c197f5 100644
> --- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
> +++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
> @@ -78,9 +78,9 @@ gdb_test "s 1" "main .*/x1.cc:15.*"
>  gdb_test "s 1" ".*16.*"
>  if [istarget "hppa64-*-*"] {
>      gdb_test "s 1" "0x\[0-9a-f\]+ in .*START.*"
> -    gdb_test "c" ".*Program exited normally.*"
> +    gdb_continue_off_end
>  } else {
>      gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
> -    gdb_test "s 1" ".*Program exited normally.*"
> +    gdb_continue_off_end "s 1"
>  }
> 
> diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
> index 81de5a2..89c8791 100644
> --- a/gdb/testsuite/gdb.python/py-prettyprint.exp
> +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
> @@ -105,7 +105,7 @@ proc run_lang_tests {lang} {
>      gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \
>         "print nstype on one line"
> 
> -    gdb_test "continue" "Program exited normally\."
> +    gdb_continue_off_end
> 
>      remote_file host delete ${remote_python_file}
>  }
> diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
> index 863c7cf..c2322ac 100644
> --- a/gdb/testsuite/gdb.threads/execl.exp
> +++ b/gdb/testsuite/gdb.threads/execl.exp
> @@ -71,5 +71,4 @@ gdb_test_multiple "info threads" "$test" {
>      }
>  }
> 
> -gdb_test "continue" ".*Program exited normally\\." \
> -    "continue to end"
> +gdb_continue_off_end
> diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
> index cb0bc3d..e41326b 100644
> --- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
> +++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
> @@ -86,7 +86,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
> 
>  # Continue one last time, the program should exit normally.
> 
> -gdb_test "continue" "Program exited normally." \
> -    "continue to program exit"
> +gdb_continue_off_end
> 
>  return 0
> diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp
> index d221fbd..c715cc7 100644
> --- a/gdb/testsuite/gdb.threads/print-threads.exp
> +++ b/gdb/testsuite/gdb.threads/print-threads.exp
> @@ -80,7 +80,7 @@ proc test_all_threads { name kill } {
>             send_gdb "continue\n"
>             exp_continue
>         }
> -       -re "Program exited normally\\.\[\r\n\]+$gdb_prompt" {
> +       -re "Inferior \[0-9\]+ exited normally.\[\r\n\]+$gdb_prompt" {
>             pass "program exited normally"
>             if {$i == 5} {
>                 pass "all threads ran once ($name)"
> diff --git a/gdb/testsuite/gdb.threads/step.exp b/gdb/testsuite/gdb.threads/step.exp
> index c051196..20a4def 100644
> --- a/gdb/testsuite/gdb.threads/step.exp
> +++ b/gdb/testsuite/gdb.threads/step.exp
> @@ -62,7 +62,7 @@ proc step_it { cmd } {
>      gdb_expect {
>         -re "0x\[0-9A-Fa-f\]* *in.*\r\n$gdb_prompt $" { pass "step_it"; return 0 }
>         -re "0x\[0-9A-Fa-f\]* *\[0-9\]*.*\r\n$gdb_prompt $" { pass "step_it"; return 1 }
> -       -re "Program exited .*\n$gdb_prompt $" {
> +       -re "Inferior \[0-9\]+ exited .*\n$gdb_prompt $" {
>                 set program_exited 1
>                 return -1
>             }
> @@ -88,7 +88,7 @@ proc continue_all {} {
>             pass "continue_all"
>             return 0
>         }
> -       -re "Program exited .*\n$gdb_prompt $" {
> +       -re "Inferior \[0-9\]+ exited .*\n$gdb_prompt $" {
>             set program_exited 1
>             return 1;
>         }
> diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
> index 6faabf5..232258e 100644
> --- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
> +++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
> @@ -110,7 +110,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
> 
>  # Continue one last time, the program should exit normally.
> 
> -gdb_test "continue" "Program exited normally." \
> -    "continue to program exit"
> +gdb_continue_off_end
> 
>  return 0
> diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
> index 0e63120..ff294ff 100644
> --- a/gdb/testsuite/gdb.threads/tls.exp
> +++ b/gdb/testsuite/gdb.threads/tls.exp
> @@ -177,7 +177,7 @@ gdb_expect {
>          unsupported "continue to first thread: system does not support TLS"
>          return -1
>      }
> -    -re ".*Program exited normally.*$gdb_prompt $" {
> +    -re ".*Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>          fail "continue to first thread: program runaway"
>      }
>      -re ".*Pass 0 done.*Pass 1 done.*$gdb_prompt $" {
> diff --git a/gdb/testsuite/lib/cell.exp b/gdb/testsuite/lib/cell.exp
> index 4cc7ee0..86f77b2 100644
> --- a/gdb/testsuite/lib/cell.exp
> +++ b/gdb/testsuite/lib/cell.exp
> @@ -136,11 +136,11 @@ proc skip_cell_tests {} {
>      gdb_load "$exe"
>      gdb_run_cmd
>      gdb_expect {
> -        -re ".*Program exited normally.*${gdb_prompt} $" {
> +        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>              verbose -log "\n$me: Cell/B.E. hardware detected"
>              set skip_cell_tests_saved 0
>          }
> -        -re ".*Program exited with code.*${gdb_prompt} $" {
> +        -re ".*Inferior \[0-9\]+ exited with code.*${gdb_prompt} $" {
>              verbose -log "\n$me: Cell/B.E. hardware not detected"
>              set skip_cell_tests_saved 1
>          }
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 44d449a..91ddad5 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -572,7 +572,7 @@ proc gdb_internal_error_resync {} {
>  #    }
>  # }
>  #
> -# The standard patterns, such as "Program exited..." and "A problem
> +# The standard patterns, such as "Inferior exited..." and "A problem
>  # ...", all being implicitly appended to that list.
>  #
>  proc gdb_test_multiple { command message user_code } {
> @@ -755,7 +755,7 @@ proc gdb_test_multiple { command message user_code } {
>              fail "$message"
>             set result 1
>         }
> -        -re "Program exited with code \[0-9\]+.*$gdb_prompt $" {
> +        -re "Inferior \[0-9\]+ exited with code \[0-9\]+.*$gdb_prompt $" {
>             if ![string match "" $message] then {
>                 set errmsg "$message (the program exited)"
>             } else {
> @@ -764,7 +764,7 @@ proc gdb_test_multiple { command message user_code } {
>             fail "$errmsg"
>             set result -1
>         }
> -        -re "Program exited normally.*$gdb_prompt $" {
> +        -re "Inferior \[0-9\]+ exited normally.*$gdb_prompt $" {
>             if ![string match "" $message] then {
>                 set errmsg "$message (the program exited)"
>             } else {
> @@ -1640,7 +1640,7 @@ proc skip_altivec_tests {} {
>              verbose -log "\n$me altivec hardware not detected"
>              set skip_vmx_tests_saved 1
>          }
> -        -re ".*Program exited normally.*${gdb_prompt} $" {
> +        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>              verbose -log "\n$me: altivec hardware detected"
>              set skip_vmx_tests_saved 0
>          }
> @@ -1727,7 +1727,7 @@ proc skip_vsx_tests {} {
>              verbose -log "\n$me VSX hardware not detected"
>              set skip_vsx_tests_saved 1
>          }
> -        -re ".*Program exited normally.*${gdb_prompt} $" {
> +        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>              verbose -log "\n$me: VSX hardware detected"
>              set skip_vsx_tests_saved 0
>          }
> @@ -3069,11 +3069,18 @@ proc gdb_continue_to_end {mssg} {
>      # Don't bother to check the output of the program, that may be
>      # extremely tough for some remote systems.
>      gdb_test "continue"\
> -      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|Program exited normally\\.).*"\
> +      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|Inferior \[0-9\]+ exited normally).*"\
>        "continue until exit at $mssg"
>    }
>  }
> 
> +# Invoke COMMAND, by default "continue", and expect GDB to exit
> +# normally.  TESTNAME is an optional test name.
> +proc gdb_continue_off_end {{command continue}
> +                          {testname "continue to program exit"}} {
> +    gdb_test $command "Inferior \[0-9\]+ exited normally." $testname
> +}
> +
>  proc rerun_to_main {} {
>    global gdb_prompt
> 
> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
> index 6b25f69..8d30a9f 100644
> --- a/gdb/testsuite/lib/mi-support.exp
> +++ b/gdb/testsuite/lib/mi-support.exp
> @@ -698,7 +698,7 @@ proc mi_gdb_test { args } {
>              fail "$message"
>             set result 1
>         }
> -        -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
> +        -re "Inferior \[0-9\]+ exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
>             if ![string match "" $message] then {
>                 set errmsg "$message (the program exited)"
>             } else {
> diff --git a/gdb/testsuite/lib/opencl.exp b/gdb/testsuite/lib/opencl.exp
> index c1b5291..b722ba3 100644
> --- a/gdb/testsuite/lib/opencl.exp
> +++ b/gdb/testsuite/lib/opencl.exp
> @@ -59,11 +59,11 @@ proc skip_opencl_tests {} {
>      clean_restart "$executable"
>      gdb_run_cmd
>      gdb_expect 30 {
> -        -re ".*Program exited normally.*${gdb_prompt} $" {
> +        -re ".*Inferior \[0-9\]+ exited normally.*${gdb_prompt} $" {
>              verbose -log "\n$me: OpenCL support detected"
>              set skip_opencl_tests_saved($board) 0
>          }
> -        -re ".*Program exited with code.*${gdb_prompt} $" {
> +        -re ".*Inferior \[0-9\]+ exited code.*${gdb_prompt} $" {
>              verbose -log "\n$me: OpenCL support not detected"
>              set skip_opencl_tests_saved($board) 1
>          }

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

* Re: RFC: change "program exited" message
  2011-03-03 20:52 RFC: change "program exited" message Tom Tromey
  2011-03-03 21:18 ` Michael Snyder
@ 2011-03-03 21:20 ` Pedro Alves
  2011-03-04  7:37   ` Eli Zaretskii
  2011-03-04 17:24   ` Tom Tromey
  2011-03-04  9:12 ` RFC: change "program exited" message Mark Kettenis
  2 siblings, 2 replies; 20+ messages in thread
From: Pedro Alves @ 2011-03-03 21:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Thanks for address this.  It's an overdue change.

On Thursday 03 March 2011 20:51:44, Tom Tromey wrote:
> This patch changes GDB to print:
> 
>     [Inferior 25036 exited normally]

That number is the PID, but "Inferior" should go with
GDB's inferior id, otherwise, it's quite confusing.

>     [Inferior 25036 exited normally]

I suggest, modelled on how we print threads:

"[Inferior " + inferior->num + "(" target_pid_to_string (pid_to_ptid (inf->pid)) + ")" + $whathappened + "]"

Should render on Linux as:

[Inferior 1 (process 25036) exited normally]

and against remote targets when gdb doesn't
know the target pid:

[Inferior 1 (Remote target) exited normally]

-- 
Pedro Alves

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

* Re: RFC: change "program exited" message
  2011-03-03 21:20 ` Pedro Alves
@ 2011-03-04  7:37   ` Eli Zaretskii
  2011-03-04 17:24   ` Tom Tromey
  1 sibling, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2011-03-04  7:37 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches, tromey

> From: Pedro Alves <pedro@codesourcery.com>
> Date: Thu, 3 Mar 2011 21:20:49 +0000
> Cc: Tom Tromey <tromey@redhat.com>
> 
> Thanks for address this.  It's an overdue change.
> 
> On Thursday 03 March 2011 20:51:44, Tom Tromey wrote:
> > This patch changes GDB to print:
> > 
> >     [Inferior 25036 exited normally]
> 
> That number is the PID, but "Inferior" should go with
> GDB's inferior id, otherwise, it's quite confusing.
> 
> >     [Inferior 25036 exited normally]
> 
> I suggest, modelled on how we print threads:
> 
> "[Inferior " + inferior->num + "(" target_pid_to_string (pid_to_ptid (inf->pid)) + ")" + $whathappened + "]"
> 
> Should render on Linux as:
> 
> [Inferior 1 (process 25036) exited normally]
> 
> and against remote targets when gdb doesn't
> know the target pid:
> 
> [Inferior 1 (Remote target) exited normally]

I agree with this.  It is important that "New process 25036" and
whatever we display when that process exits have some words in common.

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

* Re: RFC: change "program exited" message
  2011-03-03 20:52 RFC: change "program exited" message Tom Tromey
  2011-03-03 21:18 ` Michael Snyder
  2011-03-03 21:20 ` Pedro Alves
@ 2011-03-04  9:12 ` Mark Kettenis
  2 siblings, 0 replies; 20+ messages in thread
From: Mark Kettenis @ 2011-03-04  9:12 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches

> From: Tom Tromey <tromey@redhat.com>
> Date: Thu, 03 Mar 2011 13:51:44 -0700
> 
> This patch changes GDB to print:
> 
>     [Inferior 25036 exited normally]

Hmm, compared to "process" or "program", "inferior" is quite cryptic
to someone who isn't familliar with the internals of GDB.

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

* Re: RFC: change "program exited" message
  2011-03-03 21:20 ` Pedro Alves
  2011-03-04  7:37   ` Eli Zaretskii
@ 2011-03-04 17:24   ` Tom Tromey
  2011-03-04 19:13     ` Pedro Alves
  1 sibling, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2011-03-04 17:24 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro> I suggest, modelled on how we print threads:
Pedro> "[Inferior " + inferior->num + "(" target_pid_to_string (pid_to_ptid (inf->pid)) + ")" + $whathappened + "]"

Looks good to me.

Here's the patch.  This time I introduced a new variable in the test
suite, so that further changes to the format are less difficult to
implement.

Built and regtested on x86-64 (compile farm).

Tom

2011-03-04  Tom Tromey  <tromey@redhat.com>

	* infrun.c (print_exited_reason): Include inferior id and pid in
	message.

2011-03-04  Tom Tromey  <tromey@redhat.com>

	* lib/opencl.exp (skip_opencl_tests): Update for exit message
	change.
	* lib/mi-support.exp (mi_gdb_test): Update for exit message
	change.
	* lib/gdb.exp (gdb_test_multiple): Update comment.  Update for
	exit message change.
	(skip_altivec_tests): Update for exit message change.
	(skip_vsx_tests): Likewise.
	(gdb_continue_to_end): Likewise.
	(gdb_continue_off_end): New proc.
	* lib/cell.exp (skip_cell_tests): Update for exit message change.
	* gdb.threads/tls.exp: Update for exit message change.
	* gdb.threads/thread-unwindonsignal.exp: Use
	gdb_continue_off_end.
	* gdb.threads/step.exp (step_it): Update for exit message change.
	(continue_all): Likewise.
	* gdb.threads/print-threads.exp (test_all_threads): Update for
	exit message change.
	* gdb.threads/interrupted-hand-call.exp: Use
	gdb_continue_off_end.
	* gdb.threads/execl.exp: Use gdb_continue_off_end.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Use
	gdb_continue_off_end.
	* gdb.hp/gdb.objdbg/objdbg02.exp: Use gdb_continue_off_end.
	* gdb.hp/gdb.objdbg/objdbg01.exp: Use gdb_continue_off_end.
	* gdb.hp/gdb.defects/solib-d.exp: Update for exit message change.
	* gdb.cp/method.exp: Update for exit message change.
	* gdb.cp/mb-templates.exp: Update for exit message change.
	* gdb.cp/mb-inline.exp: Use gdb_continue_off_end.
	* gdb.cp/annota3.exp: Update for exit message change.
	* gdb.cp/annota2.exp: Update for exit message change.
	* gdb.cell/fork.exp: Use gdb_continue_off_end.
	* gdb.base/term.exp: Update for exit message change.
	* gdb.base/step-test.exp (test_i): Update for exit message change.
	* gdb.base/sigstep.exp (advance): Update for exit message change.
	(advancei): Likewise.
	* gdb.base/siginfo.exp: Update for exit message change.
	* gdb.base/shlib-call.exp: Use gdb_continue_off_end.
	* gdb.base/reread.exp: Use gdb_continue_off_end.
	* gdb.base/langs.exp: Use gdb_continue_off_end.
	* gdb.base/interrupt.exp: Update for exit message change.
	* gdb.base/gdb1555.exp: Update for exit message change.
	* gdb.base/exe-lock.exp: Use gdb_continue_off_end.
	* gdb.base/ending-run.exp: Update for exit message change.
	* gdb.base/chng-syms.exp: Update for exit message change.
	* gdb.base/checkpoint.exp: Update for exit message change.
	* gdb.base/catch-syscall.exp (check_for_program_end): Use
	gdb_continue_off_end.
	(test_catch_syscall_with_wrong_args): Likewise.
	* gdb.base/call-signal-resume.exp: Use gdb_continue_off_end.
	* gdb.base/break-interp.exp (test_ld): Update for exit message
	change.
	* gdb.base/bang.exp: Update for exit message change.
	* gdb.base/attach.exp (do_attach_tests): Use gdb_continue_off_end.
	(do_call_attach_tests): Likewise.
	* gdb.base/a2-run.exp: Update for exit message change.
	* gdb.arch/ppc-dfp.exp: Update for exit message change.
	* gdb.ada/tasks.exp: Use gdb_continue_off_end.
	* gdb.ada/catch_ex.exp: Use gdb_continue_off_end.

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 274082d..ba40c6c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5488,22 +5488,33 @@ print_signal_exited_reason (enum target_signal siggnal)
 static void
 print_exited_reason (int exitstatus)
 {
+  struct inferior *inf = current_inferior ();
+  const char *pidstr = target_pid_to_str (pid_to_ptid (inf->pid));
+
   annotate_exited (exitstatus);
   if (exitstatus)
     {
       if (ui_out_is_mi_like_p (uiout))
 	ui_out_field_string (uiout, "reason", 
 			     async_reason_lookup (EXEC_ASYNC_EXITED));
-      ui_out_text (uiout, "\nProgram exited with code ");
+      ui_out_text (uiout, "[Inferior ");
+      ui_out_text (uiout, plongest (inf->num));
+      ui_out_text (uiout, " (");
+      ui_out_text (uiout, pidstr);
+      ui_out_text (uiout, ") exited with code ");
       ui_out_field_fmt (uiout, "exit-code", "0%o", (unsigned int) exitstatus);
-      ui_out_text (uiout, ".\n");
+      ui_out_text (uiout, "]\n");
     }
   else
     {
       if (ui_out_is_mi_like_p (uiout))
 	ui_out_field_string
 	  (uiout, "reason", async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
-      ui_out_text (uiout, "\nProgram exited normally.\n");
+      ui_out_text (uiout, "[Inferior ");
+      ui_out_text (uiout, plongest (inf->num));
+      ui_out_text (uiout, " (");
+      ui_out_text (uiout, pidstr);
+      ui_out_text (uiout, ") exited normally]\n");
     }
   /* Support the --return-child-result option.  */
   return_child_result_value = exitstatus;
diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index b0a4000..d692aca 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -141,8 +141,6 @@ gdb_test "continue" \
          "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
          "continuing to unhandled exception"
 
-gdb_test "continue" \
-         "Continuing\..*Program exited.*" \
-         "continuing to program completion"
+gdb_continue_off_end "continue" "continuing to program completion"
 
 
diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp
index bced9f8..166f18c 100644
--- a/gdb/testsuite/gdb.ada/tasks.exp
+++ b/gdb/testsuite/gdb.ada/tasks.exp
@@ -70,7 +70,5 @@ gdb_test "info tasks" \
 # Now, resume the execution and make sure that GDB does not stop when
 # task 4 hits the breakpoint. Continuing thus results in our program
 # running to completion.
-gdb_test "continue" \
-         ".*Program exited normally\..*" \
-         "continue until end of program"
+gdb_continue_off_end "continue" "continue until end of program"
 
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
index 10fbd3c..bf20b89 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -59,7 +59,7 @@ gdb_run_cmd
 # When the prompt comes back we'll be at the Set DFP rounding mode breakpoint.
 # Unless the program bails out after checking AT_HWCAP.
 gdb_expect {
-  -re "Program exited with code 01.\[\r\n\]+$gdb_prompt $" {
+  -re "$inferior_exited_re with code 01.\[\r\n\]+$gdb_prompt $" {
     unsupported "This machine doesn't support Decimal Floating Point."
     return -1
   }
diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
index d26a202..cb1e6fd 100644
--- a/gdb/testsuite/gdb.base/a2-run.exp
+++ b/gdb/testsuite/gdb.base/a2-run.exp
@@ -42,7 +42,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" with no args"
 	}
 	 -re "usage:  factorial <number>" {
@@ -57,19 +57,19 @@ if [istarget "*-*-vxworks*"] then {
     gdb_expect -re "$gdb_prompt $" {}
 } else {
     gdb_expect {
-	-re ".*usage:  factorial <number>.*Program exited with code 01\.\r\n$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.*$inferior_exited_re with code 01.\r\n$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args"
 	    pass "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.*Program exited with code 01.*$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.*$inferior_exited_re with code 01.*$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args"
 	    fail "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally\.\r\n$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.* EXIT code 1.*$inferior_exited_re normally.\r\n$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args (exit wrapper)"
 	    pass "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally.*$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.* EXIT code 1.*$inferior_exited_re normally.*$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args (exit wrapper)"
 	    fail "no spurious messages at program exit"
 	}
@@ -97,7 +97,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" with arg"
 	}
 	 "120" {
@@ -129,7 +129,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" again with same args"
 	}
 	 "120" { pass "run \"$testfile\" again with same args" }
@@ -161,7 +161,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run after setting args to nil"
 	}
 	 "usage:  factorial <number>" {
@@ -202,7 +202,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" again after setting args"
 	}
 	 "720" {
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 78df003..10656c0 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -258,7 +258,7 @@ proc do_attach_tests {} {
 
     # Allow the test process to exit, to cleanup after ourselves.
 
-    gdb_test "continue" "Program exited normally." "after attach2, exit"
+    gdb_continue_off_end "continue" "after attach2, exit"
 
     # Make sure we don't leave a process around to confuse
     # the next test run (and prevent the compile by keeping
@@ -365,7 +365,7 @@ proc do_call_attach_tests {} {
     # Get rid of the process
     
     gdb_test "p should_exit = 1"
-    gdb_test "c" "Program exited normally."
+    gdb_continue_off_end
    
     # Be paranoid
    
diff --git a/gdb/testsuite/gdb.base/bang.exp b/gdb/testsuite/gdb.base/bang.exp
index efe2295..9326311 100644
--- a/gdb/testsuite/gdb.base/bang.exp
+++ b/gdb/testsuite/gdb.base/bang.exp
@@ -39,7 +39,7 @@ gdb_load ${binfile}
 
 gdb_run_cmd
 gdb_expect {
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
         pass "run program"
     }
     timeout {
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 3df4dcb..fe79cae 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -365,7 +365,7 @@ proc test_attach {file displacement {relink_args ""}} {
 }
 
 proc test_ld {file ifmain trynosym displacement} {
-    global srcdir subdir gdb_prompt expect_out
+    global srcdir subdir gdb_prompt expect_out inferior_exited_re
 
     # First test normal `file'-command loaded $FILE with symbols.
 
@@ -494,7 +494,7 @@ proc test_ld {file ifmain trynosym displacement} {
 		}
 		exp_continue
 	    }
-	    -re "Program exited (normally|with code \[0-9\]+)\\.\r\n$gdb_prompt $" {
+	    -re "$inferior_exited_re (normally|with code \[0-9\]+).\r\n$gdb_prompt $" {
 		# Do not check the binary filename as it may be truncated.
 		pass $test
 	    }
diff --git a/gdb/testsuite/gdb.base/call-signal-resume.exp b/gdb/testsuite/gdb.base/call-signal-resume.exp
index b85691c..c9b2176 100644
--- a/gdb/testsuite/gdb.base/call-signal-resume.exp
+++ b/gdb/testsuite/gdb.base/call-signal-resume.exp
@@ -146,7 +146,6 @@ gdb_test "continue" "Breakpoint \[0-9\]*, handle_signal.*" \
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_off_end
 
 return 0
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index d25df17..a8a5d54 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -167,7 +167,7 @@ proc check_for_program_end {} {
     delete_breakpoints
 
     set thistest "successful program end"
-    gdb_test "continue" "Program exited normally.*" $thistest
+    gdb_continue_off_end continue $thistest
 
 }
 
@@ -231,7 +231,7 @@ proc test_catch_syscall_with_wrong_args {} {
     # If it doesn't, everything is right (since we don't have
     # a syscall named "mlock" in it).  Otherwise, this is a failure.
     set thistest "catch syscall with unused syscall ($syscall_name)"
-    gdb_test "continue" "Program exited normally.*" $thistest
+    gdb_continue_off_end "continue" $thistest
 }
 
 proc test_catch_syscall_restarting_inferior {} {
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index f34b0d1..c3b2008 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -277,23 +277,23 @@ gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 10"
 
 delete_breakpoints
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork one"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork two"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork three"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork four"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork five"
 
 #
diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp
index d2567e7..9478d0c 100644
--- a/gdb/testsuite/gdb.base/chng-syms.exp
+++ b/gdb/testsuite/gdb.base/chng-syms.exp
@@ -100,7 +100,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 
     gdb_run_cmd
     gdb_expect {
-	-re ".*Program exited normally.*$gdb_prompt $" {
+	-re ".*$inferior_exited_re normally.*$gdb_prompt $" {
 	    pass "running with invalidated bpt condition after executable changes" 
 	}
 	-re ".*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index 43c46f8..9d1134d 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -146,7 +146,7 @@ gdb_test_multiple "next" "step out of main" {
 	# This is what happens on mingw32ce.
 	pass "step out of main"
     }
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
 	# This is what happens on Linux i86 (and I would expect others)
 	set program_exited 1
 	pass "step out of main"
@@ -209,21 +209,21 @@ if {! [target_info exists use_gdb_stub]
     global program_exited;
     if {[eval expr $program_exited == 0]} {
 	gdb_test_multiple "n" "step to end of run" {
-	    -re "Program exited normally.*$gdb_prompt $" {
+	    -re "$inferior_exited_re normally.*$gdb_prompt $" {
 		# If we actually have debug info for the start function,
 		# then we won't get the "Single-stepping until function
 		# exit" message.
 		pass "step to end of run"
 		set program_exited_normally 1
 	    }
-	    -re "Single.*EXIT code 0\r\n.*Program exited normally.*$gdb_prompt $" {
+	    -re "Single.*EXIT code 0\r\n.*$inferior_exited_re normally.*$gdb_prompt $" {
 		pass "step to end of run (status wrapper)"
 		set program_exited_normally 1
 	    }
 	    -re "Single.*EXIT code 0\r\n.*$gdb_prompt $" {
 		pass "step to end of run (status wrapper)"
 	    }
-	    -re ".*Single.*Program exited.*$gdb_prompt $" {
+	    -re ".*Single.*$inferior_exited_re.*$gdb_prompt $" {
 		pass "step to end of run"
 		set program_exited_normally 1
 	    }
diff --git a/gdb/testsuite/gdb.base/exe-lock.exp b/gdb/testsuite/gdb.base/exe-lock.exp
index e4bbbbe..011b9d2 100644
--- a/gdb/testsuite/gdb.base/exe-lock.exp
+++ b/gdb/testsuite/gdb.base/exe-lock.exp
@@ -50,9 +50,7 @@ if ![runto_main] then {
     continue
 }
 
-gdb_test "continue" \
-         ".*Program exited normally\\." \
-         "continue until program exits"
+gdb_continue_off_end
 
 # Try deleting the executable file, now that the program has exited,
 # and make sure that the deletion worked by verifying that the exe
diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp
index 8c3e8ba..ed6b073 100644
--- a/gdb/testsuite/gdb.base/gdb1555.exp
+++ b/gdb/testsuite/gdb.base/gdb1555.exp
@@ -77,7 +77,7 @@ gdb_test_multiple "n" $name \
     -re "\[0-9\]+.*return a;.*$gdb_prompt $" {
 	pass $name
     }
-    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { 
+    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" { 
 	kfail "gdb/1555" $name 
     }
 }
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index cce7fca..4562199 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -201,7 +201,7 @@ if ![file exists $binfile] then {
 
 	send_gdb "\004"
 	gdb_expect {
-	    -re "end of file.*Program exited normally.*$gdb_prompt $" {
+	    -re "end of file.*$inferior_exited_re normally.*$gdb_prompt $" {
 		pass "send end of file"
 	    }
 	    -re "$gdb_prompt $" { fail "send end of file" }
diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
index a42f2d8..e3c3847 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -146,8 +146,7 @@ if [runto csub] then {
 	gdb_breakpoint "exit"
 	gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
     } else {
-	gdb_test "cont" "Program exited normally\\..*" \
-		"continue to exit in langs.exp"
+	gdb_continue_off_end
     }
 }
 
diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp
index e562285..8f499e7 100644
--- a/gdb/testsuite/gdb.base/reread.exp
+++ b/gdb/testsuite/gdb.base/reread.exp
@@ -149,8 +149,7 @@ if [is_remote target] {
 
     # This time, let the program run to completion.  If GDB checks the
     # executable file's timestamp now, it won't notice any change.
-    gdb_test "continue" ".*Program exited.*" \
-            "second pass: continue to completion"
+    gdb_continue_off_end "continue" "second pass: continue to completion"
     
     # Now move the newer executable into place, and re-run.  GDB
     # should still notice that the executable file has changed,
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index f8601c7..230942d 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -182,12 +182,12 @@ if ![is_remote target] {
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"run to bp in shared library"
 
-  gdb_test "cont" ".*Program exited normally..*"
+  gdb_continue_off_end
 
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"re-run to bp in shared library (PR's 16495, 18213)"
 
-  gdb_test "cont" ".*Program exited normally..*"
+  gdb_continue_off_end
 }
 
 return 0
diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
index db9fd5c..602c63b 100644
--- a/gdb/testsuite/gdb.base/siginfo.exp
+++ b/gdb/testsuite/gdb.base/siginfo.exp
@@ -83,7 +83,7 @@ gdb_test_multiple "step" "${test}" {
 	send_gdb "step\n"
 	exp_continue
     }
-    -re "Program exited normally.*${gdb_prompt} $" {
+    -re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	kfail gdb/1613 "$test (program exited)"
     }
     -re "(while ..done|return 0).*${gdb_prompt} $" {
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index 98e0e3d..d43cf0a 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -68,7 +68,7 @@ gdb_test_sequence "bt" "backtrace for nexti" {
 }
 
 proc advance { i } {
-    global gdb_prompt
+    global gdb_prompt inferior_exited_re
     set prefix "$i from handler"
 
     # Get us back into the handler
@@ -88,7 +88,7 @@ proc advance { i } {
 	    send_gdb "$i\n"
 	    exp_continue -continue_timer
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	    setup_kfail gdb/1639 powerpc-*-*bsd*
 	    fail "$test (program exited)"
 	}
@@ -105,7 +105,7 @@ proc advance { i } {
 }
 
 proc advancei { i } {
-    global gdb_prompt
+    global gdb_prompt inferior_exited_re
     set prefix "$i from handleri"
     set program_exited 0
 
@@ -144,7 +144,7 @@ proc advancei { i } {
 	-re "main .*${gdb_prompt} $" {
 	    fail "$test (in main)"
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	    fail "$test (program exited)"
 	    set program_exited 1
 	}
@@ -170,7 +170,7 @@ proc advancei { i } {
 	    send_gdb "y\n"
 	    exp_continue -continue_timer
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	    kfail gdb/1639 "$test (program exited)"
 	    set program_exited 1
 	}
diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
index 1c48812..24116d6 100644
--- a/gdb/testsuite/gdb.base/step-test.exp
+++ b/gdb/testsuite/gdb.base/step-test.exp
@@ -150,7 +150,7 @@ gdb_test_multiple "finish" "$test" {
     -re ".*${decimal}.*callee.*NEXTI.*$gdb_prompt $" {
 	pass "$test"
     }
-    -re ".*(Program received|Program exited).*$gdb_prompt $" {
+    -re ".*(Program received|$inferior_exited_re).*$gdb_prompt $" {
 	# Oops... We ran to the end of the program...  Better reset     
 	if {![runto_main]} then {
 	    fail "$test (Can't run to main)"
diff --git a/gdb/testsuite/gdb.base/term.exp b/gdb/testsuite/gdb.base/term.exp
index 049a88b..d4d1d83 100644
--- a/gdb/testsuite/gdb.base/term.exp
+++ b/gdb/testsuite/gdb.base/term.exp
@@ -47,7 +47,7 @@ gdb_test_no_output "set width 0"
 gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
 gdb_run_cmd 5
 gdb_expect {
-    -re ".*120.*Program exited normally.*$gdb_prompt $" {
+    -re ".*120.*$inferior_exited_re normally.*$gdb_prompt $" {
 	gdb_test "info terminal" "No saved terminal information.*" "test info terminal #2"
     }
     default {
diff --git a/gdb/testsuite/gdb.cell/fork.exp b/gdb/testsuite/gdb.cell/fork.exp
index 3fdfc25..b3d40d5 100644
--- a/gdb/testsuite/gdb.cell/fork.exp
+++ b/gdb/testsuite/gdb.cell/fork.exp
@@ -77,8 +77,7 @@ gdb_test_no_output "delete \$bpnum" "delete watchpoint"
 gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, func \\(\\) at .*$spu_file.c:.*" \
 	 "run until breakpoint hit"
 
-gdb_test "continue" "Continuing\\..*Program exited normally.*" \
-	 "run until end"
+gdb_continue_off_end
 
 gdb_exit
 
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index a48e2ea..4092a43 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -116,7 +116,7 @@ gdb_test_multiple "print a" "print class" {
 # `a.x is 1' is asynchronous regarding to `frames-invalid'.
 #
 gdb_test_multiple "continue" "continue until exit" {
-    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n.$inferior_exited_re normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
 	pass "continue until exit"
     }
 }
diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
index 17021fb..a2b5d22 100644
--- a/gdb/testsuite/gdb.cp/annota3.exp
+++ b/gdb/testsuite/gdb.cp/annota3.exp
@@ -122,8 +122,7 @@ gdb_expect_list "continue to exit" "$gdb_prompt$" {
     "\r\n\032\032starting\r\n"
     "a.x is 1\r\n"
     "\r\n\032\032exited 0\r\n"
-    "\r\n"
-    "Program exited normally.\r\n"
+    ".$inferior_exited_re normally.\r\n"
     "\r\n\032\032stopped\r\n"
 }
 
diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
index 46d7cc2..bd8ea63 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.exp
+++ b/gdb/testsuite/gdb.cp/mb-inline.exp
@@ -101,9 +101,7 @@ gdb_expect {
     }
 }
 
-gdb_test "continue" \
-    ".*Program exited normally.*" \
-    "continue with disabled breakpoint 1.2"
+gdb_continue_off_end "continue" "continue with disabled breakpoint 1.2"
 
 # Make sure we can set a breakpoint on a source statement that spans
 # multiple lines.
diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp
index 2f8f091..80c080b 100644
--- a/gdb/testsuite/gdb.cp/mb-templates.exp
+++ b/gdb/testsuite/gdb.cp/mb-templates.exp
@@ -129,7 +129,7 @@ gdb_test_no_output "disable 1" "disable breakpoint: disable"
 
 gdb_run_cmd
 gdb_expect {
-    -re "Program exited normally.*$gdb_prompt $" {
+    -re "$inferior_exited_re normally.*$gdb_prompt $" {
 	pass "disable breakpoint: run to breakpoint"
     }
     -re "$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp
index 848a06d..fff718d 100644
--- a/gdb/testsuite/gdb.cp/method.exp
+++ b/gdb/testsuite/gdb.cp/method.exp
@@ -175,10 +175,10 @@ gdb_test_multiple "ptype A" "ptype A" {
 }
 
 gdb_test_multiple "cont" "finish program" {
-    -re "Continuing.\r\n\r\nProgram exited normally.*$gdb_prompt $" {
+    -re "Continuing.\r\n$inferior_exited_re normally.*$gdb_prompt $" {
 	pass "finish program"
     }
-    -re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" {
+    -re "Continuing.* EXIT code 0.*$inferior_exited_re normally.*$gdb_prompt $" {
 	pass "finish program (exit wrapper)" 
     }
 }
diff --git a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
index 497f7de..6be6d44 100644
--- a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
+++ b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
@@ -132,7 +132,7 @@ gdb_expect {
     -re ".*solib-d1.*$gdb_prompt $" {
         pass "Catch implicit load at startup"
     }
-    -re "Program exited.*$gdb_prompt $" {
+    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
         fail "CLLbs14756 || CLLbs16090 came back ???"
     }
     timeout { fail "(timeout) implicit library load" }
@@ -228,7 +228,7 @@ gdb_expect {
     -re "Stopped due to shared library event.*$gdb_prompt $" {
         pass "stop for shlib event"
     }
-    -re "Program exited.*$gdb_prompt $" {
+    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
         fail "Bug CLLbs16090 came back ?"
     }
     timeout { fail "(timeout) stop for shlib event " }
diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
index f743825..566ae26 100644
--- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
+++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
@@ -130,10 +130,10 @@ for {set filenum 0} {$filenum < 2} {incr filenum 1} {
         gdb_test "s 1" ".*25.*"
         if [istarget "hppa64-*-*"] {
             gdb_test "s 1" "0x\[0-9a-f\]+ in .*"
-            gdb_test "c" ".*Program exited normally.*"
+	    gdb_continue_off_end
         } else {
             gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
-            gdb_test "s 1" ".*Program exited normally.*"
+            gdb_continue_off_end "s 1"
         }
     }
 
diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
index c336498..4c197f5 100644
--- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
+++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
@@ -78,9 +78,9 @@ gdb_test "s 1" "main .*/x1.cc:15.*"
 gdb_test "s 1" ".*16.*"
 if [istarget "hppa64-*-*"] {
     gdb_test "s 1" "0x\[0-9a-f\]+ in .*START.*"
-    gdb_test "c" ".*Program exited normally.*"
+    gdb_continue_off_end
 } else {
     gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
-    gdb_test "s 1" ".*Program exited normally.*"
+    gdb_continue_off_end "s 1"
 }
 
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 81de5a2..89c8791 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -105,7 +105,7 @@ proc run_lang_tests {lang} {
     gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \
 	"print nstype on one line"
 
-    gdb_test "continue" "Program exited normally\."
+    gdb_continue_off_end
 
     remote_file host delete ${remote_python_file}
 }
diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
index 863c7cf..c2322ac 100644
--- a/gdb/testsuite/gdb.threads/execl.exp
+++ b/gdb/testsuite/gdb.threads/execl.exp
@@ -71,5 +71,4 @@ gdb_test_multiple "info threads" "$test" {
     }
 }
 
-gdb_test "continue" ".*Program exited normally\\." \
-    "continue to end"
+gdb_continue_off_end
diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
index cb0bc3d..e41326b 100644
--- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
+++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
@@ -86,7 +86,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_off_end
 
 return 0
diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp
index d221fbd..6cf42ef 100644
--- a/gdb/testsuite/gdb.threads/print-threads.exp
+++ b/gdb/testsuite/gdb.threads/print-threads.exp
@@ -59,7 +59,7 @@ if ![istarget "*-*-ultrix*"] then {
 }
 
 proc test_all_threads { name kill } {
-    global gdb_prompt
+    global gdb_prompt inferior_exited_re
 
     set i 0
     set j 0
@@ -80,7 +80,7 @@ proc test_all_threads { name kill } {
 	    send_gdb "continue\n"
 	    exp_continue
 	}
-	-re "Program exited normally\\.\[\r\n\]+$gdb_prompt" {
+	-re "$inferior_exited_re normally.\[\r\n\]+$gdb_prompt" {
 	    pass "program exited normally"
 	    if {$i == 5} {
 		pass "all threads ran once ($name)"
diff --git a/gdb/testsuite/gdb.threads/step.exp b/gdb/testsuite/gdb.threads/step.exp
index c051196..36c0403 100644
--- a/gdb/testsuite/gdb.threads/step.exp
+++ b/gdb/testsuite/gdb.threads/step.exp
@@ -57,12 +57,13 @@ proc set_bp { where } {
 proc step_it { cmd } {
     global gdb_prompt
     global program_exited
+    global inferior_exited_re
 
     send_gdb "$cmd\n"
     gdb_expect {
 	-re "0x\[0-9A-Fa-f\]* *in.*\r\n$gdb_prompt $" { pass "step_it"; return 0 }
 	-re "0x\[0-9A-Fa-f\]* *\[0-9\]*.*\r\n$gdb_prompt $" { pass "step_it"; return 1 }
-	-re "Program exited .*\n$gdb_prompt $" {
+	-re "$inferior_exited_re .*\n$gdb_prompt $" {
 		set program_exited 1
 		return -1
 	    }
@@ -81,6 +82,7 @@ proc step_source {} {
 
 proc continue_all {} {
     global gdb_prompt
+    global inferior_exited_re
 
     send_gdb "continue\n"
     gdb_expect {
@@ -88,7 +90,7 @@ proc continue_all {} {
 	    pass "continue_all"
 	    return 0
 	}
-	-re "Program exited .*\n$gdb_prompt $" {
+	-re "$inferior_exited_re .*\n$gdb_prompt $" {
 	    set program_exited 1
 	    return 1;
 	}
diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
index 6faabf5..232258e 100644
--- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
+++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
@@ -110,7 +110,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_off_end
 
 return 0
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index 0e63120..d7dce0db 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -177,7 +177,7 @@ gdb_expect {
         unsupported "continue to first thread: system does not support TLS"
         return -1
     }
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
         fail "continue to first thread: program runaway"
     }
     -re ".*Pass 0 done.*Pass 1 done.*$gdb_prompt $" {
diff --git a/gdb/testsuite/lib/cell.exp b/gdb/testsuite/lib/cell.exp
index 4cc7ee0..75ac210 100644
--- a/gdb/testsuite/lib/cell.exp
+++ b/gdb/testsuite/lib/cell.exp
@@ -72,7 +72,7 @@ proc gdb_cell_embedspu {source dest options} {
 # Return 0 if so, 1 if it does not.
 proc skip_cell_tests {} {
     global skip_cell_tests_saved
-    global srcdir subdir gdb_prompt
+    global srcdir subdir gdb_prompt inferior_exited_re
 
     # Use the cached value, if it exists.
     set me "skip_cell_tests"
@@ -136,11 +136,11 @@ proc skip_cell_tests {} {
     gdb_load "$exe"
     gdb_run_cmd
     gdb_expect {
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: Cell/B.E. hardware detected"
             set skip_cell_tests_saved 0
         }
-        -re ".*Program exited with code.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re with code.*${gdb_prompt} $" {
             verbose -log "\n$me: Cell/B.E. hardware not detected"
             set skip_cell_tests_saved 1
         }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 44d449a..ebd38c7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -99,6 +99,8 @@ if ![info exists env(EXEEXT)] {
 
 set octal "\[0-7\]+"
 
+set inferior_exited_re "Inferior \[0-9\]+ \\(.*\\) exited"
+
 ### Only procedures should come after this point.
 
 #
@@ -572,13 +574,14 @@ proc gdb_internal_error_resync {} {
 #    }
 # }
 #
-# The standard patterns, such as "Program exited..." and "A problem
+# The standard patterns, such as "Inferior exited..." and "A problem
 # ...", all being implicitly appended to that list.
 #
 proc gdb_test_multiple { command message user_code } {
     global verbose
     global gdb_prompt
     global GDB
+    global inferior_exited_re
     upvar timeout timeout
     upvar expect_out expect_out
 
@@ -755,7 +758,7 @@ proc gdb_test_multiple { command message user_code } {
             fail "$message"
 	    set result 1
 	}
-	 -re "Program exited with code \[0-9\]+.*$gdb_prompt $" {
+	 -re "$inferior_exited_re with code \[0-9\]+.*$gdb_prompt $" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
@@ -764,7 +767,7 @@ proc gdb_test_multiple { command message user_code } {
 	    fail "$errmsg"
 	    set result -1
 	}
-	 -re "Program exited normally.*$gdb_prompt $" {
+	 -re "$inferior_exited_re normally.*$gdb_prompt $" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
@@ -1573,7 +1576,7 @@ proc is_lp64_target {} {
 
 proc skip_altivec_tests {} {
     global skip_vmx_tests_saved
-    global srcdir subdir gdb_prompt
+    global srcdir subdir gdb_prompt inferior_exited_re
 
     # Use the cached value, if it exists.
     set me "skip_altivec_tests"
@@ -1640,7 +1643,7 @@ proc skip_altivec_tests {} {
             verbose -log "\n$me altivec hardware not detected" 
             set skip_vmx_tests_saved 1
         }
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: altivec hardware detected" 
             set skip_vmx_tests_saved 0
         }
@@ -1661,7 +1664,7 @@ proc skip_altivec_tests {} {
 
 proc skip_vsx_tests {} {
     global skip_vsx_tests_saved
-    global srcdir subdir gdb_prompt
+    global srcdir subdir gdb_prompt inferior_exited_re
 
     # Use the cached value, if it exists.
     set me "skip_vsx_tests"
@@ -1727,7 +1730,7 @@ proc skip_vsx_tests {} {
             verbose -log "\n$me VSX hardware not detected"
             set skip_vsx_tests_saved 1
         }
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: VSX hardware detected"
             set skip_vsx_tests_saved 0
         }
@@ -3058,6 +3061,7 @@ proc gdb_get_line_number { text { file "" } } {
 # mssg is the error message that gets printed.
 
 proc gdb_continue_to_end {mssg} {
+  global inferior_exited_re
   if [target_info exists use_gdb_stub] {
     if {![gdb_breakpoint "exit"]} {
       return 0
@@ -3069,11 +3073,19 @@ proc gdb_continue_to_end {mssg} {
     # Don't bother to check the output of the program, that may be
     # extremely tough for some remote systems.
     gdb_test "continue"\
-      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|Program exited normally\\.).*"\
+      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\
       "continue until exit at $mssg"
   }
 }
 
+# Invoke COMMAND, by default "continue", and expect GDB to exit
+# normally.  TESTNAME is an optional test name.
+proc gdb_continue_off_end {{command continue}
+			   {testname "continue to program exit"}} {
+    global inferior_exited_re
+    gdb_test $command "$inferior_exited_re normally." $testname
+}
+
 proc rerun_to_main {} {
   global gdb_prompt
 
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 6b25f69..e75a4f5 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -575,6 +575,7 @@ proc mi_gdb_test { args } {
     global verbose
     global mi_gdb_prompt
     global GDB expect_out
+    global inferior_exited_re
     upvar timeout timeout
 
     set command [lindex $args 0]
@@ -698,7 +699,7 @@ proc mi_gdb_test { args } {
             fail "$message"
 	    set result 1
 	}
-	 -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
+	 -re "$inferior_exited_re with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
diff --git a/gdb/testsuite/lib/opencl.exp b/gdb/testsuite/lib/opencl.exp
index c1b5291..dfd6a57 100644
--- a/gdb/testsuite/lib/opencl.exp
+++ b/gdb/testsuite/lib/opencl.exp
@@ -31,6 +31,7 @@ proc gdb_compile_opencl_hostapp {clsource executable options} {
 # it does not.
 proc skip_opencl_tests {} {
     global skip_opencl_tests_saved srcdir objdir subdir gdb_prompt
+    global inferior_exited_re
 
     # Use the cached value, if it exists.  Cache value per "board" to handle
     # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
@@ -59,11 +60,11 @@ proc skip_opencl_tests {} {
     clean_restart "$executable"
     gdb_run_cmd
     gdb_expect 30 {
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: OpenCL support detected"
             set skip_opencl_tests_saved($board) 0
         }
-        -re ".*Program exited with code.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re code.*${gdb_prompt} $" {
             verbose -log "\n$me: OpenCL support not detected"
             set skip_opencl_tests_saved($board) 1
         }

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

* Re: RFC: change "program exited" message
  2011-03-04 17:24   ` Tom Tromey
@ 2011-03-04 19:13     ` Pedro Alves
  2011-03-04 19:23       ` Tom Tromey
  0 siblings, 1 reply; 20+ messages in thread
From: Pedro Alves @ 2011-03-04 19:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

On Friday 04 March 2011 17:24:15, Tom Tromey wrote:
> Pedro> I suggest, modelled on how we print threads:
> Pedro> "[Inferior " + inferior->num + "(" target_pid_to_string (pid_to_ptid (inf->pid)) + ")" + $whathappened + "]"
> 
> Looks good to me.
> 
> Here's the patch.  This time I introduced a new variable in the test
> suite, so that further changes to the format are less difficult to
> implement.

Thanks!  

(Do we actually need gdb_continue_off_end?  It seemed
like in all but a couple of cases it was the same
as gdb_continue_to_end, except that the new function
doesn't handle using stubs.)

-- 
Pedro Alves

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

* Re: RFC: change "program exited" message
  2011-03-04 19:13     ` Pedro Alves
@ 2011-03-04 19:23       ` Tom Tromey
  2011-03-04 19:38         ` Pedro Alves
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2011-03-04 19:23 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:

Pedro> (Do we actually need gdb_continue_off_end?  It seemed
Pedro> like in all but a couple of cases it was the same
Pedro> as gdb_continue_to_end, except that the new function
Pedro> doesn't handle using stubs.)

I was not sure that this was safe to do.
If you think it is ok, I can make that change.

Tom

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

* Re: RFC: change "program exited" message
  2011-03-04 19:23       ` Tom Tromey
@ 2011-03-04 19:38         ` Pedro Alves
  2011-03-07 16:17           ` Tom Tromey
  0 siblings, 1 reply; 20+ messages in thread
From: Pedro Alves @ 2011-03-04 19:38 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

On Friday 04 March 2011 19:23:03, Tom Tromey wrote:
> >>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
> 
> Pedro> (Do we actually need gdb_continue_off_end?  It seemed
> Pedro> like in all but a couple of cases it was the same
> Pedro> as gdb_continue_to_end, except that the new function
> Pedro> doesn't handle using stubs.)
> 
> I was not sure that this was safe to do.

It is.  You'd even be fixing testsuite hangs and
timeouts for targets that require the stubs, as with
those you'll never see the "exited normally" message.
(I don't think I ever saw such a target though.  Still.)

> --- a/gdb/testsuite/gdb.base/langs.exp
> +++ b/gdb/testsuite/gdb.base/langs.exp
> @@ -146,8 +146,7 @@ if [runto csub] then {
>         gdb_breakpoint "exit"
>         gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
>      } else {
> -       gdb_test "cont" "Program exited normally\\..*" \
> -               "continue to exit in langs.exp"
> +       gdb_continue_off_end
>      }
>  }
>  

This whole if/then/else could be replaced with
gdb_continue_to_end even, it looks like it's just
like just an inlining of the same thing.

> If you think it is ok, I can make that change.

-- 
Pedro Alves

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

* Re: RFC: change "program exited" message
  2011-03-04 19:38         ` Pedro Alves
@ 2011-03-07 16:17           ` Tom Tromey
  2011-03-08  9:43             ` Regression: [Re: RFC: change "program exited" message] Jan Kratochvil
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2011-03-07 16:17 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Pedro> (Do we actually need gdb_continue_off_end?  It seemed
Pedro> like in all but a couple of cases it was the same
Pedro> as gdb_continue_to_end, except that the new function
Pedro> doesn't handle using stubs.)

Tom> I was not sure that this was safe to do.

Pedro> It is. [...]

Ok.  Here is the version I am checking in.
Built and regtested on x86-64 (compile farm).

Tom

2011-03-07  Tom Tromey  <tromey@redhat.com>

	* infrun.c (print_exited_reason): Include inferior id and pid in
	message.

2011-03-07  Tom Tromey  <tromey@redhat.com>

	* lib/opencl.exp (skip_opencl_tests): Update for exit message
	change.
	* lib/mi-support.exp (mi_gdb_test): Update for exit message
	change.
	* lib/gdb.exp (gdb_test_multiple): Update comment.  Update for
	exit message change.
	(skip_altivec_tests): Update for exit message change.
	(skip_vsx_tests): Likewise.
	(gdb_continue_to_end): Likewise.  Add 'command' argument.
	* lib/cell.exp (skip_cell_tests): Update for exit message change.
	* gdb.threads/tls.exp: Update for exit message change.
	* gdb.threads/thread-unwindonsignal.exp: Use
	gdb_continue_to_end.
	* gdb.threads/step.exp (step_it): Update for exit message change.
	(continue_all): Likewise.
	* gdb.threads/print-threads.exp (test_all_threads): Update for
	exit message change.
	* gdb.threads/interrupted-hand-call.exp: Use
	gdb_continue_to_end.
	* gdb.threads/execl.exp: Use gdb_continue_to_end.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Use
	gdb_continue_to_end.
	* gdb.hp/gdb.objdbg/objdbg02.exp: Use gdb_continue_to_end.
	* gdb.hp/gdb.objdbg/objdbg01.exp: Use gdb_continue_to_end.
	* gdb.hp/gdb.defects/solib-d.exp: Update for exit message change.
	* gdb.cp/method.exp: Update for exit message change.
	* gdb.cp/mb-templates.exp: Update for exit message change.
	* gdb.cp/mb-inline.exp: Use gdb_continue_to_end.
	* gdb.cp/annota3.exp: Update for exit message change.
	* gdb.cp/annota2.exp: Update for exit message change.
	* gdb.cell/fork.exp: Use gdb_continue_to_end.
	* gdb.base/term.exp: Update for exit message change.
	* gdb.base/step-test.exp (test_i): Update for exit message change.
	* gdb.base/sigstep.exp (advance): Update for exit message change.
	(advancei): Likewise.
	* gdb.base/siginfo.exp: Update for exit message change.
	* gdb.base/shlib-call.exp: Use gdb_continue_to_end.
	* gdb.base/reread.exp: Use gdb_continue_to_end.
	* gdb.base/langs.exp: Use gdb_continue_to_end.
	* gdb.base/interrupt.exp: Update for exit message change.
	* gdb.base/gdb1555.exp: Update for exit message change.
	* gdb.base/exe-lock.exp: Use gdb_continue_to_end.
	* gdb.base/ending-run.exp: Update for exit message change.
	* gdb.base/chng-syms.exp: Update for exit message change.
	* gdb.base/checkpoint.exp: Update for exit message change.
	* gdb.base/catch-syscall.exp (check_for_program_end): Use
	gdb_continue_to_end.
	(test_catch_syscall_with_wrong_args): Likewise.
	* gdb.base/call-signal-resume.exp: Use gdb_continue_to_end.
	* gdb.base/break-interp.exp (test_ld): Update for exit message
	change.
	* gdb.base/bang.exp: Update for exit message change.
	* gdb.base/attach.exp (do_attach_tests): Use gdb_continue_to_end.
	(do_call_attach_tests): Likewise.
	* gdb.base/a2-run.exp: Update for exit message change.
	* gdb.arch/ppc-dfp.exp: Update for exit message change.
	* gdb.ada/tasks.exp: Use gdb_continue_to_end.
	* gdb.ada/catch_ex.exp: Use gdb_continue_to_end.

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 274082d..ba40c6c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5488,22 +5488,33 @@ print_signal_exited_reason (enum target_signal siggnal)
 static void
 print_exited_reason (int exitstatus)
 {
+  struct inferior *inf = current_inferior ();
+  const char *pidstr = target_pid_to_str (pid_to_ptid (inf->pid));
+
   annotate_exited (exitstatus);
   if (exitstatus)
     {
       if (ui_out_is_mi_like_p (uiout))
 	ui_out_field_string (uiout, "reason", 
 			     async_reason_lookup (EXEC_ASYNC_EXITED));
-      ui_out_text (uiout, "\nProgram exited with code ");
+      ui_out_text (uiout, "[Inferior ");
+      ui_out_text (uiout, plongest (inf->num));
+      ui_out_text (uiout, " (");
+      ui_out_text (uiout, pidstr);
+      ui_out_text (uiout, ") exited with code ");
       ui_out_field_fmt (uiout, "exit-code", "0%o", (unsigned int) exitstatus);
-      ui_out_text (uiout, ".\n");
+      ui_out_text (uiout, "]\n");
     }
   else
     {
       if (ui_out_is_mi_like_p (uiout))
 	ui_out_field_string
 	  (uiout, "reason", async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
-      ui_out_text (uiout, "\nProgram exited normally.\n");
+      ui_out_text (uiout, "[Inferior ");
+      ui_out_text (uiout, plongest (inf->num));
+      ui_out_text (uiout, " (");
+      ui_out_text (uiout, pidstr);
+      ui_out_text (uiout, ") exited normally]\n");
     }
   /* Support the --return-child-result option.  */
   return_child_result_value = exitstatus;
diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index b0a4000..6a98089 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -141,8 +141,6 @@ gdb_test "continue" \
          "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
          "continuing to unhandled exception"
 
-gdb_test "continue" \
-         "Continuing\..*Program exited.*" \
-         "continuing to program completion"
+gdb_continue_to_end 
 
 
diff --git a/gdb/testsuite/gdb.ada/tasks.exp b/gdb/testsuite/gdb.ada/tasks.exp
index bced9f8..aa8bf46 100644
--- a/gdb/testsuite/gdb.ada/tasks.exp
+++ b/gdb/testsuite/gdb.ada/tasks.exp
@@ -70,7 +70,5 @@ gdb_test "info tasks" \
 # Now, resume the execution and make sure that GDB does not stop when
 # task 4 hits the breakpoint. Continuing thus results in our program
 # running to completion.
-gdb_test "continue" \
-         ".*Program exited normally\..*" \
-         "continue until end of program"
+gdb_continue_to_end
 
diff --git a/gdb/testsuite/gdb.arch/ppc-dfp.exp b/gdb/testsuite/gdb.arch/ppc-dfp.exp
index 10fbd3c..bf20b89 100644
--- a/gdb/testsuite/gdb.arch/ppc-dfp.exp
+++ b/gdb/testsuite/gdb.arch/ppc-dfp.exp
@@ -59,7 +59,7 @@ gdb_run_cmd
 # When the prompt comes back we'll be at the Set DFP rounding mode breakpoint.
 # Unless the program bails out after checking AT_HWCAP.
 gdb_expect {
-  -re "Program exited with code 01.\[\r\n\]+$gdb_prompt $" {
+  -re "$inferior_exited_re with code 01.\[\r\n\]+$gdb_prompt $" {
     unsupported "This machine doesn't support Decimal Floating Point."
     return -1
   }
diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp
index d26a202..cb1e6fd 100644
--- a/gdb/testsuite/gdb.base/a2-run.exp
+++ b/gdb/testsuite/gdb.base/a2-run.exp
@@ -42,7 +42,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" with no args"
 	}
 	 -re "usage:  factorial <number>" {
@@ -57,19 +57,19 @@ if [istarget "*-*-vxworks*"] then {
     gdb_expect -re "$gdb_prompt $" {}
 } else {
     gdb_expect {
-	-re ".*usage:  factorial <number>.*Program exited with code 01\.\r\n$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.*$inferior_exited_re with code 01.\r\n$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args"
 	    pass "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.*Program exited with code 01.*$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.*$inferior_exited_re with code 01.*$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args"
 	    fail "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally\.\r\n$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.* EXIT code 1.*$inferior_exited_re normally.\r\n$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args (exit wrapper)"
 	    pass "no spurious messages at program exit"
 	}
-	-re ".*usage:  factorial <number>.* EXIT code 1.*Program exited normally.*$gdb_prompt $" {
+	-re ".*usage:  factorial <number>.* EXIT code 1.*$inferior_exited_re normally.*$gdb_prompt $" {
 	    pass "run \"$testfile\" with no args (exit wrapper)"
 	    fail "no spurious messages at program exit"
 	}
@@ -97,7 +97,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" with arg"
 	}
 	 "120" {
@@ -129,7 +129,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" again with same args"
 	}
 	 "120" { pass "run \"$testfile\" again with same args" }
@@ -161,7 +161,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run after setting args to nil"
 	}
 	 "usage:  factorial <number>" {
@@ -202,7 +202,7 @@ if [istarget "*-*-vxworks*"] then {
     set timeout 120
     verbose "Timeout is now $timeout seconds" 2
     gdb_expect {
-	 "Program exited normally" {
+	 "$inferior_exited_re normally" {
 	    unresolved "run \"$testfile\" again after setting args"
 	}
 	 "720" {
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 78df003..654ad7a 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -258,7 +258,7 @@ proc do_attach_tests {} {
 
     # Allow the test process to exit, to cleanup after ourselves.
 
-    gdb_test "continue" "Program exited normally." "after attach2, exit"
+    gdb_continue_to_end "after attach2, exit"
 
     # Make sure we don't leave a process around to confuse
     # the next test run (and prevent the compile by keeping
@@ -365,7 +365,7 @@ proc do_call_attach_tests {} {
     # Get rid of the process
     
     gdb_test "p should_exit = 1"
-    gdb_test "c" "Program exited normally."
+    gdb_continue_to_end
    
     # Be paranoid
    
diff --git a/gdb/testsuite/gdb.base/bang.exp b/gdb/testsuite/gdb.base/bang.exp
index efe2295..9326311 100644
--- a/gdb/testsuite/gdb.base/bang.exp
+++ b/gdb/testsuite/gdb.base/bang.exp
@@ -39,7 +39,7 @@ gdb_load ${binfile}
 
 gdb_run_cmd
 gdb_expect {
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
         pass "run program"
     }
     timeout {
diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
index 3df4dcb..fe79cae 100644
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -365,7 +365,7 @@ proc test_attach {file displacement {relink_args ""}} {
 }
 
 proc test_ld {file ifmain trynosym displacement} {
-    global srcdir subdir gdb_prompt expect_out
+    global srcdir subdir gdb_prompt expect_out inferior_exited_re
 
     # First test normal `file'-command loaded $FILE with symbols.
 
@@ -494,7 +494,7 @@ proc test_ld {file ifmain trynosym displacement} {
 		}
 		exp_continue
 	    }
-	    -re "Program exited (normally|with code \[0-9\]+)\\.\r\n$gdb_prompt $" {
+	    -re "$inferior_exited_re (normally|with code \[0-9\]+).\r\n$gdb_prompt $" {
 		# Do not check the binary filename as it may be truncated.
 		pass $test
 	    }
diff --git a/gdb/testsuite/gdb.base/call-signal-resume.exp b/gdb/testsuite/gdb.base/call-signal-resume.exp
index b85691c..c8ca941 100644
--- a/gdb/testsuite/gdb.base/call-signal-resume.exp
+++ b/gdb/testsuite/gdb.base/call-signal-resume.exp
@@ -146,7 +146,6 @@ gdb_test "continue" "Breakpoint \[0-9\]*, handle_signal.*" \
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_to_end
 
 return 0
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index d25df17..96884c4 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -166,8 +166,7 @@ proc check_for_program_end {} {
     # Deleting the catchpoints
     delete_breakpoints
 
-    set thistest "successful program end"
-    gdb_test "continue" "Program exited normally.*" $thistest
+    gdb_continue_to_end
 
 }
 
@@ -231,7 +230,7 @@ proc test_catch_syscall_with_wrong_args {} {
     # If it doesn't, everything is right (since we don't have
     # a syscall named "mlock" in it).  Otherwise, this is a failure.
     set thistest "catch syscall with unused syscall ($syscall_name)"
-    gdb_test "continue" "Program exited normally.*" $thistest
+    gdb_continue_to_end $thistest
 }
 
 proc test_catch_syscall_restarting_inferior {} {
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index f34b0d1..c3b2008 100644
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -277,23 +277,23 @@ gdb_test "print ftell (out) > 100000" " = 1.*" "outfile still open 10"
 
 delete_breakpoints
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork one"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork two"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork three"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork four"
 
 gdb_test "continue" \
-    "Deleting copy.*Program exited normally.*Switching to.*" \
+    "Deleting copy.*$inferior_exited_re normally.*Switching to.*" \
     "Exit, dropped into next fork five"
 
 #
diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp
index d2567e7..9478d0c 100644
--- a/gdb/testsuite/gdb.base/chng-syms.exp
+++ b/gdb/testsuite/gdb.base/chng-syms.exp
@@ -100,7 +100,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
 
     gdb_run_cmd
     gdb_expect {
-	-re ".*Program exited normally.*$gdb_prompt $" {
+	-re ".*$inferior_exited_re normally.*$gdb_prompt $" {
 	    pass "running with invalidated bpt condition after executable changes" 
 	}
 	-re ".*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index 43c46f8..9d1134d 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -146,7 +146,7 @@ gdb_test_multiple "next" "step out of main" {
 	# This is what happens on mingw32ce.
 	pass "step out of main"
     }
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
 	# This is what happens on Linux i86 (and I would expect others)
 	set program_exited 1
 	pass "step out of main"
@@ -209,21 +209,21 @@ if {! [target_info exists use_gdb_stub]
     global program_exited;
     if {[eval expr $program_exited == 0]} {
 	gdb_test_multiple "n" "step to end of run" {
-	    -re "Program exited normally.*$gdb_prompt $" {
+	    -re "$inferior_exited_re normally.*$gdb_prompt $" {
 		# If we actually have debug info for the start function,
 		# then we won't get the "Single-stepping until function
 		# exit" message.
 		pass "step to end of run"
 		set program_exited_normally 1
 	    }
-	    -re "Single.*EXIT code 0\r\n.*Program exited normally.*$gdb_prompt $" {
+	    -re "Single.*EXIT code 0\r\n.*$inferior_exited_re normally.*$gdb_prompt $" {
 		pass "step to end of run (status wrapper)"
 		set program_exited_normally 1
 	    }
 	    -re "Single.*EXIT code 0\r\n.*$gdb_prompt $" {
 		pass "step to end of run (status wrapper)"
 	    }
-	    -re ".*Single.*Program exited.*$gdb_prompt $" {
+	    -re ".*Single.*$inferior_exited_re.*$gdb_prompt $" {
 		pass "step to end of run"
 		set program_exited_normally 1
 	    }
diff --git a/gdb/testsuite/gdb.base/exe-lock.exp b/gdb/testsuite/gdb.base/exe-lock.exp
index e4bbbbe..0ac0672 100644
--- a/gdb/testsuite/gdb.base/exe-lock.exp
+++ b/gdb/testsuite/gdb.base/exe-lock.exp
@@ -50,9 +50,7 @@ if ![runto_main] then {
     continue
 }
 
-gdb_test "continue" \
-         ".*Program exited normally\\." \
-         "continue until program exits"
+gdb_continue_to_end
 
 # Try deleting the executable file, now that the program has exited,
 # and make sure that the deletion worked by verifying that the exe
diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp
index 8c3e8ba..ed6b073 100644
--- a/gdb/testsuite/gdb.base/gdb1555.exp
+++ b/gdb/testsuite/gdb.base/gdb1555.exp
@@ -77,7 +77,7 @@ gdb_test_multiple "n" $name \
     -re "\[0-9\]+.*return a;.*$gdb_prompt $" {
 	pass $name
     }
-    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\nProgram exited normally.*$gdb_prompt $" { 
+    -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" { 
 	kfail "gdb/1555" $name 
     }
 }
diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp
index cce7fca..4562199 100644
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -201,7 +201,7 @@ if ![file exists $binfile] then {
 
 	send_gdb "\004"
 	gdb_expect {
-	    -re "end of file.*Program exited normally.*$gdb_prompt $" {
+	    -re "end of file.*$inferior_exited_re normally.*$gdb_prompt $" {
 		pass "send end of file"
 	    }
 	    -re "$gdb_prompt $" { fail "send end of file" }
diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp
index a42f2d8..e4f3450 100644
--- a/gdb/testsuite/gdb.base/langs.exp
+++ b/gdb/testsuite/gdb.base/langs.exp
@@ -142,13 +142,7 @@ if [runto csub] then {
 
     if [target_info exists gdb,noresults] { return }
 
-    if [target_info exists use_gdb_stub] {
-	gdb_breakpoint "exit"
-	gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
-    } else {
-	gdb_test "cont" "Program exited normally\\..*" \
-		"continue to exit in langs.exp"
-    }
+    gdb_continue_to_end "langs.exp"
 }
 
 gdb_exit
diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp
index e562285..78d1126 100644
--- a/gdb/testsuite/gdb.base/reread.exp
+++ b/gdb/testsuite/gdb.base/reread.exp
@@ -149,8 +149,7 @@ if [is_remote target] {
 
     # This time, let the program run to completion.  If GDB checks the
     # executable file's timestamp now, it won't notice any change.
-    gdb_test "continue" ".*Program exited.*" \
-            "second pass: continue to completion"
+    gdb_continue_to_end "second pass"
     
     # Now move the newer executable into place, and re-run.  GDB
     # should still notice that the executable file has changed,
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index f8601c7..ba484f0 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -182,12 +182,12 @@ if ![is_remote target] {
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"run to bp in shared library"
 
-  gdb_test "cont" ".*Program exited normally..*"
+  gdb_continue_to_end
 
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"re-run to bp in shared library (PR's 16495, 18213)"
 
-  gdb_test "cont" ".*Program exited normally..*"
+  gdb_continue_to_end
 }
 
 return 0
diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
index db9fd5c..602c63b 100644
--- a/gdb/testsuite/gdb.base/siginfo.exp
+++ b/gdb/testsuite/gdb.base/siginfo.exp
@@ -83,7 +83,7 @@ gdb_test_multiple "step" "${test}" {
 	send_gdb "step\n"
 	exp_continue
     }
-    -re "Program exited normally.*${gdb_prompt} $" {
+    -re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	kfail gdb/1613 "$test (program exited)"
     }
     -re "(while ..done|return 0).*${gdb_prompt} $" {
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index 98e0e3d..d43cf0a 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -68,7 +68,7 @@ gdb_test_sequence "bt" "backtrace for nexti" {
 }
 
 proc advance { i } {
-    global gdb_prompt
+    global gdb_prompt inferior_exited_re
     set prefix "$i from handler"
 
     # Get us back into the handler
@@ -88,7 +88,7 @@ proc advance { i } {
 	    send_gdb "$i\n"
 	    exp_continue -continue_timer
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	    setup_kfail gdb/1639 powerpc-*-*bsd*
 	    fail "$test (program exited)"
 	}
@@ -105,7 +105,7 @@ proc advance { i } {
 }
 
 proc advancei { i } {
-    global gdb_prompt
+    global gdb_prompt inferior_exited_re
     set prefix "$i from handleri"
     set program_exited 0
 
@@ -144,7 +144,7 @@ proc advancei { i } {
 	-re "main .*${gdb_prompt} $" {
 	    fail "$test (in main)"
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	    fail "$test (program exited)"
 	    set program_exited 1
 	}
@@ -170,7 +170,7 @@ proc advancei { i } {
 	    send_gdb "y\n"
 	    exp_continue -continue_timer
 	}
-	-re "Program exited normally.*${gdb_prompt} $" {
+	-re "$inferior_exited_re normally.*${gdb_prompt} $" {
 	    kfail gdb/1639 "$test (program exited)"
 	    set program_exited 1
 	}
diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
index 1c48812..24116d6 100644
--- a/gdb/testsuite/gdb.base/step-test.exp
+++ b/gdb/testsuite/gdb.base/step-test.exp
@@ -150,7 +150,7 @@ gdb_test_multiple "finish" "$test" {
     -re ".*${decimal}.*callee.*NEXTI.*$gdb_prompt $" {
 	pass "$test"
     }
-    -re ".*(Program received|Program exited).*$gdb_prompt $" {
+    -re ".*(Program received|$inferior_exited_re).*$gdb_prompt $" {
 	# Oops... We ran to the end of the program...  Better reset     
 	if {![runto_main]} then {
 	    fail "$test (Can't run to main)"
diff --git a/gdb/testsuite/gdb.base/term.exp b/gdb/testsuite/gdb.base/term.exp
index 049a88b..d4d1d83 100644
--- a/gdb/testsuite/gdb.base/term.exp
+++ b/gdb/testsuite/gdb.base/term.exp
@@ -47,7 +47,7 @@ gdb_test_no_output "set width 0"
 gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
 gdb_run_cmd 5
 gdb_expect {
-    -re ".*120.*Program exited normally.*$gdb_prompt $" {
+    -re ".*120.*$inferior_exited_re normally.*$gdb_prompt $" {
 	gdb_test "info terminal" "No saved terminal information.*" "test info terminal #2"
     }
     default {
diff --git a/gdb/testsuite/gdb.cell/fork.exp b/gdb/testsuite/gdb.cell/fork.exp
index 3fdfc25..ad5c75a 100644
--- a/gdb/testsuite/gdb.cell/fork.exp
+++ b/gdb/testsuite/gdb.cell/fork.exp
@@ -77,8 +77,7 @@ gdb_test_no_output "delete \$bpnum" "delete watchpoint"
 gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, func \\(\\) at .*$spu_file.c:.*" \
 	 "run until breakpoint hit"
 
-gdb_test "continue" "Continuing\\..*Program exited normally.*" \
-	 "run until end"
+gdb_continue_to_end
 
 gdb_exit
 
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index a48e2ea..4092a43 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -116,7 +116,7 @@ gdb_test_multiple "print a" "print class" {
 # `a.x is 1' is asynchronous regarding to `frames-invalid'.
 #
 gdb_test_multiple "continue" "continue until exit" {
-    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n.$inferior_exited_re normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
 	pass "continue until exit"
     }
 }
diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
index 17021fb..a2b5d22 100644
--- a/gdb/testsuite/gdb.cp/annota3.exp
+++ b/gdb/testsuite/gdb.cp/annota3.exp
@@ -122,8 +122,7 @@ gdb_expect_list "continue to exit" "$gdb_prompt$" {
     "\r\n\032\032starting\r\n"
     "a.x is 1\r\n"
     "\r\n\032\032exited 0\r\n"
-    "\r\n"
-    "Program exited normally.\r\n"
+    ".$inferior_exited_re normally.\r\n"
     "\r\n\032\032stopped\r\n"
 }
 
diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
index 46d7cc2..c8f90d0 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.exp
+++ b/gdb/testsuite/gdb.cp/mb-inline.exp
@@ -101,9 +101,7 @@ gdb_expect {
     }
 }
 
-gdb_test "continue" \
-    ".*Program exited normally.*" \
-    "continue with disabled breakpoint 1.2"
+gdb_continue_to_end "disabled breakpoint 1.2"
 
 # Make sure we can set a breakpoint on a source statement that spans
 # multiple lines.
diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp
index 2f8f091..80c080b 100644
--- a/gdb/testsuite/gdb.cp/mb-templates.exp
+++ b/gdb/testsuite/gdb.cp/mb-templates.exp
@@ -129,7 +129,7 @@ gdb_test_no_output "disable 1" "disable breakpoint: disable"
 
 gdb_run_cmd
 gdb_expect {
-    -re "Program exited normally.*$gdb_prompt $" {
+    -re "$inferior_exited_re normally.*$gdb_prompt $" {
 	pass "disable breakpoint: run to breakpoint"
     }
     -re "$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp
index 848a06d..fff718d 100644
--- a/gdb/testsuite/gdb.cp/method.exp
+++ b/gdb/testsuite/gdb.cp/method.exp
@@ -175,10 +175,10 @@ gdb_test_multiple "ptype A" "ptype A" {
 }
 
 gdb_test_multiple "cont" "finish program" {
-    -re "Continuing.\r\n\r\nProgram exited normally.*$gdb_prompt $" {
+    -re "Continuing.\r\n$inferior_exited_re normally.*$gdb_prompt $" {
 	pass "finish program"
     }
-    -re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" {
+    -re "Continuing.* EXIT code 0.*$inferior_exited_re normally.*$gdb_prompt $" {
 	pass "finish program (exit wrapper)" 
     }
 }
diff --git a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
index 497f7de..6be6d44 100644
--- a/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
+++ b/gdb/testsuite/gdb.hp/gdb.defects/solib-d.exp
@@ -132,7 +132,7 @@ gdb_expect {
     -re ".*solib-d1.*$gdb_prompt $" {
         pass "Catch implicit load at startup"
     }
-    -re "Program exited.*$gdb_prompt $" {
+    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
         fail "CLLbs14756 || CLLbs16090 came back ???"
     }
     timeout { fail "(timeout) implicit library load" }
@@ -228,7 +228,7 @@ gdb_expect {
     -re "Stopped due to shared library event.*$gdb_prompt $" {
         pass "stop for shlib event"
     }
-    -re "Program exited.*$gdb_prompt $" {
+    -re "Inferior \[0-9\]+ exited.*$gdb_prompt $" {
         fail "Bug CLLbs16090 came back ?"
     }
     timeout { fail "(timeout) stop for shlib event " }
diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
index f743825..b4e33d1 100644
--- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
+++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg01.exp
@@ -130,10 +130,10 @@ for {set filenum 0} {$filenum < 2} {incr filenum 1} {
         gdb_test "s 1" ".*25.*"
         if [istarget "hppa64-*-*"] {
             gdb_test "s 1" "0x\[0-9a-f\]+ in .*"
-            gdb_test "c" ".*Program exited normally.*"
+	    gdb_continue_to_end
         } else {
             gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
-            gdb_test "s 1" ".*Program exited normally.*"
+            gdb_continue_to_end "" "s 1"
         }
     }
 
diff --git a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
index c336498..027c77e 100644
--- a/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
+++ b/gdb/testsuite/gdb.hp/gdb.objdbg/objdbg02.exp
@@ -78,9 +78,9 @@ gdb_test "s 1" "main .*/x1.cc:15.*"
 gdb_test "s 1" ".*16.*"
 if [istarget "hppa64-*-*"] {
     gdb_test "s 1" "0x\[0-9a-f\]+ in .*START.*"
-    gdb_test "c" ".*Program exited normally.*"
+    gdb_continue_to_end
 } else {
     gdb_test "s 1" "0x\[0-9a-f\]+ in _start .*"
-    gdb_test "s 1" ".*Program exited normally.*"
+    gdb_continue_to_end "" "s 1"
 }
 
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 81de5a2..c5033c9 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -105,7 +105,7 @@ proc run_lang_tests {lang} {
     gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \
 	"print nstype on one line"
 
-    gdb_test "continue" "Program exited normally\."
+    gdb_continue_to_end
 
     remote_file host delete ${remote_python_file}
 }
diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
index 863c7cf..111068d 100644
--- a/gdb/testsuite/gdb.threads/execl.exp
+++ b/gdb/testsuite/gdb.threads/execl.exp
@@ -71,5 +71,4 @@ gdb_test_multiple "info threads" "$test" {
     }
 }
 
-gdb_test "continue" ".*Program exited normally\\." \
-    "continue to end"
+gdb_continue_to_end
diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
index cb0bc3d..865bc2f 100644
--- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
+++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
@@ -86,7 +86,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_to_end
 
 return 0
diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp
index d221fbd..6cf42ef 100644
--- a/gdb/testsuite/gdb.threads/print-threads.exp
+++ b/gdb/testsuite/gdb.threads/print-threads.exp
@@ -59,7 +59,7 @@ if ![istarget "*-*-ultrix*"] then {
 }
 
 proc test_all_threads { name kill } {
-    global gdb_prompt
+    global gdb_prompt inferior_exited_re
 
     set i 0
     set j 0
@@ -80,7 +80,7 @@ proc test_all_threads { name kill } {
 	    send_gdb "continue\n"
 	    exp_continue
 	}
-	-re "Program exited normally\\.\[\r\n\]+$gdb_prompt" {
+	-re "$inferior_exited_re normally.\[\r\n\]+$gdb_prompt" {
 	    pass "program exited normally"
 	    if {$i == 5} {
 		pass "all threads ran once ($name)"
diff --git a/gdb/testsuite/gdb.threads/step.exp b/gdb/testsuite/gdb.threads/step.exp
index c051196..36c0403 100644
--- a/gdb/testsuite/gdb.threads/step.exp
+++ b/gdb/testsuite/gdb.threads/step.exp
@@ -57,12 +57,13 @@ proc set_bp { where } {
 proc step_it { cmd } {
     global gdb_prompt
     global program_exited
+    global inferior_exited_re
 
     send_gdb "$cmd\n"
     gdb_expect {
 	-re "0x\[0-9A-Fa-f\]* *in.*\r\n$gdb_prompt $" { pass "step_it"; return 0 }
 	-re "0x\[0-9A-Fa-f\]* *\[0-9\]*.*\r\n$gdb_prompt $" { pass "step_it"; return 1 }
-	-re "Program exited .*\n$gdb_prompt $" {
+	-re "$inferior_exited_re .*\n$gdb_prompt $" {
 		set program_exited 1
 		return -1
 	    }
@@ -81,6 +82,7 @@ proc step_source {} {
 
 proc continue_all {} {
     global gdb_prompt
+    global inferior_exited_re
 
     send_gdb "continue\n"
     gdb_expect {
@@ -88,7 +90,7 @@ proc continue_all {} {
 	    pass "continue_all"
 	    return 0
 	}
-	-re "Program exited .*\n$gdb_prompt $" {
+	-re "$inferior_exited_re .*\n$gdb_prompt $" {
 	    set program_exited 1
 	    return 1;
 	}
diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
index 6faabf5..c6ae1a5 100644
--- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
+++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
@@ -110,7 +110,6 @@ gdb_test_multiple "maint print dummy-frames" "dummy frame popped" {
 
 # Continue one last time, the program should exit normally.
 
-gdb_test "continue" "Program exited normally." \
-    "continue to program exit"
+gdb_continue_to_end
 
 return 0
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index 0e63120..d7dce0db 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -177,7 +177,7 @@ gdb_expect {
         unsupported "continue to first thread: system does not support TLS"
         return -1
     }
-    -re ".*Program exited normally.*$gdb_prompt $" {
+    -re ".*$inferior_exited_re normally.*$gdb_prompt $" {
         fail "continue to first thread: program runaway"
     }
     -re ".*Pass 0 done.*Pass 1 done.*$gdb_prompt $" {
diff --git a/gdb/testsuite/lib/cell.exp b/gdb/testsuite/lib/cell.exp
index 4cc7ee0..75ac210 100644
--- a/gdb/testsuite/lib/cell.exp
+++ b/gdb/testsuite/lib/cell.exp
@@ -72,7 +72,7 @@ proc gdb_cell_embedspu {source dest options} {
 # Return 0 if so, 1 if it does not.
 proc skip_cell_tests {} {
     global skip_cell_tests_saved
-    global srcdir subdir gdb_prompt
+    global srcdir subdir gdb_prompt inferior_exited_re
 
     # Use the cached value, if it exists.
     set me "skip_cell_tests"
@@ -136,11 +136,11 @@ proc skip_cell_tests {} {
     gdb_load "$exe"
     gdb_run_cmd
     gdb_expect {
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: Cell/B.E. hardware detected"
             set skip_cell_tests_saved 0
         }
-        -re ".*Program exited with code.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re with code.*${gdb_prompt} $" {
             verbose -log "\n$me: Cell/B.E. hardware not detected"
             set skip_cell_tests_saved 1
         }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 44d449a..3af8568 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -99,6 +99,8 @@ if ![info exists env(EXEEXT)] {
 
 set octal "\[0-7\]+"
 
+set inferior_exited_re "Inferior \[0-9\]+ \\(.*\\) exited"
+
 ### Only procedures should come after this point.
 
 #
@@ -572,13 +574,14 @@ proc gdb_internal_error_resync {} {
 #    }
 # }
 #
-# The standard patterns, such as "Program exited..." and "A problem
+# The standard patterns, such as "Inferior exited..." and "A problem
 # ...", all being implicitly appended to that list.
 #
 proc gdb_test_multiple { command message user_code } {
     global verbose
     global gdb_prompt
     global GDB
+    global inferior_exited_re
     upvar timeout timeout
     upvar expect_out expect_out
 
@@ -755,7 +758,7 @@ proc gdb_test_multiple { command message user_code } {
             fail "$message"
 	    set result 1
 	}
-	 -re "Program exited with code \[0-9\]+.*$gdb_prompt $" {
+	 -re "$inferior_exited_re with code \[0-9\]+.*$gdb_prompt $" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
@@ -764,7 +767,7 @@ proc gdb_test_multiple { command message user_code } {
 	    fail "$errmsg"
 	    set result -1
 	}
-	 -re "Program exited normally.*$gdb_prompt $" {
+	 -re "$inferior_exited_re normally.*$gdb_prompt $" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
@@ -1573,7 +1576,7 @@ proc is_lp64_target {} {
 
 proc skip_altivec_tests {} {
     global skip_vmx_tests_saved
-    global srcdir subdir gdb_prompt
+    global srcdir subdir gdb_prompt inferior_exited_re
 
     # Use the cached value, if it exists.
     set me "skip_altivec_tests"
@@ -1640,7 +1643,7 @@ proc skip_altivec_tests {} {
             verbose -log "\n$me altivec hardware not detected" 
             set skip_vmx_tests_saved 1
         }
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: altivec hardware detected" 
             set skip_vmx_tests_saved 0
         }
@@ -1661,7 +1664,7 @@ proc skip_altivec_tests {} {
 
 proc skip_vsx_tests {} {
     global skip_vsx_tests_saved
-    global srcdir subdir gdb_prompt
+    global srcdir subdir gdb_prompt inferior_exited_re
 
     # Use the cached value, if it exists.
     set me "skip_vsx_tests"
@@ -1727,7 +1730,7 @@ proc skip_vsx_tests {} {
             verbose -log "\n$me VSX hardware not detected"
             set skip_vsx_tests_saved 1
         }
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: VSX hardware detected"
             set skip_vsx_tests_saved 0
         }
@@ -3055,22 +3058,32 @@ proc gdb_get_line_number { text { file "" } } {
 #       stub is used, we set a breakpoint at exit because we cannot rely on
 #       exit() behavior of a remote target.
 # 
-# mssg is the error message that gets printed.
+# MSSG is the error message that gets printed.  If not given, a
+#	default is used.
+# COMMAND is the command to invoke.  If not given, "continue" is
+#	used.
+
+proc gdb_continue_to_end {{mssg ""} {command continue}} {
+  global inferior_exited_re
 
-proc gdb_continue_to_end {mssg} {
+  if {$mssg == ""} {
+      set text "continue until exit"
+  } else {
+      set text "continue until exit at $mssg"
+  }
   if [target_info exists use_gdb_stub] {
     if {![gdb_breakpoint "exit"]} {
       return 0
     }
     gdb_test "continue" "Continuing..*Breakpoint .*exit.*" \
-      "continue until exit at $mssg"
+	$text
   } else {
     # Continue until we exit.  Should not stop again.
     # Don't bother to check the output of the program, that may be
     # extremely tough for some remote systems.
     gdb_test "continue"\
-      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|Program exited normally\\.).*"\
-      "continue until exit at $mssg"
+      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\
+	$text
   }
 }
 
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 6b25f69..e75a4f5 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -575,6 +575,7 @@ proc mi_gdb_test { args } {
     global verbose
     global mi_gdb_prompt
     global GDB expect_out
+    global inferior_exited_re
     upvar timeout timeout
 
     set command [lindex $args 0]
@@ -698,7 +699,7 @@ proc mi_gdb_test { args } {
             fail "$message"
 	    set result 1
 	}
-	 -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
+	 -re "$inferior_exited_re with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {
 	    if ![string match "" $message] then {
 		set errmsg "$message (the program exited)"
 	    } else {
diff --git a/gdb/testsuite/lib/opencl.exp b/gdb/testsuite/lib/opencl.exp
index c1b5291..dfd6a57 100644
--- a/gdb/testsuite/lib/opencl.exp
+++ b/gdb/testsuite/lib/opencl.exp
@@ -31,6 +31,7 @@ proc gdb_compile_opencl_hostapp {clsource executable options} {
 # it does not.
 proc skip_opencl_tests {} {
     global skip_opencl_tests_saved srcdir objdir subdir gdb_prompt
+    global inferior_exited_re
 
     # Use the cached value, if it exists.  Cache value per "board" to handle
     # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
@@ -59,11 +60,11 @@ proc skip_opencl_tests {} {
     clean_restart "$executable"
     gdb_run_cmd
     gdb_expect 30 {
-        -re ".*Program exited normally.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re normally.*${gdb_prompt} $" {
             verbose -log "\n$me: OpenCL support detected"
             set skip_opencl_tests_saved($board) 0
         }
-        -re ".*Program exited with code.*${gdb_prompt} $" {
+        -re ".*$inferior_exited_re code.*${gdb_prompt} $" {
             verbose -log "\n$me: OpenCL support not detected"
             set skip_opencl_tests_saved($board) 1
         }

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

* Regression:  [Re: RFC: change "program exited" message]
  2011-03-07 16:17           ` Tom Tromey
@ 2011-03-08  9:43             ` Jan Kratochvil
  2011-03-08 15:11               ` Tom Tromey
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kratochvil @ 2011-03-08  9:43 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

On Mon, 07 Mar 2011 16:58:16 +0100, Tom Tromey wrote:
> Ok.  Here is the version I am checking in.
> Built and regtested on x86-64 (compile farm).

This has a heavy regression for me such as:
FAIL: gdb.base/break.exp: continue until exit at recursive next test (the program exited)

This is a regression by:
	67f954c319369009fa2f4262ec07bca10589f964
		^^^ this one merged two different CVS patches
	http://sourceware.org/ml/gdb-cvs/2011-03/msg00097.html

There would be needed for example:

--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3082,7 +3082,7 @@ proc gdb_continue_to_end {{mssg ""} {command continue}} {
     # Don't bother to check the output of the program, that may be
     # extremely tough for some remote systems.
     gdb_test "continue"\
-      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\
+      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|\\\[$inferior_exited_re normally).*"\
 	$text
   }
 }

But this is not enough for all the regressions.  I do not understand how it
could pass the testsuite for you.  Full log:
	http://people.redhat.com/jkratoch/20110308Build-gdbcvs.gdbmail


Thanks,
Jan

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-08  9:43             ` Regression: [Re: RFC: change "program exited" message] Jan Kratochvil
@ 2011-03-08 15:11               ` Tom Tromey
  2011-03-09 14:37                 ` Tom Tromey
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2011-03-08 15:11 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Pedro Alves, gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> This has a heavy regression for me such as:
Jan> FAIL: gdb.base/break.exp: continue until exit at recursive next test (the program exited)

I will fix it.

Jan> But this is not enough for all the regressions.  I do not
Jan> understand how it could pass the testsuite for you.

Maybe the tester has a bug.

I should probably switch it to use your comparison script, so that we
are more in sync.

Tom

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-08 15:11               ` Tom Tromey
@ 2011-03-09 14:37                 ` Tom Tromey
  2011-03-09 16:22                   ` Jan Kratochvil
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2011-03-09 14:37 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Pedro Alves, gdb-patches

Jan> This has a heavy regression for me such as:
Jan> FAIL: gdb.base/break.exp: continue until exit at recursive next test (the program exited)

Tom> I will fix it.

Here is the fix.

I built and regtested this on the compile farm, but we already know that
may have some issues.  But, I also went through the log you posted and
ran every failing test locally, before and after.  Some of the things in
that log don't seem to be related to my patch.  E.g., the
attachstop-mt.exp failure.

If you still see problems after this, just let me know and I will fix
those too.

Tom

2011-03-09  Tom Tromey  <tromey@redhat.com>

	* lib/gdb.exp (inferior_exited_re): Match. leading `['.  Wrap in
	parentheses.
	(gdb_continue_to_end): Add "allow_extra" parameter.  Use
	$command.
	* gdb.threads/thread-unwindonsignal.exp: Pass "allow_extra"
	argument to gdb_continue_to_end.
	* gdb.threads/interrupted-hand-call.exp: Pass "allow_extra"
	argument to gdb_continue_to_end.
	* gdb.cp/annota3.exp: Fix regex.
	* gdb.cp/annota2.exp: Fix regex.
	* gdb.base/shlib-call.exp: Pass "allow_extra" argument to
	gdb_continue_to_end.
	* gdb.base/call-signal-resume.exp: Revert earlier patch.
	* gdb.ada/tasks.exp: Pass "allow_extra" argument to
	gdb_continue_to_end.

Index: testsuite/gdb.ada/tasks.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.ada/tasks.exp,v
retrieving revision 1.5
diff -u -r1.5 tasks.exp
--- testsuite/gdb.ada/tasks.exp	7 Mar 2011 16:03:01 -0000	1.5
+++ testsuite/gdb.ada/tasks.exp	9 Mar 2011 14:10:39 -0000
@@ -70,5 +70,4 @@
 # Now, resume the execution and make sure that GDB does not stop when
 # task 4 hits the breakpoint. Continuing thus results in our program
 # running to completion.
-gdb_continue_to_end
-
+gdb_continue_to_end "" continue 1
Index: testsuite/gdb.base/call-signal-resume.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/call-signal-resume.exp,v
retrieving revision 1.9
diff -u -r1.9 call-signal-resume.exp
--- testsuite/gdb.base/call-signal-resume.exp	7 Mar 2011 16:03:02 -0000	1.9
+++ testsuite/gdb.base/call-signal-resume.exp	9 Mar 2011 14:10:39 -0000
@@ -146,6 +146,7 @@
 
 # Continue one last time, the program should exit normally.
 
-gdb_continue_to_end
+gdb_test "continue" "$inferior_exited_re normally." \
+    "continue to program exit"
 
 return 0
Index: testsuite/gdb.base/shlib-call.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shlib-call.exp,v
retrieving revision 1.22
diff -u -r1.22 shlib-call.exp
--- testsuite/gdb.base/shlib-call.exp	7 Mar 2011 16:03:02 -0000	1.22
+++ testsuite/gdb.base/shlib-call.exp	9 Mar 2011 14:10:39 -0000
@@ -182,12 +182,12 @@
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"run to bp in shared library"
 
-  gdb_continue_to_end
+  gdb_continue_to_end "" continue 1
 
   gdb_test "run" "Starting program:.*Breakpoint .,.*" \
 	"re-run to bp in shared library (PR's 16495, 18213)"
 
-  gdb_continue_to_end
+  gdb_continue_to_end "" continue 1
 }
 
 return 0
Index: testsuite/gdb.cp/annota2.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/annota2.exp,v
retrieving revision 1.22
diff -u -r1.22 annota2.exp
--- testsuite/gdb.cp/annota2.exp	7 Mar 2011 16:03:02 -0000	1.22
+++ testsuite/gdb.cp/annota2.exp	9 Mar 2011 14:10:39 -0000
@@ -116,7 +116,7 @@
 # `a.x is 1' is asynchronous regarding to `frames-invalid'.
 #
 gdb_test_multiple "continue" "continue until exit" {
-    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n.$inferior_exited_re normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+    -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n$inferior_exited_re normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
 	pass "continue until exit"
     }
 }
Index: testsuite/gdb.cp/annota3.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/annota3.exp,v
retrieving revision 1.20
diff -u -r1.20 annota3.exp
--- testsuite/gdb.cp/annota3.exp	7 Mar 2011 16:03:02 -0000	1.20
+++ testsuite/gdb.cp/annota3.exp	9 Mar 2011 14:10:39 -0000
@@ -116,15 +116,14 @@
 # annotate-exited
 #
 send_gdb "continue\n"
-gdb_expect_list "continue to exit" "$gdb_prompt$" {
+gdb_expect_list "continue to exit" "$gdb_prompt$" [concat {
     "\r\n\032\032post-prompt\r\n"
     "Continuing.\r\n"
     "\r\n\032\032starting\r\n"
     "a.x is 1\r\n"
-    "\r\n\032\032exited 0\r\n"
-    ".$inferior_exited_re normally.\r\n"
+    "\r\n\032\032exited 0\r\n"} [list "$inferior_exited_re normally.\r\n"] {
     "\r\n\032\032stopped\r\n"
-}
+}]
 
 #
 # delete all breakpoints
Index: testsuite/gdb.threads/interrupted-hand-call.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/interrupted-hand-call.exp,v
retrieving revision 1.5
diff -u -r1.5 interrupted-hand-call.exp
--- testsuite/gdb.threads/interrupted-hand-call.exp	7 Mar 2011 16:03:03 -0000	1.5
+++ testsuite/gdb.threads/interrupted-hand-call.exp	9 Mar 2011 14:10:39 -0000
@@ -86,6 +86,6 @@
 
 # Continue one last time, the program should exit normally.
 
-gdb_continue_to_end
+gdb_continue_to_end "" continue 1
 
 return 0
Index: testsuite/gdb.threads/thread-unwindonsignal.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp,v
retrieving revision 1.6
diff -u -r1.6 thread-unwindonsignal.exp
--- testsuite/gdb.threads/thread-unwindonsignal.exp	7 Mar 2011 16:03:03 -0000	1.6
+++ testsuite/gdb.threads/thread-unwindonsignal.exp	9 Mar 2011 14:10:39 -0000
@@ -110,6 +110,6 @@
 
 # Continue one last time, the program should exit normally.
 
-gdb_continue_to_end
+gdb_continue_to_end "" continue 1
 
 return 0
Index: testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.166
diff -u -r1.166 gdb.exp
--- testsuite/lib/gdb.exp	7 Mar 2011 16:03:04 -0000	1.166
+++ testsuite/lib/gdb.exp	9 Mar 2011 14:10:39 -0000
@@ -99,7 +99,7 @@
 
 set octal "\[0-7\]+"
 
-set inferior_exited_re "Inferior \[0-9\]+ \\(.*\\) exited"
+set inferior_exited_re "(\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
 
 ### Only procedures should come after this point.
 
@@ -3062,8 +3062,12 @@
 #	default is used.
 # COMMAND is the command to invoke.  If not given, "continue" is
 #	used.
+# ALLOW_EXTRA is a flag indicating whether the test should expect
+#	extra output between the "Continuing." line and the program
+#	exiting.  By default it is zero; if nonzero, any extra output
+#	is accepted.
 
-proc gdb_continue_to_end {{mssg ""} {command continue}} {
+proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} {
   global inferior_exited_re
 
   if {$mssg == ""} {
@@ -3071,18 +3075,23 @@
   } else {
       set text "continue until exit at $mssg"
   }
+  if {$allow_extra} {
+      set extra ".*"
+  } else {
+      set extra ""
+  }
   if [target_info exists use_gdb_stub] {
     if {![gdb_breakpoint "exit"]} {
       return 0
     }
-    gdb_test "continue" "Continuing..*Breakpoint .*exit.*" \
+    gdb_test $command "Continuing..*Breakpoint .*exit.*" \
 	$text
   } else {
     # Continue until we exit.  Should not stop again.
     # Don't bother to check the output of the program, that may be
     # extremely tough for some remote systems.
-    gdb_test "continue"\
-      "Continuing.\[\r\n0-9\]+(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\
+    gdb_test $command \
+      "Continuing.\[\r\n0-9\]+${extra}(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\
 	$text
   }
 }

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-09 14:37                 ` Tom Tromey
@ 2011-03-09 16:22                   ` Jan Kratochvil
  2011-03-09 16:29                     ` Joel Brobecker
  2011-03-09 17:28                     ` Tom Tromey
  0 siblings, 2 replies; 20+ messages in thread
From: Jan Kratochvil @ 2011-03-09 16:22 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches, Joel Brobecker

On Wed, 09 Mar 2011 15:15:16 +0100, Tom Tromey wrote:
> I built and regtested this on the compile farm, but we already know that
> may have some issues.

There remains one regression:

-PASS: gdb.ada/catch_ex.exp: continuing to program completion
+FAIL: gdb.ada/catch_ex.exp: continue until exit (the program exited)

due to:

Catchpoint 6, unhandled CONSTRAINT_ERROR at 0x00000000004017c3 in foo () at /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.ada/catch_ex/foo.adb:41
41         raise Constraint_Error;  -- SPOT4
(gdb) PASS: gdb.ada/catch_ex.exp: continuing to unhandled exception
continue
Continuing.

raised CONSTRAINT_ERROR : foo.adb:41 explicit raise
[Inferior 1 (process 14730) exited with code 01]
(gdb) FAIL: gdb.ada/catch_ex.exp: continue until exit (the program exited)
testcase ./gdb.ada/catch_ex.exp completed in 1 seconds 

that the testcase does not return exit code 0.

While the .exp testfile does not have too straightforward way to accept the
non-zero exit code I do not think a testfile should return with exit code
non-zero.  But I failed to modify the .adb file such way, isn't there some
easy way, Joel?


> Some of the things in that log don't seem to be related to my patch.  E.g.,
> the attachstop-mt.exp failure.

Yes, attachstop-mt.exp has flipping results.  As all the code around SIGSTOP
should get improved/reworked/merged-with-Fedora and it is kernel specific and
the SIGSTOP issues are being discussed in upstream kernel these months I delay
it after it gets resolved for upstream kernel.



Thanks,
Jan

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-09 16:22                   ` Jan Kratochvil
@ 2011-03-09 16:29                     ` Joel Brobecker
  2011-03-09 17:28                     ` Tom Tromey
  1 sibling, 0 replies; 20+ messages in thread
From: Joel Brobecker @ 2011-03-09 16:29 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Tom Tromey, Pedro Alves, gdb-patches

> While the .exp testfile does not have too straightforward way to accept the
> non-zero exit code I do not think a testfile should return with exit code
> non-zero.  But I failed to modify the .adb file such way, isn't there some
> easy way, Joel?

The non-zero status code is a consequence of a feature that I am
testing in this testcase, which is an *unhandled* exception. So
I need the exception to propagate all the way.

So, I think we have no choice but to change the testcase itself,
or enhance gdb_continue_to_end to be able to say that we expect
the inferior to terminate with a non-zero status.

I think the latter solution is probably preferable, because I'm
pretty sure I'll mis-handle bareboard, or remote/gdbserver, or
some other unusual configuration...

I can look at that tomorrow.

-- 
Joel

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-09 16:22                   ` Jan Kratochvil
  2011-03-09 16:29                     ` Joel Brobecker
@ 2011-03-09 17:28                     ` Tom Tromey
  2011-03-09 17:32                       ` Jan Kratochvil
  1 sibling, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2011-03-09 17:28 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Pedro Alves, gdb-patches, Joel Brobecker

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> -PASS: gdb.ada/catch_ex.exp: continuing to program completion
Jan> +FAIL: gdb.ada/catch_ex.exp: continue until exit (the program exited)

Can you try this?

Tom

diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index 6a98089..a0b552e 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -141,6 +141,6 @@ gdb_test "continue" \
          "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
          "continuing to unhandled exception"
 
-gdb_continue_to_end 
+gdb_continue_to_end "" continue 1
 
 

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-09 17:28                     ` Tom Tromey
@ 2011-03-09 17:32                       ` Jan Kratochvil
  2011-03-09 18:15                         ` Tom Tromey
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kratochvil @ 2011-03-09 17:32 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches, Joel Brobecker

On Wed, 09 Mar 2011 18:13:02 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> 
> Jan> -PASS: gdb.ada/catch_ex.exp: continuing to program completion
> Jan> +FAIL: gdb.ada/catch_ex.exp: continue until exit (the program exited)
> 
> Can you try this?
[...]
> -gdb_continue_to_end 
> +gdb_continue_to_end "" continue 1

I tried that but that was the reason I wrote:
	the .exp testfile does not have too straightforward way to accept the
	non-zero exit code
as even with
	set extra ".*"
there is still the expectation
	"Continuing.\[\r\n0-9\]+${extra}(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"
but the output is
	[Inferior 1 (process 14730) exited with code 01]


Thanks,
Jan

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-09 17:32                       ` Jan Kratochvil
@ 2011-03-09 18:15                         ` Tom Tromey
  2011-03-09 18:22                           ` Jan Kratochvil
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Tromey @ 2011-03-09 18:15 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Pedro Alves, gdb-patches, Joel Brobecker

Jan> I tried that but that was the reason I wrote:

Oh, duh.  Sorry about that.

Partially reverting doesn't hurt.  How about this?

Tom

diff --git a/gdb/testsuite/gdb.ada/catch_ex.exp b/gdb/testsuite/gdb.ada/catch_ex.exp
index 6a98089..7fc2895 100644
--- a/gdb/testsuite/gdb.ada/catch_ex.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex.exp
@@ -141,6 +141,8 @@ gdb_test "continue" \
          "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
          "continuing to unhandled exception"
 
-gdb_continue_to_end 
+gdb_test "continue" \
+         "Continuing\..*$inferior_exited_re.*" \
+         "continuing to program completion"
 
 

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-09 18:15                         ` Tom Tromey
@ 2011-03-09 18:22                           ` Jan Kratochvil
  2011-03-09 18:58                             ` Tom Tromey
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Kratochvil @ 2011-03-09 18:22 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches, Joel Brobecker

On Wed, 09 Mar 2011 18:28:21 +0100, Tom Tromey wrote:
> Partially reverting doesn't hurt.  How about this?
[...]
> -gdb_continue_to_end 
> +gdb_test "continue" \
> +         "Continuing\..*$inferior_exited_re.*" \
> +         "continuing to program completion"

Yes, it PASSes (fedora15.x86_64).


Thanks,
Jan

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

* Re: Regression:  [Re: RFC: change "program exited" message]
  2011-03-09 18:22                           ` Jan Kratochvil
@ 2011-03-09 18:58                             ` Tom Tromey
  0 siblings, 0 replies; 20+ messages in thread
From: Tom Tromey @ 2011-03-09 18:58 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: Pedro Alves, gdb-patches, Joel Brobecker

Jan> Yes, it PASSes (fedora15.x86_64).

Thanks.  I am committing as appended.

Tom

2011-03-09  Tom Tromey  <tromey@redhat.com>

	* gdb.ada/catch_ex.exp: Use explicit gdb_test rather than
	gdb_continue_to_end.

Index: testsuite/gdb.ada/catch_ex.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.ada/catch_ex.exp,v
retrieving revision 1.10
diff -u -r1.10 catch_ex.exp
--- testsuite/gdb.ada/catch_ex.exp	7 Mar 2011 16:03:01 -0000	1.10
+++ testsuite/gdb.ada/catch_ex.exp	9 Mar 2011 18:34:33 -0000
@@ -141,6 +141,8 @@
          "Continuing\.$eol$catchpoint_msg$eol.*SPOT4" \
          "continuing to unhandled exception"
 
-gdb_continue_to_end 
+gdb_test "continue" \
+         "Continuing\..*$inferior_exited_re.*" \
+         "continuing to program completion"
 
 

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

end of thread, other threads:[~2011-03-09 18:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 20:52 RFC: change "program exited" message Tom Tromey
2011-03-03 21:18 ` Michael Snyder
2011-03-03 21:20 ` Pedro Alves
2011-03-04  7:37   ` Eli Zaretskii
2011-03-04 17:24   ` Tom Tromey
2011-03-04 19:13     ` Pedro Alves
2011-03-04 19:23       ` Tom Tromey
2011-03-04 19:38         ` Pedro Alves
2011-03-07 16:17           ` Tom Tromey
2011-03-08  9:43             ` Regression: [Re: RFC: change "program exited" message] Jan Kratochvil
2011-03-08 15:11               ` Tom Tromey
2011-03-09 14:37                 ` Tom Tromey
2011-03-09 16:22                   ` Jan Kratochvil
2011-03-09 16:29                     ` Joel Brobecker
2011-03-09 17:28                     ` Tom Tromey
2011-03-09 17:32                       ` Jan Kratochvil
2011-03-09 18:15                         ` Tom Tromey
2011-03-09 18:22                           ` Jan Kratochvil
2011-03-09 18:58                             ` Tom Tromey
2011-03-04  9:12 ` RFC: change "program exited" message Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).