]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix "maint print" error messages
authorTom Tromey <tom@tromey.com>
Wed, 9 Oct 2024 21:31:11 +0000 (15:31 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 4 Dec 2024 01:42:57 +0000 (18:42 -0700)
While working on an earlier patch, I noticed that all the
register-related "maint print" commands used the wrong command name in
an error message.  This fixes them.

Reviewed-by: Christina Schimpe <christina.schimpe@intel.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/regcache-dump.c

index 9be694dc2ab4dd4fa215dab4177a2165cd52eb9f..037a232189c751576bcd09728858195aac9d64e8 100644 (file)
@@ -245,8 +245,14 @@ enum regcache_dump_what
   regcache_dump_remote
 };
 
+/* Helper for the various maint commands that print registers.  ARGS
+   is the arguments passed to the command.  WHAT_TO_DUMP indicates
+   exactly which registers to display.  COMMAND is the command name,
+   used in error messages.  */
+
 static void
-regcache_print (const char *args, enum regcache_dump_what what_to_dump)
+regcache_print (const char *args, enum regcache_dump_what what_to_dump,
+               const char *command)
 {
   /* Where to send output.  */
   stdio_file file;
@@ -255,7 +261,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
   if (args != nullptr)
     {
       if (!file.open (args, "w"))
-       perror_with_name (_("maintenance print architecture"));
+       perror_with_name (command);
       redirect.emplace (current_uiout, &file);
     }
 
@@ -310,31 +316,34 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
 static void
 maintenance_print_registers (const char *args, int from_tty)
 {
-  regcache_print (args, regcache_dump_none);
+  regcache_print (args, regcache_dump_none, "maintenance print registers");
 }
 
 static void
 maintenance_print_raw_registers (const char *args, int from_tty)
 {
-  regcache_print (args, regcache_dump_raw);
+  regcache_print (args, regcache_dump_raw, "maintenance print raw-registers");
 }
 
 static void
 maintenance_print_cooked_registers (const char *args, int from_tty)
 {
-  regcache_print (args, regcache_dump_cooked);
+  regcache_print (args, regcache_dump_cooked,
+                 "maintenance print cooked-registers");
 }
 
 static void
 maintenance_print_register_groups (const char *args, int from_tty)
 {
-  regcache_print (args, regcache_dump_groups);
+  regcache_print (args, regcache_dump_groups,
+                 "maintenance print register-groups");
 }
 
 static void
 maintenance_print_remote_registers (const char *args, int from_tty)
 {
-  regcache_print (args, regcache_dump_remote);
+  regcache_print (args, regcache_dump_remote,
+                 "maintenance print remote-registers");
 }
 
 void _initialize_regcache_dump ();