From a048980c4eb93f8a965b4addc7134e8a527874a2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 20 Dec 2024 14:00:39 -0700 Subject: Use emoji to indicate errors and warnings This patch adds, at long last, some emoji output to gdb. In particular, warnings are indicated with the U+26A0 (WARNING SIGN), and errors with U+274C (CROSS MARK). There is a new setting to control whether emoji output can be used. It defaults to "auto", which means emoji will be used if the host charset is UTF-8. Note that disabling styling will also disable emoji, handy for traditionalists. I've refactored mingw console output a little, so that emoji will not be printed to the console. Note the previous code here was a bit strange in that it assumed that the first use of gdb_console_fputs would be to stdout. This version lets the user control the prefixes directly, so different emoji can be chosen if desired. Reviewed-By: Eli Zaretskii Reviewed-By: Keith Seitz Reviewed-By: Guinevere Larsen --- gdb/exceptions.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/exceptions.c') diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 6af3a7e..35400f3 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -25,6 +25,7 @@ #include "serial.h" #include "ui.h" #include +#include "cli/cli-style.h" static void print_flush (void) @@ -105,6 +106,7 @@ exception_print (struct ui_file *file, const struct gdb_exception &e) if (e.reason < 0 && e.message != NULL) { print_flush (); + print_error_prefix (file); print_exception (file, e); } } @@ -118,6 +120,7 @@ exception_fprintf (struct ui_file *file, const struct gdb_exception &e, va_list args; print_flush (); + print_error_prefix (file); /* Print the prefix. */ va_start (args, prefix); -- cgit v1.1