aboutsummaryrefslogtreecommitdiff
path: root/gdb/mingw-hdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mingw-hdep.c')
-rw-r--r--gdb/mingw-hdep.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index dc7ca42..84a7b9f 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -22,6 +22,7 @@
#include "gdbsupport/event-loop.h"
#include "gdbsupport/gdb_select.h"
#include "inferior.h"
+#include "cli/cli-style.h"
#include <windows.h>
#include <signal.h>
@@ -212,7 +213,30 @@ static int mingw_console_initialized;
static HANDLE hstdout = INVALID_HANDLE_VALUE;
/* Text attribute to use for normal text (the "none" pseudo-color). */
-static SHORT norm_attr;
+static SHORT norm_attr;
+
+/* Initialize settings related to the console. */
+
+void
+windows_initialize_console ()
+{
+ hstdout = (HANDLE)_get_osfhandle (fileno (stdout));
+ DWORD cmode;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ if (hstdout != INVALID_HANDLE_VALUE
+ && GetConsoleMode (hstdout, &cmode) != 0
+ && GetConsoleScreenBufferInfo (hstdout, &csbi))
+ {
+ norm_attr = csbi.wAttributes;
+ mingw_console_initialized = 1;
+ }
+ else if (hstdout != INVALID_HANDLE_VALUE)
+ mingw_console_initialized = -1; /* valid, but not a console device */
+
+ if (mingw_console_initialized > 0)
+ no_emojis ();
+}
/* The most recently applied style. */
static ui_file_style last_style;
@@ -223,22 +247,6 @@ static ui_file_style last_style;
int
gdb_console_fputs (const char *linebuf, FILE *fstream)
{
- if (!mingw_console_initialized)
- {
- hstdout = (HANDLE)_get_osfhandle (fileno (fstream));
- DWORD cmode;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
-
- if (hstdout != INVALID_HANDLE_VALUE
- && GetConsoleMode (hstdout, &cmode) != 0
- && GetConsoleScreenBufferInfo (hstdout, &csbi))
- {
- norm_attr = csbi.wAttributes;
- mingw_console_initialized = 1;
- }
- else if (hstdout != INVALID_HANDLE_VALUE)
- mingw_console_initialized = -1; /* valid, but not a console device */
- }
/* If our stdout is not a console device, let the default 'fputs'
handle the task. */
if (mingw_console_initialized <= 0)