aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2019-03-09 08:44:56 +0200
committerEli Zaretskii <eliz@gnu.org>2019-03-09 08:44:56 +0200
commite4adb93903d4ae0b7ab2b5004364e50627df95f7 (patch)
tree75e41ba3c39b128c7b0a8de192851dd4200da786 /gdb/utils.c
parent4639b61ae3bf7c959f35debcb2c6a204fa0b4f1c (diff)
downloadgdb-e4adb93903d4ae0b7ab2b5004364e50627df95f7.zip
gdb-e4adb93903d4ae0b7ab2b5004364e50627df95f7.tar.gz
gdb-e4adb93903d4ae0b7ab2b5004364e50627df95f7.tar.bz2
Support styling on native MS-Windows console
gdb/ChangeLog: 2019-03-08 Eli Zaretskii <eliz@gnu.org> PR/24315 * utils.c (can_emit_style_escape) [_WIN32]: Don't disable styling on MS-Windows if $TERM is not defined. * cli/cli-style.c: Set cli_styling to 1 in the MinGW build. * posix-hdep.c (gdb_console_fputs): * mingw-hdep.c (rgb_to_16colors, gdb_console_fputs): New functions. * ui-file.h (gdb_console_fputs): Add prototype. * ui-file.c (stdio_file::puts): Call gdb_console_fputs, and fall back to fputs only if the former returns zero.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 258614a..840779a 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1445,8 +1445,18 @@ can_emit_style_escape (struct ui_file *stream)
|| !ui_file_isatty (stream))
return false;
const char *term = getenv ("TERM");
+ /* Windows doesn't by default define $TERM, but can support styles
+ regardless. */
+#ifndef _WIN32
if (term == nullptr || !strcmp (term, "dumb"))
return false;
+#else
+ /* But if they do define $TERM, let us behave the same as on Posix
+ platforms, for the benefit of programs which invoke GDB as their
+ back-end. */
+ if (term && !strcmp (term, "dumb"))
+ return false;
+#endif
return true;
}