From: Luis Machado <luis.machado@arm.com>
To: Guinevere Larsen <guinevere@redhat.com>,
Tom Tromey <tromey@adacore.com>,
gdb-patches@sourceware.org
Subject: Re: [RFC] Use emoji to indicate errors and warnings
Date: Thu, 2 Jan 2025 12:55:19 +0000 [thread overview]
Message-ID: <6b70ffee-f62d-4a7c-aa6c-fe89b8ece18c@arm.com> (raw)
In-Reply-To: <51fe9d6a-3995-4b4f-937f-a4cc8a1f83d3@redhat.com>
On 1/2/25 11:58, Guinevere Larsen wrote:
> On 12/24/24 11:55 AM, Luis Machado wrote:
>> On 12/20/24 21:03, Tom Tromey wrote:
>>> 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
>> Curious. My first reaction was "I don't think so". But emojis and memes are the future. I suppose a
>> way to toggle this on/off would be OK, and then whoever is building gdb can decide what to do with it.
> I think this should be disabled at runtime, not at compile time. This way distros can share GDB with the emoji capability, but users themselves can choose to enable or disable according to their preference
You're right. Runtime seems more sensible.
>> I like the coloring, for the most part. I suppose these emojis would accomplish a similar purpose if they
>> appear in the middle of a wall of cryptic text. But while coloring would be fine by default, I think the emojis
>> would need to be off by default for now.
>>
> I disagree because of discoverability. Emojis will help inexperienced users the most, and those users are unlikely to look at changelogs and news entries for what GDB has added (I didn't even realize how much development happened at GDB until I started at red hat, I'd never think to check something like this). So someone who would benefit from them is extremely unlikely to find out that they even exist. On the other hand, if they are enabled by default, someone who really dislikes emojis will immediately see them and search how to disable.
>
> "there must be a way to remove this" is a much more logical conclusion from seeing emojis, than "Is there a way to add emojis to this 1990s looking program?" when you see a large wall of text that may contain errors or warnings.
>
I don't have a strong opinion here. As long as gdb is capable of detecting the terminal is missing prerequisites and switching to a working configuration, this should be fine I think.
But if we go on by default, I think we should use these things within reason.
next prev parent reply other threads:[~2025-01-02 12:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-20 21:03 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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b70ffee-f62d-4a7c-aa6c-fe89b8ece18c@arm.com \
--to=luis.machado@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=guinevere@redhat.com \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox