* [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
* Re: [RFC] Use emoji to indicate errors and warnings
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
` (5 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Paul Koning @ 2024-12-20 21:10 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> On Dec 20, 2024, at 4:03 PM, Tom Tromey <tromey@adacore.com> 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.
I don't like this at all. It's bad enough to have coloring in error messages; but please let's keep them as normal text, without graphics elements.
paul
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-20 21:03 [RFC] Use emoji to indicate errors and warnings Tom Tromey
2024-12-20 21:10 ` Paul Koning
@ 2024-12-20 21:17 ` Sam James
2024-12-21 7:07 ` Eli Zaretskii
` (4 subsequent siblings)
6 siblings, 0 replies; 18+ messages in thread
From: Sam James @ 2024-12-20 21:17 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches, David Malcolm
Tom Tromey <tromey@adacore.com> writes:
> 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.
>
If you want to make it to new year...
> Also it should probably be dependent on whether the current encoding
> is UTF-8 compatible.
>
We should probably gate it on NO_COLOR or whatever at the least as well,
I don't think there's a standard mechanism for opting out of emoji yet.
> Anyway, looking for feedback.
I expect a bunch of grumblings so let me explicitly say that I like the
idea. I cc'd Dave as well given I suspect he'll have some thoughts on this.
> ---
> 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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-20 21:03 [RFC] Use emoji to indicate errors and warnings Tom Tromey
2024-12-20 21:10 ` Paul Koning
2024-12-20 21:17 ` Sam James
@ 2024-12-21 7:07 ` Eli Zaretskii
2025-01-31 21:53 ` Tom Tromey
2024-12-23 11:27 ` Guinevere Larsen
` (3 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2024-12-21 7:07 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>
> Date: Fri, 20 Dec 2024 14:03:43 -0700
>
> 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.
Thanks. I'm quite sure we'd need a knob to turn this on and off,
since the encoding test is not definitive enough. For example, if you
run GDB from a shell prompt, you need to establish whether the font
used by the shell window/console supports the Emoji codepoints;
testing the encoding is not enough. As a counter-example, on my
Windows 11 system the encoding of the cmd.exe window is definitely not
UTF-8, and yet copy/pasting the Emoji from your patch shows them as
icons, with the fonts I use in these windows. However, that doesn't
mean the way GDB writes to the cmd.exe window will be able to produce
an Emoji (I think it won't). And if you run GDB from Emacs via the
"M-x gdb" command in a GUI Emacs window, display of Emoji will almost
certainly always be supported on any modern platform.
So I think we should have a variable to control this, and its default
should be initially off, unless we later find out that almost all the
use cases can support Emoji display, or can detect those cases that
support it and turn the feature on only in those cases. I'm not sure
if the encoding test is useful, but maybe it is, at least on Posix
systems.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-20 21:03 [RFC] Use emoji to indicate errors and warnings Tom Tromey
` (2 preceding siblings ...)
2024-12-21 7:07 ` Eli Zaretskii
@ 2024-12-23 11:27 ` Guinevere Larsen
2025-01-31 21:53 ` Tom Tromey
2024-12-24 14:55 ` Luis Machado
` (2 subsequent siblings)
6 siblings, 1 reply; 18+ messages in thread
From: Guinevere Larsen @ 2024-12-23 11:27 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
I'll say I like this idea. I find color and different shapes very useful
to quickly identify what's up.
However, it is a problem for accessibility. I don't know how many users
of GDB need screen readers, but for them, emoji can be very confusing as
a description of the emoji will be read in the middle of the text. So
absolutely this needs to be toggleable.
I also have a question about one change inlined.
On 12/20/24 6:03 PM, 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);
> -
I'm unsure if this change is related to the emoji change. did you mean
to add a different puts line?
--
Cheers,
Guinevere Larsen
She/Her/Hers
> 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
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-20 21:03 [RFC] Use emoji to indicate errors and warnings Tom Tromey
` (3 preceding siblings ...)
2024-12-23 11:27 ` Guinevere Larsen
@ 2024-12-24 14:55 ` Luis Machado
2025-01-02 11:58 ` Guinevere Larsen
2025-01-10 17:25 ` Kévin Le Gouguec
2025-01-13 14:47 ` Andrew Burgess
6 siblings, 1 reply; 18+ messages in thread
From: Luis Machado @ 2024-12-24 14:55 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
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 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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
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
0 siblings, 2 replies; 18+ messages in thread
From: Guinevere Larsen @ 2025-01-02 11:58 UTC (permalink / raw)
To: Luis Machado, Tom Tromey, gdb-patches
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
> 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.
--
Cheers,
Guinevere Larsen
She/Her/Hers
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2025-01-02 11:58 ` Guinevere Larsen
@ 2025-01-02 12:55 ` Luis Machado
2025-01-31 21:55 ` Tom Tromey
1 sibling, 0 replies; 18+ messages in thread
From: Luis Machado @ 2025-01-02 12:55 UTC (permalink / raw)
To: Guinevere Larsen, Tom Tromey, gdb-patches
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.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-20 21:03 [RFC] Use emoji to indicate errors and warnings Tom Tromey
` (4 preceding siblings ...)
2024-12-24 14:55 ` Luis Machado
@ 2025-01-10 17:25 ` Kévin Le Gouguec
2025-01-13 14:47 ` Andrew Burgess
6 siblings, 0 replies; 18+ messages in thread
From: Kévin Le Gouguec @ 2025-01-10 17:25 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Tom Tromey <tromey@adacore.com> writes:
> 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.
I rather like the way Emacs's icons.el handles configuration, some of
which might be applicable to GDB?
* "Icons" are defined as a reference name + a set of alternative
presentations:
(define-icon outline-open nil
'((image "outline-open.svg" "outline-open.pbm" :height (0.8 . em))
(emoji "🔽")
(symbol " ▼ ")
(text " open "))
"Icon used for buttons for opened sections in outline buffers."
…)
* Users express their preferred presentation by setting the
icon-preference user option.
(defcustom icon-preference '(image emoji symbol text)
"List of icon types to use, in order of preference.
Emacs will choose the icon of the highest preference possible
on the current display, and \"degrade\" gracefully to an icon
type that's available."
…)
* The rest of the codebase then invokes (icon-string 'outline-open) to
get the correct "string" to insert ("string" in quotes because of the
'image representation).
The "\n⚠️ warning: " example in your patch makes me wonder whether
"emoji+text" should be an option too in that scheme. (That would
probably help the folks who report confusion with Emacs's choice of "⛔"
for warnings-suppress…)
(No thoughts on what the default presentation should be - beside
agreeing with Guinevere's assessment that experienced users stand a
better chance of reaching for a knob to turn emoji off, than novices are
to be on the lookout for a knob to turn them on)
> Also it should probably be dependent on whether the current encoding
> is UTF-8 compatible.
>
> Anyway, looking for feedback.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-20 21:03 [RFC] Use emoji to indicate errors and warnings Tom Tromey
` (5 preceding siblings ...)
2025-01-10 17:25 ` Kévin Le Gouguec
@ 2025-01-13 14:47 ` Andrew Burgess
2025-01-13 15:21 ` Puputti, Matti
6 siblings, 1 reply; 18+ messages in thread
From: Andrew Burgess @ 2025-01-13 14:47 UTC (permalink / raw)
To: Tom Tromey, gdb-patches; +Cc: Tom Tromey
Tom Tromey <tromey@adacore.com> writes:
> 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.
While I like the colours, I'm not totally convinced about this! But I'm
not against it going in, if it makes some people happy. I would
certainly like to see a run-time switch to allow this to be turned off
though.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [RFC] Use emoji to indicate errors and warnings
2025-01-13 14:47 ` Andrew Burgess
@ 2025-01-13 15:21 ` Puputti, Matti
0 siblings, 0 replies; 18+ messages in thread
From: Puputti, Matti @ 2025-01-13 15:21 UTC (permalink / raw)
To: Andrew Burgess, Tom Tromey, gdb-patches; +Cc: Tom Tromey
> Tom Tromey <tromey@adacore.com> writes:
>
> > 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.
>
> While I like the colours, I'm not totally convinced about this! But I'm
> not against it going in, if it makes some people happy. I would
> certainly like to see a run-time switch to allow this to be turned off
> though.
>
> Thanks,
> Andrew
I second to that. Personally I would prefer it to be disabled by default,
but obviously that is just my personal opinion.
Br,
Matti Puputti
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-20 21:10 ` Paul Koning
@ 2025-01-31 21:50 ` Tom Tromey
0 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2025-01-31 21:50 UTC (permalink / raw)
To: Paul Koning; +Cc: Tom Tromey, gdb-patches
>>>>> "Paul" == Paul Koning <paulkoning@comcast.net> writes:
Paul> I don't like this at all. It's bad enough to have coloring in
Paul> error messages; but please let's keep them as normal text, without
Paul> graphics elements.
You can disable all styling, and with the next patch this will include
disabling emoji. So I think a complaint like "it's bad enough" doesn't
really apply -- this is 100% under your control.
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-21 7:07 ` Eli Zaretskii
@ 2025-01-31 21:53 ` Tom Tromey
2025-02-01 8:15 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Tom Tromey @ 2025-01-31 21:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Tom Tromey, gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> For example, if you
Eli> run GDB from a shell prompt, you need to establish whether the font
Eli> used by the shell window/console supports the Emoji codepoints;
Eli> testing the encoding is not enough.
There's no way to do this AFAIK.
Anyway it'll be easy to disable.
I thought maybe terminfo would help out here but I didn't see anything.
Which is kind of sad since that's it's main job.
Eli> As a counter-example, on my
Eli> Windows 11 system the encoding of the cmd.exe window is definitely not
Eli> UTF-8, and yet copy/pasting the Emoji from your patch shows them as
Eli> icons, with the fonts I use in these windows.
Do you leave color enabled?
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2024-12-23 11:27 ` Guinevere Larsen
@ 2025-01-31 21:53 ` Tom Tromey
0 siblings, 0 replies; 18+ messages in thread
From: Tom Tromey @ 2025-01-31 21:53 UTC (permalink / raw)
To: Guinevere Larsen; +Cc: Tom Tromey, gdb-patches
>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:
>> catch (const gdb_exception_error &except)
>> {
>> - if (warning_pre_print)
>> - gdb_puts (warning_pre_print, gdb_stderr);
>> -
Guinevere> I'm unsure if this change is related to the emoji change. did you mean
Guinevere> to add a different puts line?
No, I meant to remove this.
I've split this out into a separate patch with an explanation.
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
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
1 sibling, 1 reply; 18+ messages in thread
From: Tom Tromey @ 2025-01-31 21:55 UTC (permalink / raw)
To: Guinevere Larsen; +Cc: Luis Machado, Tom Tromey, gdb-patches
>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:
>> But while coloring would be fine by default, I think the emojis
>> would need to be off by default for now.
Guinevere> I disagree because of discoverability. Emojis will help inexperienced
Guinevere> users the most, and those users are unlikely to look at changelogs and
Guinevere> news entries for what GDB has added
Yeah, I agree with this. I think it's should even be a general rule
that new features, if they are widely useful, should be enabled by
default; then gdb can make it easy to disable things that particular
users don't like.
Tom
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2025-01-31 21:53 ` Tom Tromey
@ 2025-02-01 8:15 ` Eli Zaretskii
0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2025-02-01 8:15 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
> Date: Fri, 31 Jan 2025 14:53:09 -0700
>
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
> Eli> For example, if you
> Eli> run GDB from a shell prompt, you need to establish whether the font
> Eli> used by the shell window/console supports the Emoji codepoints;
> Eli> testing the encoding is not enough.
>
> There's no way to do this AFAIK.
No easy way, anyway.
> I thought maybe terminfo would help out here but I didn't see anything.
I don't think there's anything similar to terminfo on Windows, and the
part related to the font used by a terminal emulator is not in
terminfo AFAIU anyway.
> Eli> As a counter-example, on my
> Eli> Windows 11 system the encoding of the cmd.exe window is definitely not
> Eli> UTF-8, and yet copy/pasting the Emoji from your patch shows them as
> Eli> icons, with the fonts I use in these windows.
>
> Do you leave color enabled?
I'm not sure I understand the question. Which color are you asking
about? Is that some setting of the Windows terminal or is it
something else?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2025-01-31 21:55 ` Tom Tromey
@ 2025-02-03 9:32 ` Luis Machado
2025-02-03 16:09 ` Luis Machado
0 siblings, 1 reply; 18+ messages in thread
From: Luis Machado @ 2025-02-03 9:32 UTC (permalink / raw)
To: Tom Tromey, Guinevere Larsen; +Cc: gdb-patches
On 1/31/25 21:55, Tom Tromey wrote:
>>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:
>
>>> But while coloring would be fine by default, I think the emojis
>>> would need to be off by default for now.
>
> Guinevere> I disagree because of discoverability. Emojis will help inexperienced
> Guinevere> users the most, and those users are unlikely to look at changelogs and
> Guinevere> news entries for what GDB has added
>
> Yeah, I agree with this. I think it's should even be a general rule
> that new features, if they are widely useful, should be enabled by
> default; then gdb can make it easy to disable things that particular
> users don't like.
>
> Tom
Fair enough. If a number of folks think it is useful, then let's go for it and
see what we get as usage feedback.
It would be nice to get some more opinions going. But I'll leave my ...
Approved-By: Luis Machado <luis.machado@arm.com>
... for now.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [RFC] Use emoji to indicate errors and warnings
2025-02-03 9:32 ` Luis Machado
@ 2025-02-03 16:09 ` Luis Machado
0 siblings, 0 replies; 18+ messages in thread
From: Luis Machado @ 2025-02-03 16:09 UTC (permalink / raw)
To: Tom Tromey, Guinevere Larsen; +Cc: gdb-patches
On 2/3/25 09:32, Luis Machado wrote:
> On 1/31/25 21:55, Tom Tromey wrote:
>>>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:
>>
>>>> But while coloring would be fine by default, I think the emojis
>>>> would need to be off by default for now.
>>
>> Guinevere> I disagree because of discoverability. Emojis will help inexperienced
>> Guinevere> users the most, and those users are unlikely to look at changelogs and
>> Guinevere> news entries for what GDB has added
>>
>> Yeah, I agree with this. I think it's should even be a general rule
>> that new features, if they are widely useful, should be enabled by
>> default; then gdb can make it easy to disable things that particular
>> users don't like.
>>
>> Tom
>
> Fair enough. If a number of folks think it is useful, then let's go for it and
> see what we get as usage feedback.
>
> It would be nice to get some more opinions going. But I'll leave my ...
>
> Approved-By: Luis Machado <luis.machado@arm.com>
>
> ... for now.
Looks like the testsuite might need adjustments to cope with the extra items.
^ 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