public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove trailing '.' from perror_with_name calls
@ 2022-06-08 19:04 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2022-06-08 19:04 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=deb70aa0322c4c43b68fa859b52a0ccf2d904b0f

commit deb70aa0322c4c43b68fa859b52a0ccf2d904b0f
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Tue Jun 7 17:18:20 2022 +0100

    gdb: remove trailing '.' from perror_with_name calls
    
    I ran into this error while working on AArch64 GDB:
    
      Unable to fetch VFP registers.: Invalid argument.
    
    Notice the '.:' in the middle of this error message.
    
    This is because of this call in aarch64-linux-nat.c:
    
      perror_with_name (_("Unable to fetch VFP registers."));
    
    The perror_with_name function take a string, and adds ': <message>' to
    the end the string, so I don't think the string that we pass to
    perror_with_name should end in '.'.
    
    This commit removes all of the trailing '.' characters from
    perror_with_name calls, which give more readable error messages.
    
    I don't believe that any of these errors are tested in the
    testsuite (after a little grepping).

Diff:
---
 gdb/aarch64-linux-nat.c | 30 +++++++++++++++---------------
 gdb/arm-linux-nat.c     | 24 ++++++++++++------------
 gdb/fbsd-nat.c          |  2 +-
 gdb/netbsd-nat.c        |  2 +-
 gdb/ppc-linux-nat.c     | 12 ++++++------
 gdb/procfs.c            |  2 +-
 6 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 9cde72b247b..ff5c4c0a212 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -145,7 +145,7 @@ fetch_gregs_from_thread (struct regcache *regcache)
 
   ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec);
   if (ret < 0)
-    perror_with_name (_("Unable to fetch general registers."));
+    perror_with_name (_("Unable to fetch general registers"));
 
   if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
     aarch32_gp_regcache_supply (regcache, (uint32_t *) regs, 1);
@@ -182,7 +182,7 @@ store_gregs_to_thread (const struct regcache *regcache)
 
   ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec);
   if (ret < 0)
-    perror_with_name (_("Unable to fetch general registers."));
+    perror_with_name (_("Unable to fetch general registers"));
 
   if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
     aarch32_gp_regcache_collect (regcache, (uint32_t *) regs, 1);
@@ -197,7 +197,7 @@ store_gregs_to_thread (const struct regcache *regcache)
 
   ret = ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, &iovec);
   if (ret < 0)
-    perror_with_name (_("Unable to store general registers."));
+    perror_with_name (_("Unable to store general registers"));
 }
 
 /* Fill GDB's register array with the fp/simd register values
@@ -225,7 +225,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
 
       ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
       if (ret < 0)
-	perror_with_name (_("Unable to fetch VFP registers."));
+	perror_with_name (_("Unable to fetch VFP registers"));
 
       aarch32_vfp_regcache_supply (regcache, (gdb_byte *) &regs, 32);
     }
@@ -237,7 +237,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
 
       ret = ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec);
       if (ret < 0)
-	perror_with_name (_("Unable to fetch vFP/SIMD registers."));
+	perror_with_name (_("Unable to fetch vFP/SIMD registers"));
 
       for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
 	regcache->raw_supply (regno, &regs.vregs[regno - AARCH64_V0_REGNUM]);
@@ -271,7 +271,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
 
       ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
       if (ret < 0)
-	perror_with_name (_("Unable to fetch VFP registers."));
+	perror_with_name (_("Unable to fetch VFP registers"));
 
       aarch32_vfp_regcache_collect (regcache, (gdb_byte *) &regs, 32);
     }
@@ -283,7 +283,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
 
       ret = ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec);
       if (ret < 0)
-	perror_with_name (_("Unable to fetch FP/SIMD registers."));
+	perror_with_name (_("Unable to fetch FP/SIMD registers"));
 
       for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
 	if (REG_VALID == regcache->get_register_status (regno))
@@ -300,13 +300,13 @@ store_fpregs_to_thread (const struct regcache *regcache)
     {
       ret = ptrace (PTRACE_SETREGSET, tid, NT_ARM_VFP, &iovec);
       if (ret < 0)
-	perror_with_name (_("Unable to store VFP registers."));
+	perror_with_name (_("Unable to store VFP registers"));
     }
   else
     {
       ret = ptrace (PTRACE_SETREGSET, tid, NT_FPREGSET, &iovec);
       if (ret < 0)
-	perror_with_name (_("Unable to store FP/SIMD registers."));
+	perror_with_name (_("Unable to store FP/SIMD registers"));
     }
 }
 
@@ -334,7 +334,7 @@ store_sveregs_to_thread (struct regcache *regcache)
   /* First store vector length to the thread.  This is done first to ensure the
      ptrace buffers read from the kernel are the correct size.  */
   if (!aarch64_sve_set_vq (tid, regcache))
-    perror_with_name (_("Unable to set VG register."));
+    perror_with_name (_("Unable to set VG register"));
 
   /* Obtain a dump of SVE registers from ptrace.  */
   std::unique_ptr<gdb_byte[]> base = aarch64_sve_get_sveregs (tid);
@@ -369,7 +369,7 @@ fetch_pauth_masks_from_thread (struct regcache *regcache)
 
   ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_PAC_MASK, &iovec);
   if (ret != 0)
-    perror_with_name (_("unable to fetch pauth registers."));
+    perror_with_name (_("unable to fetch pauth registers"));
 
   regcache->raw_supply (AARCH64_PAUTH_DMASK_REGNUM (tdep->pauth_reg_base),
 			&pauth_regset[0]);
@@ -397,7 +397,7 @@ fetch_mteregs_from_thread (struct regcache *regcache)
 
   int tid = get_ptrace_pid (regcache->ptid ());
   if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_TAGGED_ADDR_CTRL, &iovec) != 0)
-      perror_with_name (_("unable to fetch MTE registers."));
+      perror_with_name (_("unable to fetch MTE registers"));
 
   regcache->raw_supply (regno, &tag_ctl);
 }
@@ -428,7 +428,7 @@ store_mteregs_to_thread (struct regcache *regcache)
 
   int tid = get_ptrace_pid (regcache->ptid ());
   if (ptrace (PTRACE_SETREGSET, tid, NT_ARM_TAGGED_ADDR_CTRL, &iovec) != 0)
-    perror_with_name (_("unable to store MTE registers."));
+    perror_with_name (_("unable to store MTE registers"));
 }
 
 /* Fill GDB's register array with the TLS register values from
@@ -451,7 +451,7 @@ fetch_tlsregs_from_thread (struct regcache *regcache)
 
   int tid = get_ptrace_pid (regcache->ptid ());
   if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_TLS, &iovec) != 0)
-      perror_with_name (_("unable to fetch TLS register."));
+      perror_with_name (_("unable to fetch TLS register"));
 
   regcache->raw_supply (regno, &tpidr);
 }
@@ -482,7 +482,7 @@ store_tlsregs_to_thread (struct regcache *regcache)
 
   int tid = get_ptrace_pid (regcache->ptid ());
   if (ptrace (PTRACE_SETREGSET, tid, NT_ARM_TLS, &iovec) != 0)
-    perror_with_name (_("unable to store TLS register."));
+    perror_with_name (_("unable to store TLS register"));
 }
 
 /* Implement the "fetch_registers" target_ops method.  */
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 2abaf5a675d..8dac8456282 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -135,7 +135,7 @@ fetch_fpregs (struct regcache *regcache)
     ret = ptrace (PT_GETFPREGS, tid, 0, fp);
 
   if (ret < 0)
-    perror_with_name (_("Unable to fetch the floating point registers."));
+    perror_with_name (_("Unable to fetch the floating point registers"));
 
   /* Fetch fpsr.  */
   regcache->raw_supply (ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
@@ -172,7 +172,7 @@ store_fpregs (const struct regcache *regcache)
     ret = ptrace (PT_GETFPREGS, tid, 0, fp);
 
   if (ret < 0)
-    perror_with_name (_("Unable to fetch the floating point registers."));
+    perror_with_name (_("Unable to fetch the floating point registers"));
 
   /* Store fpsr.  */
   if (REG_VALID == regcache->get_register_status (ARM_FPS_REGNUM))
@@ -196,7 +196,7 @@ store_fpregs (const struct regcache *regcache)
     ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
 
   if (ret < 0)
-    perror_with_name (_("Unable to store floating point registers."));
+    perror_with_name (_("Unable to store floating point registers"));
 }
 
 /* Fetch all general registers of the process and store into
@@ -224,7 +224,7 @@ fetch_regs (struct regcache *regcache)
     ret = ptrace (PTRACE_GETREGS, tid, 0, &regs);
 
   if (ret < 0)
-    perror_with_name (_("Unable to fetch general registers."));
+    perror_with_name (_("Unable to fetch general registers"));
 
   aarch32_gp_regcache_supply (regcache, (uint32_t *) regs, arm_apcs_32);
 }
@@ -252,7 +252,7 @@ store_regs (const struct regcache *regcache)
     ret = ptrace (PTRACE_GETREGS, tid, 0, &regs);
 
   if (ret < 0)
-    perror_with_name (_("Unable to fetch general registers."));
+    perror_with_name (_("Unable to fetch general registers"));
 
   aarch32_gp_regcache_collect (regcache, (uint32_t *) regs, arm_apcs_32);
 
@@ -269,7 +269,7 @@ store_regs (const struct regcache *regcache)
     ret = ptrace (PTRACE_SETREGS, tid, 0, &regs);
 
   if (ret < 0)
-    perror_with_name (_("Unable to store general registers."));
+    perror_with_name (_("Unable to store general registers"));
 }
 
 /* Fetch all WMMX registers of the process and store into
@@ -286,7 +286,7 @@ fetch_wmmx_regs (struct regcache *regcache)
 
   ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
   if (ret < 0)
-    perror_with_name (_("Unable to fetch WMMX registers."));
+    perror_with_name (_("Unable to fetch WMMX registers"));
 
   for (regno = 0; regno < 16; regno++)
     regcache->raw_supply (regno + ARM_WR0_REGNUM, &regbuf[regno * 8]);
@@ -311,7 +311,7 @@ store_wmmx_regs (const struct regcache *regcache)
 
   ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
   if (ret < 0)
-    perror_with_name (_("Unable to fetch WMMX registers."));
+    perror_with_name (_("Unable to fetch WMMX registers"));
 
   for (regno = 0; regno < 16; regno++)
     if (REG_VALID == regcache->get_register_status (regno + ARM_WR0_REGNUM))
@@ -330,7 +330,7 @@ store_wmmx_regs (const struct regcache *regcache)
   ret = ptrace (PTRACE_SETWMMXREGS, tid, 0, regbuf);
 
   if (ret < 0)
-    perror_with_name (_("Unable to store WMMX registers."));
+    perror_with_name (_("Unable to store WMMX registers"));
 }
 
 static void
@@ -356,7 +356,7 @@ fetch_vfp_regs (struct regcache *regcache)
     ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
 
   if (ret < 0)
-    perror_with_name (_("Unable to fetch VFP registers."));
+    perror_with_name (_("Unable to fetch VFP registers"));
 
   aarch32_vfp_regcache_supply (regcache, regbuf,
 			       tdep->vfp_register_count);
@@ -385,7 +385,7 @@ store_vfp_regs (const struct regcache *regcache)
     ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
 
   if (ret < 0)
-    perror_with_name (_("Unable to fetch VFP registers (for update)."));
+    perror_with_name (_("Unable to fetch VFP registers (for update)"));
 
   aarch32_vfp_regcache_collect (regcache, regbuf,
 				tdep->vfp_register_count);
@@ -402,7 +402,7 @@ store_vfp_regs (const struct regcache *regcache)
     ret = ptrace (PTRACE_SETVFPREGS, tid, 0, regbuf);
 
   if (ret < 0)
-    perror_with_name (_("Unable to store VFP registers."));
+    perror_with_name (_("Unable to store VFP registers"));
 }
 
 /* Fetch registers from the child process.  Fetch all registers if
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 281b034b115..32b289f3bbc 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -94,7 +94,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
   gdb::unique_xmalloc_ptr<struct kinfo_vmentry>
     vmentl (kinfo_getvmmap (pid, &nitems));
   if (vmentl == NULL)
-    perror_with_name (_("Couldn't fetch VM map entries."));
+    perror_with_name (_("Couldn't fetch VM map entries"));
 
   for (i = 0, kve = vmentl.get (); i < nitems; i++, kve++)
     {
diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c
index 2ccd0e014c2..c45df391afc 100644
--- a/gdb/netbsd-nat.c
+++ b/gdb/netbsd-nat.c
@@ -221,7 +221,7 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
   gdb::unique_xmalloc_ptr<struct kinfo_vmentry[]> vmentl
     = nbsd_kinfo_get_vmmap (pid, &nitems);
   if (vmentl == NULL)
-    perror_with_name (_("Couldn't fetch VM map entries."));
+    perror_with_name (_("Couldn't fetch VM map entries"));
 
   for (size_t i = 0; i < nitems; i++)
     {
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 588dd7df9c0..f959bb0c1ad 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1138,7 +1138,7 @@ fetch_all_gp_regs (struct regcache *regcache, int tid)
 	  have_ptrace_getsetregs = 0;
 	  return 0;
 	}
-      perror_with_name (_("Couldn't get general-purpose registers."));
+      perror_with_name (_("Couldn't get general-purpose registers"));
     }
 
   supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
@@ -1190,7 +1190,7 @@ fetch_all_fp_regs (struct regcache *regcache, int tid)
 	  have_ptrace_getsetfpregs = 0;
 	  return 0;
 	}
-      perror_with_name (_("Couldn't get floating-point registers."));
+      perror_with_name (_("Couldn't get floating-point registers"));
     }
 
   supply_fpregset (regcache, (const gdb_fpregset_t *) &fpregs);
@@ -1690,7 +1690,7 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
 	  have_ptrace_getsetregs = 0;
 	  return 0;
 	}
-      perror_with_name (_("Couldn't get general-purpose registers."));
+      perror_with_name (_("Couldn't get general-purpose registers"));
     }
 
   fill_gregset (regcache, &gregset, regno);
@@ -1702,7 +1702,7 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
 	  have_ptrace_getsetregs = 0;
 	  return 0;
 	}
-      perror_with_name (_("Couldn't set general-purpose registers."));
+      perror_with_name (_("Couldn't set general-purpose registers"));
     }
 
   return 1;
@@ -1752,7 +1752,7 @@ store_all_fp_regs (const struct regcache *regcache, int tid, int regno)
 	  have_ptrace_getsetfpregs = 0;
 	  return 0;
 	}
-      perror_with_name (_("Couldn't get floating-point registers."));
+      perror_with_name (_("Couldn't get floating-point registers"));
     }
 
   fill_fpregset (regcache, &fpregs, regno);
@@ -1764,7 +1764,7 @@ store_all_fp_regs (const struct regcache *regcache, int tid, int regno)
 	  have_ptrace_getsetfpregs = 0;
 	  return 0;
 	}
-      perror_with_name (_("Couldn't set floating-point registers."));
+      perror_with_name (_("Couldn't set floating-point registers"));
     }
 
   return 1;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index d290505d8c3..ffb4d180290 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -2704,7 +2704,7 @@ procfs_set_exec_trap (void)
 
   pi = create_procinfo (getpid (), 0);
   if (pi == NULL)
-    perror_with_name (_("procfs: create_procinfo failed in child."));
+    perror_with_name (_("procfs: create_procinfo failed in child"));
 
   if (open_procinfo_files (pi, FD_CTL) == 0)
     {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 19:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 19:04 [binutils-gdb] gdb: remove trailing '.' from perror_with_name calls Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).