[binutils-gdb] gdb/
Eli Zaretskii
eliz@sourceware.org
Sun Jan 18 09:30:54 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0dbdf282cdf6b54006601ab5f1ed7bf5fbb6e0ab
commit 0dbdf282cdf6b54006601ab5f1ed7bf5fbb6e0ab
Author: Eli Zaretskii <eliz@gnu.org>
Date: Sun Jan 18 11:30:06 2026 +0200
gdb/
PR gdb/33761
* gdb/ui-style.c (colorsupport) [__MINGW32__]: MS-Windows always
supports at least 8 colors, even if the "Co" capability is not in
the terminfo DB. This fixes "set style FOO foreground COLOR"
commands in the Windows native build of GDB.
Diff:
---
gdb/ui-style.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index b977ef0253d..8b3e11104a7 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -599,6 +599,12 @@ colorsupport ()
'char *', so we need the const_cast, since C++ will not
implicitly convert. */
int colors = tgetnum (const_cast<char*> ("Co"));
+#ifdef __MINGW32__
+ /* MS-Windows terminal generally doesn't have "Co" in its
+ terminfo, but always supports at least 8 colors. */
+ if (colors <= 0)
+ colors = 8;
+#endif
if (colors >= 8)
result.push_back (color_space::ANSI_8COLOR);
if (colors >= 16)
More information about the Gdb-cvs
mailing list