Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aditya Vidyadhar Kamath <akamath996@gmail.com>
To: ulrich.weigand@de.ibm.com, simon.marchi@polymtl.ca, tom@tromey.com
Cc: gdb-patches@sourceware.org, Aditya.Kamath1@ibm.com,
	sangamesh.swamy@in.ibm.com
Subject: [PATCH v2] Remove stale pre-AIX-7.2 compatibility guards
Date: Fri, 18 Sep 2026 16:06:51 +0530	[thread overview]
Message-ID: <20260918103650.36233-2-akamath996@gmail.com> (raw)

From: Aditya Kamath <Aditya.Kamath1@ibm.com>

GDB now requires AIX 7.2 as the minimum supported version and will
support AIX 7.2 TL5, AIX 7.3 and upcoming AIX releases.  Remove
dead compatibility code that existed only for older releases.

Remove the HAVE_DECL_GETTHRDS configure check since aix-thread.c was the last
user of that macro.  Merge ptrace64aix and ptrace32 into a single
ptrace_aix function since they became identical after this
cleanup, and collapse all call sites that branched on arch64 just to
pick between the two.  Also clean up rs6000-aix-nat.c by removing the
ARCH3264 and HAVE_PTRACE64 guards along with the ptracex fallback in
rs6000_ptrace32 and rs6000_ptrace64, which are now simple wrappers
around ptrace64.

Also as per https://www.ibm.com/docs/en/aix/7.2.0?topic=p-ptrace-ptracex-ptrace64-subroutine
ptrace64 will also support 32-bit debugees.
---
 gdb/aix-thread.c     | 216 +++++++++++--------------------------------
 gdb/config.in        |   4 -
 gdb/configure        |  16 ----
 gdb/configure.ac     |   5 -
 gdb/rs6000-aix-nat.c |  47 +---------
 5 files changed, 61 insertions(+), 227 deletions(-)

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 5ac71d22237..b4b9efca5d4 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1,4 +1,4 @@
-/* Low level interface for debugging AIX 4.3+ pthreads.
+/* Low level interface for debugging AIX 7.2+ pthreads.
 
    Copyright (C) 1999-2026 Free Software Foundation, Inc.
    Written by Nick Duffek <nsd@redhat.com>.
@@ -19,7 +19,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-/* This module uses the libpthdebug.a library provided by AIX 4.3+ for
+/* This module uses the libpthdebug.a library provided by AIX 7.2+ for
    debugging pthread applications.
 
    Some name prefix conventions:
@@ -56,18 +56,9 @@
 #include <sys/pthdebug.h>
 #include <unordered_set>
 
-#if !HAVE_DECL_GETTHRDS
-extern int getthrds (pid_t, struct thrdsinfo64 *, int, tid_t *, int);
-#endif
-
 /* Whether to emit debugging output.  */
 static bool debug_aix_thread;
 
-/* In AIX 5.1, functions use pthdb_tid_t instead of tid_t.  */
-#ifndef PTHDB_VERSION_3
-#define pthdb_tid_t	tid_t
-#endif
-
 /* Success and failure values returned by pthdb callbacks.  */
 
 #define PDC_SUCCESS	PTHDB_SUCCESS
@@ -315,40 +306,13 @@ ptrace_check (int req, int id, int ret)
   return 0;  /* Not reached.  */
 }
 
-/* Call ptracex (REQ, ID, ADDR, DATA, BUF) or
-   ptrace64 (REQ, ID, ADDR, DATA, BUF) if HAVE_PTRACE64.
-   Return success.  */
-
-#ifdef HAVE_PTRACE64
-# define ptracex(request, pid, addr, data, buf) \
-	 ptrace64 (request, pid, addr, data, buf)
-#endif
+/* Call ptrace64 (REQ, ID, ADDR, DATA, BUF).  Return success.  */
 
 static int
-ptrace64aix (int req, int id, long long addr, int data, int *buf)
+ptraceaix (int req, int id, long long addr, int data, int *buf)
 {
   errno = 0;
-  return ptrace_check (req, id, ptracex (req, id, addr, data, buf));
-}
-
-/* Call ptrace (REQ, ID, ADDR, DATA, BUF) or
-   ptrace64 (REQ, ID, ADDR, DATA, BUF) if HAVE_PTRACE64.
-   Return success.  */
-
-#ifdef HAVE_PTRACE64
-# define ptrace(request, pid, addr, data, buf) \
-	 ptrace64 (request, pid, addr, data, buf)
-# define addr_ptr long long
-#else
-# define addr_ptr int *
-#endif
-
-static int
-ptrace32 (int req, int id, addr_ptr addr, int data, int *buf)
-{
-  errno = 0;
-  return ptrace_check (req, id,
-		       ptrace (req, id, addr, data, buf));
+  return ptrace_check (req, id, ptrace64 (req, id, addr, data, buf));
 }
 
 /* If *PIDP is a composite process/thread id, convert it to a
@@ -444,14 +408,14 @@ pdc_read_regs (pthdb_user_t user_current_pid,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_GPRS, tid,
+	  if (!ptraceaix (PTT_READ_GPRS, tid,
 			    (unsigned long) gprs64, 0, NULL))
 	    memset (gprs64, 0, sizeof (gprs64));
 	  memcpy (context->gpr, gprs64, sizeof(gprs64));
 	}
       else
 	{
-	  if (!ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
+	  if (!ptraceaix (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
 	    memset (gprs32, 0, sizeof (gprs32));
 	  memcpy (context->gpr, gprs32, sizeof(gprs32));
 	}
@@ -460,7 +424,7 @@ pdc_read_regs (pthdb_user_t user_current_pid,
   /* Floating-point registers.  */
   if (flags & PTHDB_FLAG_FPRS)
     {
-      if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
+      if (!ptraceaix (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
 	memset (fprs, 0, sizeof (fprs));
       memcpy (context->fpr, fprs, sizeof(fprs));
     }
@@ -470,14 +434,14 @@ pdc_read_regs (pthdb_user_t user_current_pid,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_SPRS, tid,
+	  if (!ptraceaix (PTT_READ_SPRS, tid,
 			    (unsigned long) &sprs64, 0, NULL))
 	    memset (&sprs64, 0, sizeof (sprs64));
 	  memcpy (&context->msr, &sprs64, sizeof(sprs64));
 	}
       else
 	{
-	  if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
+	  if (!ptraceaix (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
 	    memset (&sprs32, 0, sizeof (sprs32));
 	  memcpy (&context->msr, &sprs32, sizeof(sprs32));
 	}
@@ -487,36 +451,18 @@ pdc_read_regs (pthdb_user_t user_current_pid,
   __vmx_context_t vmx;
   if (__power_vmx() && (flags & PTHDB_FLAG_REGS))
     {
-      if (data->arch64)
-	{
-	  if (!ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0))
-	    memset (&vmx, 0, sizeof (vmx));
-	  memcpy (&context->vmx, &vmx, sizeof(__vmx_context_t));
-	}
-      else
-	{
-	  if (!ptrace32 (PTT_READ_VEC, tid, (long long) &vmx, 0, 0))
-	    memset (&vmx, 0, sizeof (vmx));
-	   memcpy (&context->vmx, &vmx, sizeof(__vmx_context_t));
-	}
+      if (!ptraceaix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0))
+	memset (&vmx, 0, sizeof (vmx));
+      memcpy (&context->vmx, &vmx, sizeof (__vmx_context_t));
     }
 
   /* vsx registers.  */
   __vsx_context_t vsx;
   if (__power_vsx() && (flags & PTHDB_FLAG_REGS))
     {
-      if (data->arch64)
-	{
-	  if (!ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0))
-	    memset (&vsx, 0, sizeof (vsx));
-	  memcpy (&context->vsx, &vsx, sizeof(__vsx_context_t));
-	}
-      else
-	{
-	  if (!ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0))
-	    memset (&vsx, 0, sizeof (vsx));
-	  memcpy (&context->vsx, &vsx, sizeof(__vsx_context_t));
-	}
+      if (!ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0))
+	memset (&vsx, 0, sizeof (vsx));
+      memcpy (&context->vsx, &vsx, sizeof (__vsx_context_t));
     }
   return 0;
 }
@@ -547,51 +493,23 @@ pdc_write_regs (pthdb_user_t user_current_pid,
 
   /* General-purpose registers.  */
   if (flags & PTHDB_FLAG_GPRS)
-    {
-      if (data->arch64)
-	ptrace64aix (PTT_WRITE_GPRS, tid,
-		     (unsigned long) context->gpr, 0, NULL);
-      else
-	ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) context->gpr, 0, NULL);
-    }
+    ptraceaix (PTT_WRITE_GPRS, tid, (long long) context->gpr, 0, NULL);
 
- /* Floating-point registers.  */
+  /* Floating-point registers.  */
   if (flags & PTHDB_FLAG_FPRS)
-    {
-      ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) context->fpr, 0, NULL);
-    }
+    ptraceaix (PTT_WRITE_FPRS, tid, (long long) context->fpr, 0, NULL);
 
   /* Special-purpose registers.  */
   if (flags & PTHDB_FLAG_SPRS)
-    {
-      if (data->arch64)
-	{
-	  ptrace64aix (PTT_WRITE_SPRS, tid,
-		       (unsigned long) &context->msr, 0, NULL);
-	}
-      else
-	{
-	  ptrace32 (PTT_WRITE_SPRS, tid, (uintptr_t) &context->msr, 0, NULL);
-	}
-    }
+    ptraceaix (PTT_WRITE_SPRS, tid, (long long) &context->msr, 0, NULL);
 
   /* vector registers.  */
   if (__power_vmx() && (flags & PTHDB_FLAG_REGS))
-    {
-      if (data->arch64)
-	ptrace64aix (PTT_WRITE_VEC, tid, (unsigned long) &context->vmx, 0, 0);
-      else
-	ptrace32 (PTT_WRITE_VEC, tid, (uintptr_t) &context->vmx, 0, 0);
-    }
+    ptraceaix (PTT_WRITE_VEC, tid, (long long) &context->vmx, 0, 0);
 
   /* vsx registers.  */
   if (__power_vsx() && (flags & PTHDB_FLAG_REGS))
-    {
-      if (data->arch64)
-	ptrace64aix (PTT_WRITE_VSX, tid, (unsigned long) &context->vsx, 0, 0);
-      else
-	ptrace32 (PTT_WRITE_VSX, tid, (uintptr_t) &context->vsx, 0, 0);
-    }
+    ptraceaix (PTT_WRITE_VSX, tid, (long long) &context->vsx, 0, 0);
   return 0;
 }
 
@@ -1078,12 +996,8 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
 	       ptid.lwp ());
       tid[1] = 0;
 
-      if (data->arch64)
-	ptrace64aix (PTT_CONTINUE, tid[0], (long long) 1,
-		     gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
-      else
-	ptrace32 (PTT_CONTINUE, tid[0], (addr_ptr) 1,
-		  gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
+      ptraceaix (PTT_CONTINUE, tid[0], (long long) 1,
+		 gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
     }
 }
 
@@ -1357,14 +1271,14 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_GPRS, tid,
+	  if (!ptraceaix (PTT_READ_GPRS, tid,
 			    (unsigned long) gprs64, 0, NULL))
 	    memset (gprs64, 0, sizeof (gprs64));
 	  supply_gprs64 (regcache, gprs64);
 	}
       else
 	{
-	  if (!ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
+	  if (!ptraceaix (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
 	    memset (gprs32, 0, sizeof (gprs32));
 	  for (i = 0; i < ppc_num_gprs; i++)
 	    supply_reg32 (regcache, tdep->ppc_gp0_regnum + i, gprs32[i]);
@@ -1377,9 +1291,9 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
       int ret = 0;
       __vmx_context_t vmx;
       if (data->arch64)
-	ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
+	ret = ptraceaix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
       else
-	ret = ptrace32 (PTT_READ_VEC, tid, (uintptr_t) &vmx, 0, 0);
+	ret = ptraceaix (PTT_READ_VEC, tid, (uintptr_t) &vmx, 0, 0);
       if (ret < 0)
 	memset(&vmx, 0, sizeof(__vmx_context_t));
       for (i = 0; i < ppc_num_vrs; i++)
@@ -1394,9 +1308,9 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
       __vsx_context_t vsx;
       int ret = 0;
       if (data->arch64)
-	ret = ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
+	ret = ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
       else
-	ret = ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
+	ret = ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
       if (ret < 0)
 	memset(&vsx, 0, sizeof(__vsx_context_t));
       for (i = 0; i < ppc_num_vshrs; i++)
@@ -1410,7 +1324,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
 	  || (regno >= tdep->ppc_fp0_regnum
 	      && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
     {
-      if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
+      if (!ptraceaix (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
 	memset (fprs, 0, sizeof (fprs));
       supply_fprs (regcache, fprs);
     }
@@ -1421,7 +1335,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_SPRS, tid,
+	  if (!ptraceaix (PTT_READ_SPRS, tid,
 			    (unsigned long) &sprs64, 0, NULL))
 	    memset (&sprs64, 0, sizeof (sprs64));
 	  supply_sprs64 (regcache, sprs64.pt_iar, sprs64.pt_msr,
@@ -1430,7 +1344,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
 	}
       else
 	{
-	  if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
+	  if (!ptraceaix (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
 	    memset (&sprs32, 0, sizeof (sprs32));
 	  supply_sprs32 (regcache, sprs32.pt_iar, sprs32.pt_msr, sprs32.pt_cr,
 			 sprs32.pt_lr, sprs32.pt_ctr, sprs32.pt_xer,
@@ -1783,16 +1697,16 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
       if (data->arch64)
 	{
 	  /* Pre-fetch: some regs may not be in the cache.  */
-	  ptrace64aix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0, NULL);
+	  ptraceaix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0, NULL);
 	  fill_gprs64 (regcache, gprs64);
-	  ptrace64aix (PTT_WRITE_GPRS, tid, (unsigned long) gprs64, 0, NULL);
+	  ptraceaix (PTT_WRITE_GPRS, tid, (unsigned long) gprs64, 0, NULL);
 	}
       else
 	{
 	  /* Pre-fetch: some regs may not be in the cache.  */
-	  ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL);
+	  ptraceaix (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL);
 	  fill_gprs32 (regcache, gprs32);
-	  ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) gprs32, 0, NULL);
+	  ptraceaix (PTT_WRITE_GPRS, tid, (uintptr_t) gprs32, 0, NULL);
 	}
     }
 
@@ -1804,9 +1718,9 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
 	      && regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
     {
       /* Pre-fetch: some regs may not be in the cache.  */
-      ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL);
+      ptraceaix (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL);
       fill_fprs (regcache, fprs);
-      ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) fprs, 0, NULL);
+      ptraceaix (PTT_WRITE_FPRS, tid, (uintptr_t) fprs, 0, NULL);
     }
 
   /* Special-purpose registers.  */
@@ -1816,47 +1730,29 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
       if (data->arch64)
 	{
 	  /* Pre-fetch: some registers won't be in the cache.  */
-	  ptrace64aix (PTT_READ_SPRS, tid,
-		       (unsigned long) &sprs64, 0, NULL);
+	  ptraceaix (PTT_READ_SPRS, tid,
+		     (unsigned long) &sprs64, 0, NULL);
 	  fill_sprs64 (regcache, &sprs64.pt_iar, &sprs64.pt_msr,
 		       &sprs64.pt_cr, &sprs64.pt_lr, &sprs64.pt_ctr,
 		       &sprs64.pt_xer, &sprs64.pt_fpscr);
-	  ptrace64aix (PTT_WRITE_SPRS, tid,
-		       (unsigned long) &sprs64, 0, NULL);
+	  ptraceaix (PTT_WRITE_SPRS, tid,
+		     (unsigned long) &sprs64, 0, NULL);
 	}
       else
 	{
-	  /* The contents of "struct ptspr" were declared as "unsigned
-	     long" up to AIX 5.2, but are "unsigned int" since 5.3.
-	     Use temporaries to work around this problem.  Also, add an
-	     assert here to make sure we fail if the system header files
-	     use "unsigned long", and the size of that type is not what
-	     the headers expect.  */
-	  uint32_t tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
-		   tmp_fpscr;
-
-	  gdb_assert (sizeof (sprs32.pt_iar) == 4);
-
 	  /* Pre-fetch: some registers won't be in the cache.  */
-	  ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL);
-
-	  fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr,
-		       &tmp_ctr, &tmp_xer, &tmp_fpscr);
+	  ptraceaix (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL);
 
-	  sprs32.pt_iar = tmp_iar;
-	  sprs32.pt_msr = tmp_msr;
-	  sprs32.pt_cr = tmp_cr;
-	  sprs32.pt_lr = tmp_lr;
-	  sprs32.pt_ctr = tmp_ctr;
-	  sprs32.pt_xer = tmp_xer;
-	  sprs32.pt_fpscr = tmp_fpscr;
+	  fill_sprs32 (regcache, &sprs32.pt_iar, &sprs32.pt_msr,
+		       &sprs32.pt_cr, &sprs32.pt_lr, &sprs32.pt_ctr,
+		       &sprs32.pt_xer, &sprs32.pt_fpscr);
 
 	  if (tdep->ppc_mq_regnum >= 0)
 	    if (REG_VALID == regcache->get_register_status
 			       (tdep->ppc_mq_regnum))
 	      regcache->raw_collect (tdep->ppc_mq_regnum, &sprs32.pt_mq);
 
-	  ptrace32 (PTT_WRITE_SPRS, tid, (uintptr_t) &sprs32, 0, NULL);
+	  ptraceaix (PTT_WRITE_SPRS, tid, (uintptr_t) &sprs32, 0, NULL);
 	}
     }
 
@@ -1869,16 +1765,16 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
 	if (__power_vmx())
 	  {
 	    if (data->arch64)
-	      ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
+	      ret = ptraceaix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
 	    else
-	      ret = ptrace32 (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
+	      ret = ptraceaix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
 	    if (ret > 0)
 	      {
 		fill_altivec(regcache, &vmx);
 		if (data->arch64)
-		  ret = ptrace64aix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
+		  ret = ptraceaix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
 		else
-		  ret = ptrace32 (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
+		  ret = ptraceaix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
 		if (ret < 0)
 		  perror_with_name (_("Unable to store AltiVec register after read"));
 	      }
@@ -1894,16 +1790,16 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
 	if (__power_vsx())
 	  {
 	    if (data->arch64)
-	      ret =  ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
+	      ret =  ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
 	    else
-	      ret =  ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
+	      ret =  ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
 	    if (ret > 0)
 	      {
 		fill_vsx (regcache, &vsx);
 		if (data->arch64)
-		  ret = ptrace64aix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0);
+		  ret = ptraceaix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0);
 		else
-		  ret = ptrace32 (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0);
+		  ret = ptraceaix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0);
 		if (ret < 0)
 		  perror_with_name (_("Unable to store VSX register after read"));
 	      }
diff --git a/gdb/config.in b/gdb/config.in
index 74745665d4d..b68cc29d587 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -147,10 +147,6 @@
 /* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
 #undef HAVE_DECL_FFS
 
-/* Define to 1 if you have the declaration of `getthrds', and to 0 if you
-   don't. */
-#undef HAVE_DECL_GETTHRDS
-
 /* Define to 1 if you have the declaration of `snprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_SNPRINTF
diff --git a/gdb/configure b/gdb/configure
index f411113ea66..0ed570e0571 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -31138,22 +31138,6 @@ $as_echo "$gdb_cv_have_aix_thread_debug" >&6; }
 	 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
 	 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
 	 LIBS="$LIBS -lpthdebug"
-
-	 # Older versions of AIX do not provide the declaration for
-	 # the getthrds function (it appears that it was introduced
-	 # with AIX 6.x).
-	 ac_fn_c_check_decl "$LINENO" "getthrds" "ac_cv_have_decl_getthrds" "#include <procinfo.h>
-"
-if test "x$ac_cv_have_decl_getthrds" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_GETTHRDS $ac_have_decl
-_ACEOF
-
       fi
       ;;
    esac
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 5d8e2d6628f..20d4bef68d4 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1914,11 +1914,6 @@ if test "${build}" = "${host}" -a "${host}" = "${target}" ; then
 	 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
 	 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
 	 LIBS="$LIBS -lpthdebug"
-
-	 # Older versions of AIX do not provide the declaration for
-	 # the getthrds function (it appears that it was introduced
-	 # with AIX 6.x).
-	 AC_CHECK_DECLS(getthrds, [], [], [[#include <procinfo.h>]])
       fi
       ;;
    esac
diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c
index 276df378824..ada24b19779 100644
--- a/gdb/rs6000-aix-nat.c
+++ b/gdb/rs6000-aix-nat.c
@@ -60,24 +60,9 @@
 /* Header files for alti-vec reg.  */
 #include <sys/context.h>
 
-/* On AIX4.3+, sys/ldr.h provides different versions of struct ld_info for
-   debugging 32-bit and 64-bit processes.  Define a typedef and macros for
-   accessing fields in the appropriate structures.  */
-
-/* In 32-bit compilation mode (which is the only mode from which ptrace()
-   works on 4.3), __ld_info32 is #defined as equivalent to ld_info.  */
-
-#if defined (__ld_info32) || defined (__ld_info64)
-# define ARCH3264
-#endif
-
 /* Return whether the current architecture is 64-bit.  */
 
-#ifndef ARCH3264
-# define ARCH64() 0
-#else
-# define ARCH64() (register_size (current_inferior ()->arch (), 0) == 8)
-#endif
+#define ARCH64() (register_size (current_inferior ()->arch (), 0) == 8)
 
 class rs6000_nat_target final : public inf_ptrace_target
 {
@@ -246,42 +231,20 @@ regmap (struct gdbarch *gdbarch, int regno, int *isfloat)
     return -1;
 }
 
-/* Call ptrace(REQ, ID, ADDR, DATA, BUF).  */
+/* Call ptrace64(REQ, ID, ADDR, DATA, BUF).  */
 
 static int
 rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf)
 {
-#ifdef HAVE_PTRACE64
-  int ret = ptrace64 (req, id, (uintptr_t) addr, data, buf);
-#else
-  int ret = ptrace (req, id, (int *)addr, data, buf);
-#endif
-#if 0
-  printf ("rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n",
-	  req, id, (unsigned int)addr, data, (unsigned int)buf, ret);
-#endif
-  return ret;
+  return ptrace64 (req, id, (uintptr_t) addr, data, buf);
 }
 
-/* Call ptracex(REQ, ID, ADDR, DATA, BUF).  */
+/* Call ptrace64(REQ, ID, ADDR, DATA, BUF).  */
 
 static int
 rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
 {
-#ifdef ARCH3264
-#  ifdef HAVE_PTRACE64
-  int ret = ptrace64 (req, id, addr, data, (PTRACE_TYPE_ARG5) buf);
-#  else
-  int ret = ptracex (req, id, addr, data, (PTRACE_TYPE_ARG5) buf);
-#  endif
-#else
-  int ret = 0;
-#endif
-#if 0
-  printf ("rs6000_ptrace64 (%d, %d, %s, %08x, 0x%x) = 0x%x\n",
-	  req, id, hex_string (addr), data, (unsigned int)buf, ret);
-#endif
-  return ret;
+  return ptrace64 (req, id, addr, data, (PTRACE_TYPE_ARG5) buf);
 }
 
 /* Store the vsx registers.  */
-- 
2.51.2


             reply	other threads:[~2026-09-18 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 10:36 Aditya Vidyadhar Kamath [this message]
2026-09-18 13:58 ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260918103650.36233-2-akamath996@gmail.com \
    --to=akamath996@gmail.com \
    --cc=Aditya.Kamath1@ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    --cc=simon.marchi@polymtl.ca \
    --cc=tom@tromey.com \
    --cc=ulrich.weigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox