Error message uniformity

Message ID 20230128031117.464724-1-tom@tromey.com
State New
Headers
Series Error message uniformity |

Commit Message

Tom Tromey Jan. 28, 2023, 3:11 a.m. UTC
  I found one spot that says "No symbol table loaded", while other spots
say "No symbol table is loaded".  In the interests of unformity, this
patch fixes that one spot.

Tested on x86-64 Fedora 36.
---
 gdb/infcmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Simon Marchi Jan. 30, 2023, 4:13 p.m. UTC | #1
On 1/27/23 22:11, Tom Tromey wrote:
> I found one spot that says "No symbol table loaded", while other spots
> say "No symbol table is loaded".  In the interests of unformity, this
> patch fixes that one spot.
> 
> Tested on x86-64 Fedora 36.
> ---
>  gdb/infcmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index fd88b8ca328..baa771828b1 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -537,7 +537,7 @@ start_command (const char *args, int from_tty)
>       minimal symbols for the location where to put the temporary
>       breakpoint before starting.  */
>    if (!have_minimal_symbols ())
> -    error (_("No symbol table loaded.  Use the \"file\" command."));
> +    error (_("No symbol table is loaded.  Use the \"file\" command."));
>  
>    /* Run the program until reaching the main procedure...  */
>    run_command_1 (args, from_tty, RUN_STOP_AT_MAIN);
> -- 
> 2.39.1
> 

You patch LGTM.

However, I think it would be worth factoring all of these in a single
function (e.g. error_no_symbol_table).

$ ag '"No symbol table is loaded' | grep -v testsuite
p-exp.y:732:                            error (_("No symbol table is loaded.  "
parse.c:239:    error (_("No symbol table is loaded.  Use the \"file\" command."));
d-exp.y:474:                    error (_("No symbol table is loaded.  Use the \"file\" command"));
symtab.c:4517:    error (_("No symbol table is loaded.  Use the \"file\" command."));
source.c:264:    error (_("No symbol table is loaded.  Use the \"file\" command."));
infcmd.c:540:    error (_("No symbol table is loaded.  Use the \"file\" command."));
go-exp.y:586:                           error (_("No symbol table is loaded.  "
ada-exp.y:1731: error (_("No symbol table is loaded.  Use the \"file\" command."));
cli/cli-cmds.c:1247:    error (_("No symbol table is loaded.  Use the \"file\" command."));
linespec.c:1570:                 _("No symbol table is loaded.  Use the \"file\" command."));
linespec.c:3734:                     _("No symbol table is loaded.  "
c-exp.y:1220:                               error (_("No symbol table is loaded.  Use the \"file\" command."));

Simon
  
Tom Tromey Jan. 30, 2023, 11:36 p.m. UTC | #2
Simon> However, I think it would be worth factoring all of these in a single
Simon> function (e.g. error_no_symbol_table).

It's a little funny because the linespec ones throw a specific exception.
Though I wonder if they all could.

Tom
  

Patch

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index fd88b8ca328..baa771828b1 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -537,7 +537,7 @@  start_command (const char *args, int from_tty)
      minimal symbols for the location where to put the temporary
      breakpoint before starting.  */
   if (!have_minimal_symbols ())
-    error (_("No symbol table loaded.  Use the \"file\" command."));
+    error (_("No symbol table is loaded.  Use the \"file\" command."));
 
   /* Run the program until reaching the main procedure...  */
   run_command_1 (args, from_tty, RUN_STOP_AT_MAIN);