[binutils-gdb] [gdb] Add missing i18n support to error strings (part 3)

Tom de Vries via Gdb-cvs <[email protected]> Tue, 9 Jun 2026 20:14:27 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d62997ecff3aa9e9ea15c4d73494f229c7d63ee1

commit d62997ecff3aa9e9ea15c4d73494f229c7d63ee1
Author: Tom de Vries <[email protected]>
Date:   Tue Jun 9 22:14:07 2026 +0200

    [gdb] Add missing i18n support to error strings (part 3)
    
    Add missing i18n support to some error strings.
    
    Result of:
    ...
    $ find gdb* -type f -name "*.[ch]" -o -name "*.cc" \
        | egrep -v /testsuite/ \
        | xargs sed -i \
            '/"[ \t]*%s[ \t]*"/b l;s/\([ \t]\)error (\("[^"]*"\)\([^)]*\));/\1error (_(\2)\3);/;:l'
    ...
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdbserver/linux-low.cc       | 2 +-
 gdbserver/linux-tic6x-low.cc | 2 +-
 gdbserver/netbsd-low.cc      | 4 ++--
 gdbserver/remote-utils.cc    | 4 ++--
 gdbserver/server.cc          | 2 +-
 gdbserver/tracepoint.cc      | 4 ++--
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index b4ec524dbbf..117b67afda2 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -5182,7 +5182,7 @@ register_addr (const struct usrregs_info *usrregs, int regnum)
   int addr;
 
   if (regnum < 0 || regnum >= usrregs->num_regs)
-    error ("Invalid register number %d.", regnum);
+    error (_("Invalid register number %d."), regnum);
 
   addr = usrregs->regmap[regnum];
 
diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc
index 9470ca690a0..eff1186a079 100644
--- a/gdbserver/linux-tic6x-low.cc
+++ b/gdbserver/linux-tic6x-low.cc
@@ -373,7 +373,7 @@ tic6x_target::low_arch_setup ()
       feature = C6X_C6XP;
       break;
     default:
-      error ("Unknown CPU ID 0x%02x", cpuid);
+      error (_("Unknown CPU ID 0x%02x"), cpuid);
     }
   tic6x_usrregs_info.regmap = tic6x_regmap;
 
diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc
index 5e3826ca6a8..8462c5d3180 100644
--- a/gdbserver/netbsd-low.cc
+++ b/gdbserver/netbsd-low.cc
@@ -1134,13 +1134,13 @@ elf_64_file_p (const char *file)
     perror_with_name (("read"));
   gdb::close (fd);
   if (ret != sizeof (header))
-    error ("Cannot read ELF file header: %s", file);
+    error (_("Cannot read ELF file header: %s"), file);
 
   if (header.e_ident[EI_MAG0] != ELFMAG0
       || header.e_ident[EI_MAG1] != ELFMAG1
       || header.e_ident[EI_MAG2] != ELFMAG2
       || header.e_ident[EI_MAG3] != ELFMAG3)
-    error ("Unrecognized ELF file header: %s", file);
+    error (_("Unrecognized ELF file header: %s"), file);
 
   return header.e_ident[EI_CLASS] == ELFCLASS64;
 }
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index 65452fbcdfa..f505d85206e 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -574,7 +574,7 @@ read_ptid (const char *buf, const char **obuf)
       /* Multi-process ptid.  */
       pp = unpack_varlen_hex (p + 1, &hex);
       if (pp == (p + 1) || *pp != '.')
-	error ("invalid remote ptid: %s\n", buf);
+	error (_("invalid remote ptid: %s\n"), buf);
 
       pid = (ptid_t::pid_type) (LONGEST) hex;
       if (hex != ((ULONGEST) pid))
@@ -583,7 +583,7 @@ read_ptid (const char *buf, const char **obuf)
       p = pp + 1;
       hex = hex_or_minus_one (p, &pp);
       if (pp == p)
-	error ("invalid remote ptid: %s\n", buf);
+	error (_("invalid remote ptid: %s\n"), buf);
 
       lwp = (ptid_t::lwp_type) (LONGEST) hex;
       if (hex != ((ULONGEST) lwp))
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index b6d785a0c64..f732616bba8 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -305,7 +305,7 @@ attach_inferior (int pid)
      0 if it succeeded, and call error() otherwise.  */
 
   if (find_process_pid (pid) != nullptr)
-    error ("Already attached to process %d\n", pid);
+    error (_("Already attached to process %d\n"), pid);
 
   if (myattach (pid) != 0)
     return -1;
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index 3d3f0776fc0..f5f29300949 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -537,7 +537,7 @@ tracepoint_action_send (char *buffer, const struct tracepoint_action *action)
     case 'X':
       return x_tracepoint_action_send (buffer, action);
     }
-  error ("Unknown trace action '%c'.", action->type);
+  error (_("Unknown trace action '%c'."), action->type);
 }
 
 static CORE_ADDR
@@ -552,7 +552,7 @@ tracepoint_action_download (const struct tracepoint_action *action)
     case 'X':
       return x_tracepoint_action_download (action);
     }
-  error ("Unknown trace action '%c'.", action->type);
+  error (_("Unknown trace action '%c'."), action->type);
 }
 #endif