This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix mi-cli.exp


mi-cli.exp appears to be broken in async mode. This patch fixes it.
Tested for {sync,async}x{native,gdbserver} and checked in.

- Volodya

Index: gdb/testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1821
diff -u -p -r1.1821 ChangeLog
--- gdb/testsuite/ChangeLog	12 Mar 2009 20:14:53 -0000	1.1821
+++ gdb/testsuite/ChangeLog	13 Mar 2009 10:53:00 -0000
@@ -1,3 +1,8 @@
+2009-03-13  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* gdb.mi/mi-cli.exp: Adjust for output difference in
+        sync and async modes.
+
 2009-03-12  Vladimir Prus  <vladimir@codesourcery.com>
 
         * gdb.mi/mi-cli.exp: Remove debug print.
Index: gdb/testsuite/gdb.mi/mi-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-cli.exp,v
retrieving revision 1.18
diff -u -p -r1.18 mi-cli.exp
--- gdb/testsuite/gdb.mi/mi-cli.exp	12 Mar 2009 20:16:06 -0000	1.18
+++ gdb/testsuite/gdb.mi/mi-cli.exp	13 Mar 2009 10:53:01 -0000
@@ -140,7 +140,22 @@ mi_gdb_test "500-stack-select-frame 0" \
   {500\^done} \
   "-stack-select-frame 0"
 
-mi_execute_to "interpreter-exec console step" "" "callee4" "" ".*basics.c" 
"29" \
+# When a CLI command is entered in MI session, the respose is different in
+# sync and async modes. In sync mode normal_stop is called when current
+# interpreter is CLI. So:
+#   - print_stop_reason prints stop reason in CLI uiout, and we don't show it
+#     in MI
+#   - The stop position is printed, and appears in MI 'console' channel.
+#
+# In async mode the stop event is processed when we're back to MI 
interpreter,
+# so the stop reason is printed into MI uiout an.
+if {$async} {
+    set reason "end-stepping-range"
+} else {
+    set reason ""
+}
+
+mi_execute_to "interpreter-exec console step" $reason "callee4" "" 
".*basics.c" "29" \
     "" "check *stopped from CLI command"
 
 # NOTE: cagney/2003-02-03: Not yet.
@@ -161,8 +176,10 @@ mi_gdb_test "34 next" \
     ".*34\\\^running.*\\*running,thread-id=\"all\"" \
     "34 next: run"
 
-gdb_expect {
-    -re "~\[^\r\n\]+\r\n" {
+if {!$async} {
+    gdb_expect {
+        -re "~\[^\r\n\]+\r\n" {
+        }
     }
 }
 
@@ -170,7 +187,7 @@ gdb_expect {
 # The purpose of *stopped notification for CLI command is to make
 # sure that frontend knows that inferior is stopped, and knows where.
 # Supplementary information is not necessary.
-mi_expect_stop "" "main" "" ".*basics.c" $line_main_return "" \
+mi_expect_stop "$reason" "main" "" ".*basics.c" $line_main_return "" \
     "34 next: stop"
 
 mi_gdb_test "-interpreter-exec console \"list\"" \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]