@@ -527,6 +527,17 @@ captured_main_1 (struct captured_main_args *context)
error (_("fatal error: libbfd ABI mismatch"));
#ifdef __MINGW32__
+ /* On Windows hosts, when built using MinGW, we have some problems
+ with the terminal when running the debugger either under a cygwin
+ environment, or when connected to a GUI: When the debugger prints
+ an error, the actual printing on screen of the error message is
+ delayed and only finally printed after the next GDB prompt.
+ We avoid this issue by turning off buffering of stdout and stderr. */
+ setvbuf (stdout, NULL, _IONBF, 0);
+ setvbuf (stderr, NULL, _IONBF, 0);
+#endif
+
+#ifdef __MINGW32__
/* On Windows, argv[0] is not necessarily set to absolute form when
GDB is found along PATH, without which relocation doesn't work. */
gdb_program_name = windows_get_absolute_argv0 (argv[0]);