diff options
author | Eli Zaretskii <eliz@gnu.org> | 2019-03-09 08:44:56 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2019-03-09 08:44:56 +0200 |
commit | e4adb93903d4ae0b7ab2b5004364e50627df95f7 (patch) | |
tree | 75e41ba3c39b128c7b0a8de192851dd4200da786 /gdb/ui-file.c | |
parent | 4639b61ae3bf7c959f35debcb2c6a204fa0b4f1c (diff) | |
download | binutils-e4adb93903d4ae0b7ab2b5004364e50627df95f7.zip binutils-e4adb93903d4ae0b7ab2b5004364e50627df95f7.tar.gz binutils-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/ui-file.c')
-rw-r--r-- | gdb/ui-file.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 690fc62..77f6b31 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -236,6 +236,12 @@ stdio_file::write_async_safe (const char *buf, long length_buf) void stdio_file::puts (const char *linebuffer) { + /* This host-dependent function (with implementations in + posix-hdep.c and mingw-hdep.c) is given the opportunity to + process the output first in host-dependent way. If it does, it + should return non-zero, to avoid calling fputs below. */ + if (gdb_console_fputs (linebuffer, m_file)) + return; /* Calling error crashes when we are called from the exception framework. */ if (fputs (linebuffer, m_file)) { |