[binutils-gdb/gdb-17-branch] gdb/
Eli Zaretskii
eliz@sourceware.org
Sun Jan 18 09:34:30 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=07e542a3bd0565c262e3d506848514beac1fa510
commit 07e542a3bd0565c262e3d506848514beac1fa510
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.
(cherry picked from commit 0dbdf282cdf6b54006601ab5f1ed7bf5fbb6e0ab)
Diff:
---
gdb/ui-style.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index 9a58e4dd2ae..fba4f2835b4 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -595,6 +595,12 @@ colorsupport ()
std::vector<color_space> result = {color_space::MONOCHROME};
int colors = tgetnum ("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