[0/4] Add more styling of error messages

Message ID 20260405-more-error-style-v1-0-6c04da718875@tromey.com
Headers
Series Add more styling of error messages |

Message

Tom Tromey April 5, 2026, 11:28 a.m. UTC
  This series adds more styling of error messages.  I searched through
error messages for common patterns to find the places to edit.  So, I
have probably missed a few.

I fixed up some quoting in the "command style" patch, but in other
spots I left it alone.

I didn't write new tests.  I don't know how anyone else feels about
this but I tend to think that testing the styling of error messages is
overkill.

There are still more styles that could be applied, for instance line
numbers.  Also I discovered that the previous fix to allow error() to
be styled did not apply to throw_error et al.  So, some more work
there is needed.

Regression tested on x86-64 Fedora 40.

Signed-off-by: Tom Tromey <tom@tromey.com>
---
Tom Tromey (4):
      Add command styling to error messages
      Add filename styling to error messages
      Add variable styling to error messages
      Add function styling to error messages

 gdb/ada-exp.y                       |  8 +++--
 gdb/ada-tasks.c                     | 10 ++++---
 gdb/amd64-linux-tdep.c              |  5 ++--
 gdb/breakpoint.c                    | 50 +++++++++++++++++++++-----------
 gdb/c-exp.y                         | 10 +++++--
 gdb/cli/cli-cmds.c                  | 35 ++++++++++++++--------
 gdb/cli/cli-dump.c                  | 21 +++++++++-----
 gdb/cli/cli-script.c                | 33 ++++++++++++++-------
 gdb/cli/cli-utils.c                 | 18 ++++++++----
 gdb/coffread.c                      | 19 ++++++++----
 gdb/compile/compile-object-load.c   | 36 +++++++++++++----------
 gdb/compile/compile.c               |  6 ++--
 gdb/corelow.c                       | 10 ++++---
 gdb/ctfread.c                       | 16 ++++++----
 gdb/d-exp.y                         |  4 ++-
 gdb/dwarf2/ada-imported.c           |  6 ++--
 gdb/dwarf2/dwz.c                    |  9 +++---
 gdb/eval.c                          |  9 ++++--
 gdb/exec.c                          | 14 +++++----
 gdb/findvar.c                       |  4 ++-
 gdb/gcore.c                         |  9 ++++--
 gdb/gdb_bfd.c                       | 12 +++++---
 gdb/guile/guile.c                   |  4 ++-
 gdb/inf-child.c                     |  3 +-
 gdb/infcall.c                       | 58 ++++++++++++++++++++++---------------
 gdb/infcmd.c                        |  6 ++--
 gdb/linespec.c                      |  1 +
 gdb/linux-nat.c                     |  4 ++-
 gdb/maint.c                         |  3 +-
 gdb/parse.c                         |  4 ++-
 gdb/printcmd.c                      | 11 +++----
 gdb/python/python.c                 |  3 +-
 gdb/record-btrace.c                 |  4 ++-
 gdb/record-full.c                   | 25 +++++++++-------
 gdb/record.c                        |  6 ++--
 gdb/remote-fileio.c                 | 11 +++++--
 gdb/remote.c                        | 20 +++++++++----
 gdb/rust-lang.c                     |  6 ++--
 gdb/skip.c                          |  5 ++--
 gdb/solib-aix.c                     | 16 ++++++----
 gdb/solib-darwin.c                  |  7 +++--
 gdb/solib.c                         | 14 +++++----
 gdb/symfile-mem.c                   | 16 +++++++---
 gdb/symfile.c                       | 30 +++++++++++--------
 gdb/symmisc.c                       |  3 +-
 gdb/symtab.c                        |  3 +-
 gdb/target.c                        | 41 +++++++++++++++++---------
 gdb/testsuite/gdb.base/commands.exp |  3 +-
 gdb/testsuite/gdb.base/default.exp  |  2 +-
 gdb/tracectf.c                      | 16 ++++++----
 gdb/tracefile-tfile.c               |  6 ++--
 gdb/utils.c                         |  4 ++-
 gdb/valops.c                        | 29 +++++++++++--------
 gdb/xcoffread.c                     |  6 ++--
 gdb/xml-support.c                   |  5 +++-
 55 files changed, 465 insertions(+), 254 deletions(-)
---
base-commit: 2ec5e53d96e3def7ee11966fd07ae215be84515a
change-id: 20260405-more-error-style-0c3bb6e1b9ad

Best regards,
  

Comments

Andrew Burgess April 5, 2026, 12:55 p.m. UTC | #1
Tom Tromey <tom@tromey.com> writes:

> This series adds more styling of error messages.  I searched through
> error messages for common patterns to find the places to edit.  So, I
> have probably missed a few.
>
> I fixed up some quoting in the "command style" patch, but in other
> spots I left it alone.
>
> I didn't write new tests.  I don't know how anyone else feels about
> this but I tend to think that testing the styling of error messages is
> overkill.
>
> There are still more styles that could be applied, for instance line
> numbers.  Also I discovered that the previous fix to allow error() to
> be styled did not apply to throw_error et al.  So, some more work
> there is needed.
>
> Regression tested on x86-64 Fedora 40.

I've not checked every single change, but I looked through a random
sampling, and it all looks good.  Nice to see more styling being added.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew



>
> Signed-off-by: Tom Tromey <tom@tromey.com>
> ---
> Tom Tromey (4):
>       Add command styling to error messages
>       Add filename styling to error messages
>       Add variable styling to error messages
>       Add function styling to error messages
>
>  gdb/ada-exp.y                       |  8 +++--
>  gdb/ada-tasks.c                     | 10 ++++---
>  gdb/amd64-linux-tdep.c              |  5 ++--
>  gdb/breakpoint.c                    | 50 +++++++++++++++++++++-----------
>  gdb/c-exp.y                         | 10 +++++--
>  gdb/cli/cli-cmds.c                  | 35 ++++++++++++++--------
>  gdb/cli/cli-dump.c                  | 21 +++++++++-----
>  gdb/cli/cli-script.c                | 33 ++++++++++++++-------
>  gdb/cli/cli-utils.c                 | 18 ++++++++----
>  gdb/coffread.c                      | 19 ++++++++----
>  gdb/compile/compile-object-load.c   | 36 +++++++++++++----------
>  gdb/compile/compile.c               |  6 ++--
>  gdb/corelow.c                       | 10 ++++---
>  gdb/ctfread.c                       | 16 ++++++----
>  gdb/d-exp.y                         |  4 ++-
>  gdb/dwarf2/ada-imported.c           |  6 ++--
>  gdb/dwarf2/dwz.c                    |  9 +++---
>  gdb/eval.c                          |  9 ++++--
>  gdb/exec.c                          | 14 +++++----
>  gdb/findvar.c                       |  4 ++-
>  gdb/gcore.c                         |  9 ++++--
>  gdb/gdb_bfd.c                       | 12 +++++---
>  gdb/guile/guile.c                   |  4 ++-
>  gdb/inf-child.c                     |  3 +-
>  gdb/infcall.c                       | 58 ++++++++++++++++++++++---------------
>  gdb/infcmd.c                        |  6 ++--
>  gdb/linespec.c                      |  1 +
>  gdb/linux-nat.c                     |  4 ++-
>  gdb/maint.c                         |  3 +-
>  gdb/parse.c                         |  4 ++-
>  gdb/printcmd.c                      | 11 +++----
>  gdb/python/python.c                 |  3 +-
>  gdb/record-btrace.c                 |  4 ++-
>  gdb/record-full.c                   | 25 +++++++++-------
>  gdb/record.c                        |  6 ++--
>  gdb/remote-fileio.c                 | 11 +++++--
>  gdb/remote.c                        | 20 +++++++++----
>  gdb/rust-lang.c                     |  6 ++--
>  gdb/skip.c                          |  5 ++--
>  gdb/solib-aix.c                     | 16 ++++++----
>  gdb/solib-darwin.c                  |  7 +++--
>  gdb/solib.c                         | 14 +++++----
>  gdb/symfile-mem.c                   | 16 +++++++---
>  gdb/symfile.c                       | 30 +++++++++++--------
>  gdb/symmisc.c                       |  3 +-
>  gdb/symtab.c                        |  3 +-
>  gdb/target.c                        | 41 +++++++++++++++++---------
>  gdb/testsuite/gdb.base/commands.exp |  3 +-
>  gdb/testsuite/gdb.base/default.exp  |  2 +-
>  gdb/tracectf.c                      | 16 ++++++----
>  gdb/tracefile-tfile.c               |  6 ++--
>  gdb/utils.c                         |  4 ++-
>  gdb/valops.c                        | 29 +++++++++++--------
>  gdb/xcoffread.c                     |  6 ++--
>  gdb/xml-support.c                   |  5 +++-
>  55 files changed, 465 insertions(+), 254 deletions(-)
> ---
> base-commit: 2ec5e53d96e3def7ee11966fd07ae215be84515a
> change-id: 20260405-more-error-style-0c3bb6e1b9ad
>
> Best regards,
> -- 
> Tom Tromey <tom@tromey.com>
  
Tom Tromey April 9, 2026, 1:10 a.m. UTC | #2
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> I've not checked every single change, but I looked through a random
Andrew> sampling, and it all looks good.  Nice to see more styling being added.

Andrew> Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks.

I went through the patches again and found one typo which I've fixed:

-	       styled_string (command_style.style (), "while-steppinge"));
+	       styled_string (command_style.style (), "while-stepping"));

I'm going to check it in now.

Tom