Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Use emoji to indicate errors and warnings
@ 2024-12-20 21:03 Tom Tromey
  2024-12-20 21:10 ` Paul Koning
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Tom Tromey @ 2024-12-20 21:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This patch adds, at long last, some emoji output to gdb.  In
particular, warnings are indicated with the warning sign, and errors
with the police car light.

Perhaps this kind of thing should be configurable.

Also it should probably be dependent on whether the current encoding
is UTF-8 compatible.

Anyway, looking for feedback.
---
 gdb/exceptions.c      | 2 ++
 gdb/linux-thread-db.c | 3 ---
 gdb/main.c            | 4 ++--
 gdb/utils.c           | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 368999829fc..23b6ef47bbe 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -74,6 +74,8 @@ print_exception (struct ui_file *file, const struct gdb_exception &e)
 
   for (start = e.what (); start != NULL; start = end)
     {
+      gdb_puts ("🚨 ", file);
+
       end = strchr (start, '\n');
       if (end == NULL)
 	gdb_puts (start, file);
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 9d84187a9ad..f946c2a3e73 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -778,9 +778,6 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
     }
   catch (const gdb_exception_error &except)
     {
-      if (warning_pre_print)
-	gdb_puts (warning_pre_print, gdb_stderr);
-
       exception_fprintf (gdb_stderr, except,
 			 _("libthread_db integrity checks failed: "));
 
diff --git a/gdb/main.c b/gdb/main.c
index 33cdd900994..dd1aa7fe216 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1168,7 +1168,7 @@ captured_main_1 (struct captured_main_args *context)
 
   /* Set off error and warning messages with a blank line.  */
   tmp_warn_preprint.reset ();
-  warning_pre_print = _("\nwarning: ");
+  warning_pre_print = _("\n⚠️ warning: ");
 
   /* Read and execute the system-wide gdbinit file, if it exists.
      This is done *before* all the command line arguments are
@@ -1273,7 +1273,7 @@ captured_main_1 (struct captured_main_args *context)
     current_inferior ()->set_tty (ttyarg);
 
   /* Error messages should no longer be distinguished with extra output.  */
-  warning_pre_print = _("warning: ");
+  warning_pre_print = _("⚠️ warning: ");
 
   /* Read the .gdbinit file in the current directory, *if* it isn't
      the same as the $HOME/.gdbinit file (it should exist, also).  */
diff --git a/gdb/utils.c b/gdb/utils.c
index 6f2055e299d..72c7463c3cb 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -119,7 +119,7 @@ show_sevenbit_strings (struct ui_file *file, int from_tty,
 
 /* String to be printed before warning messages, if any.  */
 
-const char *warning_pre_print = "\nwarning: ";
+const char *warning_pre_print = "\n⚠️ warning: ";
 
 bool pagination_enabled = true;
 static void
-- 
2.47.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-02-03 16:10 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-20 21:03 [RFC] Use emoji to indicate errors and warnings Tom Tromey
2024-12-20 21:10 ` Paul Koning
2025-01-31 21:50   ` Tom Tromey
2024-12-20 21:17 ` Sam James
2024-12-21  7:07 ` Eli Zaretskii
2025-01-31 21:53   ` Tom Tromey
2025-02-01  8:15     ` Eli Zaretskii
2024-12-23 11:27 ` Guinevere Larsen
2025-01-31 21:53   ` Tom Tromey
2024-12-24 14:55 ` Luis Machado
2025-01-02 11:58   ` Guinevere Larsen
2025-01-02 12:55     ` Luis Machado
2025-01-31 21:55     ` Tom Tromey
2025-02-03  9:32       ` Luis Machado
2025-02-03 16:09         ` Luis Machado
2025-01-10 17:25 ` Kévin Le Gouguec
2025-01-13 14:47 ` Andrew Burgess
2025-01-13 15:21   ` Puputti, Matti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox