Fix MI testsuite failures for gdbserver

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fix MI testsuite failures for gdbserver

Daniel Jacobowitz-2
Nathan made mi-console.exp skip the inferior I/O test if
gdb,noinferiorio was set.  Later, Bob Rossi made it use the fancy new
separate TTY support; at that point the inferior I/O check was lost.
This adds it back.

I also removed the use of puts from mi-syn-frame.exp; it's irrelevant
to the test.  Andrew suggested this to me way back in 2004.

Tested on x86_64-linux native and with gdbserver, and committed.

--
Daniel Jacobowitz
CodeSourcery

2007-04-29  Daniel Jacobowitz  <[hidden email]>

        * gdb.mi/mi-syn-frame.c (main, foo, bar)
        (have_a_very_merry_interrupt): Remove calls to puts.
        * gdb.mi/mi-syn-frame.exp, gdb.mi/mi2-syn-frame.exp: Do not expect
        inferior output.
        * lib/mi-support.exp (mi_gdb_test): Check gdb,noinferiorio.  Correct
        test names.

Index: gdb.mi/mi-syn-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-syn-frame.c,v
retrieving revision 1.3
diff -u -p -r1.3 mi-syn-frame.c
--- gdb.mi/mi-syn-frame.c 6 Feb 2003 18:26:20 -0000 1.3
+++ gdb.mi/mi-syn-frame.c 29 Apr 2007 16:20:21 -0000
@@ -11,20 +11,15 @@ void have_a_very_merry_interrupt (void);
 
 main ()
 {
-  puts ("Starting up");
-
   foo ();   /* Put a breakpoint on foo() and call it to see a dummy frame */
 
 
   have_a_very_merry_interrupt ();
-
-  puts ("Shutting down");
 }
 
 void
 foo (void)
 {
-  puts ("hi in foo");
 }
 
 void
@@ -32,8 +27,6 @@ bar (void)
 {
   char *nuller = 0;
 
-  puts ("hi in bar");
-
   *nuller = 'a';      /* try to cause a segfault */
 }
 
@@ -58,7 +51,6 @@ subroutine (int in)
 void
 have_a_very_merry_interrupt (void)
 {
-  puts ("Waiting to get a signal");
   signal (SIGALRM, handler);
   alarm (1);
   sleep (2);  /* We'll receive that signal while sleeping */
Index: gdb.mi/mi-syn-frame.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-syn-frame.exp,v
retrieving revision 1.9
diff -u -p -r1.9 mi-syn-frame.exp
--- gdb.mi/mi-syn-frame.exp 9 Jan 2007 17:59:13 -0000 1.9
+++ gdb.mi/mi-syn-frame.exp 29 Apr 2007 16:20:21 -0000
@@ -37,7 +37,7 @@ if  { [gdb_compile "${srcdir}/${subdir}/
 }
 
 mi_gdb_exit
-mi_gdb_start separate-inferior-tty
+mi_gdb_start
 mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
@@ -61,8 +61,7 @@ mi_gdb_test "402-stack-list-frames" "402
 #
 mi_gdb_test "403-exec-continue" \
   "403\\^running" \
-  "testing exec continue" \
-  "hi in foo\[\r\n\]\+"
+  "testing exec continue"
 
 mi_gdb_test "" "403\\*stopped" "finished exec continue"
 
@@ -81,8 +80,7 @@ mi_gdb_test "405-break-insert subroutine
 
 mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
   "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
-  "data evaluate expression" \
-  "Waiting to get a signal\[\r\n\]+"
+  "data evaluate expression"
 
 # We should have both a signal handler and a call dummy frame
 # in this next output.
@@ -106,8 +104,7 @@ mi_gdb_test "409-stack-list-frames 0 0"
 
 mi_gdb_test "410-data-evaluate-expression bar()" \
   "\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
-  "call inferior function which raises exception" \
-  "hi in bar\[\r\n\]+"
+  "call inferior function which raises exception"
 
 mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
 
Index: gdb.mi/mi2-syn-frame.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-syn-frame.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi2-syn-frame.exp
--- gdb.mi/mi2-syn-frame.exp 9 Jan 2007 17:59:13 -0000 1.6
+++ gdb.mi/mi2-syn-frame.exp 29 Apr 2007 16:20:21 -0000
@@ -64,7 +64,7 @@ mi_gdb_test "402-stack-list-frames" "402
 
 send_gdb "403-exec-continue\n"
 gdb_expect {
-  -re "403\\^running\[\r\n\]+${my_mi_gdb_prompt}hi in foo\[\r\n\]+403\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
+  -re "403\\^running\[\r\n\]+${my_mi_gdb_prompt}403\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
     pass "403-exec-continue"
   }
   timeout {
@@ -86,7 +86,7 @@ mi_gdb_test "405-break-insert subroutine
   "insert breakpoint subroutine"
 
 mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
-  "Waiting to get a signal\[\r\n\]+\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
+  "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
   "evaluate expression have_a_very_merry_interrupt"
 
 # We should have both a signal handler and a call dummy frame
@@ -115,7 +115,7 @@ mi_gdb_test "409-stack-list-frames 0 0"
 # Call bar() by hand, which should get an exception while running.
 #
 
-mi_gdb_test "410-data-evaluate-expression bar()" "hi in bar\[\r\n\]+\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"
+mi_gdb_test "410-data-evaluate-expression bar()" "\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"
 
 mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
 
Index: lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.45
diff -u -p -r1.45 mi-support.exp
--- lib/mi-support.exp 25 Apr 2007 15:56:15 -0000 1.45
+++ lib/mi-support.exp 29 Apr 2007 16:20:21 -0000
@@ -732,15 +732,19 @@ proc mi_gdb_test { args } {
     # If the GDB output matched, compare the inferior output.
     if { $result == 0 } {
  if [ info exists ipattern ] {
-    global mi_inferior_spawn_id
-    expect {
- -i $mi_inferior_spawn_id -re "$ipattern" {
-    pass "inferior_output:$message"
- }
- timeout {
-    fail "inferior output timeout"
-    set result 1
+    if { ![target_info exists gdb,noinferiorio] } {
+ global mi_inferior_spawn_id
+ expect {
+    -i $mi_inferior_spawn_id -re "$ipattern" {
+ pass "$message inferior output"
+    }
+    timeout {
+ fail "$message inferior output (timeout)"
+ set result 1
+    }
  }
+    } else {
+ unsupported "$message inferior output"
     }
         }
     }