diff --git a/gdb/python/python.c b/gdb/python/python.c index 707b700..33c1bae 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -567,6 +567,7 @@ gdbpy_write (PyObject *self, PyObject *args) if (! PyArg_ParseTuple (args, "s", &arg)) return NULL; printf_filtered ("%s", arg); + gdb_flush (gdb_stdout); Py_RETURN_NONE; } diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp index 30d6f32..5b7c4e9 100644 --- a/gdb/testsuite/gdb.python/py-mi.exp +++ b/gdb/testsuite/gdb.python/py-mi.exp @@ -232,3 +232,7 @@ mi_continue_to_line \ "step to second breakpoint" mi_varobj_update_with_type_change container int 0 "update after type change" + +mi_gdb_test "-interpreter-exec console \"python gdb.write (str(42))\"" \ + ".*\~\\\"42\\\".*\\^done" \ + "ensure gdb write output is flushed"