PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in...
[deliverable/binutils-gdb.git] / gdb / testsuite / lib / mi-support.exp
index 6d011b9c357fe90581143a47ae2036dc4111b815..09a514b9656415cc491f1e9e7fb6250c3c8f09aa 100644 (file)
@@ -799,6 +799,30 @@ proc mi_gdb_test { args } {
     return $result
 }
 
+# Collect output sent to the console output stream until UNTIL is
+# seen.  UNTIL is a regular expression.  MESSAGE is the message to be
+# printed in case of timeout.
+
+proc mi_gdb_expect_cli_output {until message} {
+
+    set output ""
+    gdb_expect {
+       -re "~\"(\[^\r\n\]+)\"\r\n" {
+           append output $expect_out(1,string)
+           exp_continue
+       }
+       -notransfer -re "$until" {
+           # Done
+       }
+       timeout {
+           fail "$message (timeout)"
+           return ""
+       }
+    }
+
+    return $output
+}
+
 #
 # MI run command.  (A modified version of gdb_run_cmd)
 #
This page took 0.024914 seconds and 4 git commands to generate.