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,
	Aditya Vidyadhar Kamath <aditya.kamath1@ibm.com>
Subject: [PATCH v5 3/4] Modernise aix-thread.c by combining ptrace wrappers.
Date: Tue, 13 Oct 2026 16:49:19 +0530	[thread overview]
Message-ID: <20261013111917.68981-6-akamath996@gmail.com> (raw)
In-Reply-To: <20261013111917.68981-2-akamath996@gmail.com>

From: Aditya Vidyadhar Kamath <aditya.kamath1@ibm.com>

AIX 7.2 is now the minimum supported release.  64-bit GDB on AIX
always calls ptrace64, so remove 32-bit and 64-bit ptrace
wrappers.

Merge ptrace_check () into ptrace64aix ().  ptrace64aix () now calls
ptrace64 itself and handles the error cases directly, removing a layer
of indirection.

The VMX and VSX paths in pdc_read_regs () and pdc_write_regs () no
longer need separate arch64 branches, since both paths were already
identical after the ptrace32 () stub was made to call ptrace64.

Remove the struct ptsprs workaround in store_regs_kernel_thread ().
The fields were "unsigned long" up to AIX 5.2 but are "unsigned int"
on all supported releases.  fill_sprs32 () now writes straight into
sprs32 without temporaries.  The related comment and gdb_assert are
removed.

This cleanup also shows duplicated code between aix-thread.c and
rs6000-aix-nat.c (AltiVec/VSX supply and collect routines, and
GPR/FPR/SPR handling).  Moving it into shared AIX helpers is left for
a follow-up patch.

Testing

I ran the gdb.threads testsuite before and after this patch, from the
gdb/testsuite directory, with 64-bit and 32-bit test programs.

64-bit:

  gmake check RUNTESTFLAGS='--directory=gdb.threads \
    CC_FOR_TARGET="/opt/freeware/bin/gcc" \
    CXX_FOR_TARGET="/opt/freeware/bin/g++" \
    CXXFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64" \
    CFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64"'

32-bit (same command without -maix64):

  gmake check RUNTESTFLAGS='--directory=gdb.threads \
    CC_FOR_TARGET="/opt/freeware/bin/gcc" \
    CXX_FOR_TARGET="/opt/freeware/bin/g++" \
    CXXFLAGS_FOR_TARGET="-O0 -w -g -gdwarf" \
    CFLAGS_FOR_TARGET="-O0 -w -g -gdwarf"'

                              64-bit            32-bit
                          before  after     before  after
  expected passes           2125   2154       2138   2179
  unexpected failures        749    677        747    665
  expected failures            4      4          4      4
  known failures              20     20         20     20
  unresolved testcases         1      1          1      1
  untested testcases          10     13         11     13
  unsupported tests           84     81         83     83

The number of unexpected failures decreases in both modes.  The
failures that remain are pre-existing.  I grouped the 677 64-bit
failures by test file:

  Group                                    Failures  Test files
  ---------------------------------------  --------  -------------------
  Fork, vfork and exec with other          276       foll-fork-other-
    threads                                          thread (135),
                                                     vfork-multi-
                                                     inferior (43),
                                                     next-fork-exec-
                                                     other-thread (20),
                                                     next-fork-other-
                                                     thread (18), and
                                                     others
  Step-over, break-while-running,          231       detach-step-over
    signal and async                                 (52), multiple-
                                                     step-overs (38),
                                                     break-while-
                                                     running (22),
                                                     step-over-lands-
                                                     on-breakpoint (21),
                                                     async (6), and
                                                     others
  Inferior calls from breakpoint           102       infcall-from-bp-
    conditions                                       cond-other-thread-
                                                     event (32),
                                                     infcall-from-bp-
                                                     cond-timeout (24),
                                                     and others
  Multi-inferior and detach                 40       process-dies-while-
                                                     detaching (24),
                                                     threadapply (16)
  Thread-local storage                      14       tls (10), tls-core,
                                                     tls-var, tls-nodebug,
                                                     tls-nodebug-pie
  Other                                     14       pthreads (9),
                                                     threadcrash (3),
                                                     and others
  ---------------------------------------  --------
  Total                                    677

The 32-bit run has the same shape: 665 failures in the same test files.

One thing is scheduler lock on AIX is yet to be implemented and TLS
is work in progress.  Async related test cases have failures on AIX.
Detach has issues while working with multiple threads.

None of the failure categories above are related to the changes in
this patch.
---
 gdb/aix-thread.c | 224 +++++++++++------------------------------------
 1 file changed, 50 insertions(+), 174 deletions(-)

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 7596bd844cf..795948424b2 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -295,13 +295,16 @@ pd_status2str (int status)
     }
 }
 
-/* A call to ptrace(REQ, ID, ...) just returned RET.  Check for
-   exceptional conditions and either return nonlocally or else return
-   1 for success and 0 for failure.  */
+/* Call ptrace64 (REQ, ID, ADDR, DATA, BUF).  Check for exceptional
+   conditions and either return nonlocally or else return 1 for success
+   and 0 for failure (or -1 where applicable).  */
 
 static int
-ptrace_check (int req, int id, int ret)
+ptrace64aix (int req, int id, long long addr, int data, int *buf)
 {
+  errno = 0;
+  int ret = ptrace64 (req, id, addr, data, buf);
+
   if (ret == 0 && !errno)
     return 1;
 
@@ -338,34 +341,6 @@ ptrace_check (int req, int id, int ret)
   return 0;  /* Not reached.  */
 }
 
-/* Call ptrace64 (REQ, ID, ADDR, DATA, BUF).  Return success.  */
-
-#define ptracex(request, pid, addr, data, buf) \
-     ptrace64 (request, pid, addr, data, buf)
-
-static int
-ptrace64aix (int req, int id, long long addr, int data, int *buf)
-{
-  errno = 0;
-  return ptrace_check (req, id, ptracex (req, id, addr, data, buf));
-}
-
-/* On all supported AIX releases ptrace64 is available and addr is
-   always a long long.  addr_ptr is used as the type of the addr
-   parameter to ptrace32().  */
-
-#define ptrace(request, pid, addr, data, buf) \
-     ptrace64 (request, pid, addr, data, buf)
-#define addr_ptr long long
-
-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));
-}
-
 /* If *PIDP is a composite process/thread id, convert it to a
    process id.  */
 
@@ -460,14 +435,13 @@ pdc_read_regs (pthdb_user_t user_current_pid,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_GPRS, tid,
-			    (unsigned long) gprs64, 0, NULL))
+	  if (!ptrace64aix (PTT_READ_GPRS, tid, (long 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 (!ptrace64aix (PTT_READ_GPRS, tid, (long long) gprs32, 0, NULL))
 	    memset (gprs32, 0, sizeof (gprs32));
 	  memcpy (context->gpr, gprs32, sizeof (gprs32));
 	}
@@ -476,7 +450,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 (!ptrace64aix (PTT_READ_FPRS, tid, (long long) fprs, 0, NULL))
 	memset (fprs, 0, sizeof (fprs));
       memcpy (context->fpr, fprs, sizeof (fprs));
     }
@@ -486,14 +460,13 @@ pdc_read_regs (pthdb_user_t user_current_pid,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_SPRS, tid,
-			    (unsigned long) &sprs64, 0, NULL))
+	  if (!ptrace64aix (PTT_READ_SPRS, tid, (long 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 (!ptrace64aix (PTT_READ_SPRS, tid, (long long) &sprs32, 0, NULL))
 	    memset (&sprs32, 0, sizeof (sprs32));
 	  memcpy (&context->msr, &sprs32, sizeof (sprs32));
 	}
@@ -503,36 +476,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 (!ptrace64aix (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 (!ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0))
+	memset (&vsx, 0, sizeof (vsx));
+      memcpy (&context->vsx, &vsx, sizeof (__vsx_context_t));
     }
   return 0;
 }
@@ -553,61 +508,29 @@ pdc_write_regs (pthdb_user_t user_current_pid,
      this is needed, I have implemented what I think it should do,
      however this code is untested.  */
 
-  struct aix_thread_variables *data;
-
-  data = get_thread_data_helper_for_pid (user_current_pid);
-
   if (debug_aix_thread)
     gdb_printf (gdb_stdlog, "pdc_write_regs tid=%d flags=%s\n",
 		(int) tid, hex_string (flags));
 
   /* 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);
-    }
+    ptrace64aix (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);
-    }
+    ptrace64aix (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);
-	}
-    }
+    ptrace64aix (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);
-    }
+    ptrace64aix (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);
-    }
+    ptrace64aix (PTT_WRITE_VSX, tid, (long long) &context->vsx, 0, 0);
   return 0;
 }
 
@@ -1070,9 +993,6 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
 {
   struct thread_info *thread;
   pthdb_tid_t tid[2];
-  struct aix_thread_variables *data;
-
-  data = get_thread_data_helper_for_ptid (ptid);
 
   if (ptid.tid () == 0)
     {
@@ -1096,12 +1016,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);
+      ptrace64aix (PTT_CONTINUE, tid[0], (long long) 1,
+		   gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
     }
 }
 
@@ -1375,14 +1291,13 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_GPRS, tid,
-			    (unsigned long) gprs64, 0, NULL))
+	  if (!ptrace64aix (PTT_READ_GPRS, tid, (long 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 (!ptrace64aix (PTT_READ_GPRS, tid, (long long) 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]);
@@ -1394,10 +1309,7 @@ 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);
-      else
-	ret = ptrace32 (PTT_READ_VEC, tid, (uintptr_t) &vmx, 0, 0);
+      ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
       if (ret < 0)
 	memset (&vmx, 0, sizeof (__vmx_context_t));
       for (i = 0; i < ppc_num_vrs; i++)
@@ -1411,10 +1323,7 @@ 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);
-      else
-	ret = ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
+      ret = ptrace64aix (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++)
@@ -1428,7 +1337,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 (!ptrace64aix (PTT_READ_FPRS, tid, (long long) fprs, 0, NULL))
 	memset (fprs, 0, sizeof (fprs));
       supply_fprs (regcache, fprs);
     }
@@ -1439,8 +1348,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
     {
       if (data->arch64)
 	{
-	  if (!ptrace64aix (PTT_READ_SPRS, tid,
-			    (unsigned long) &sprs64, 0, NULL))
+	  if (!ptrace64aix (PTT_READ_SPRS, tid, (long long) &sprs64, 0, NULL))
 	    memset (&sprs64, 0, sizeof (sprs64));
 	  supply_sprs64 (regcache, sprs64.pt_iar, sprs64.pt_msr,
 			 sprs64.pt_cr, sprs64.pt_lr, sprs64.pt_ctr,
@@ -1448,7 +1356,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
 	}
       else
 	{
-	  if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
+	  if (!ptrace64aix (PTT_READ_SPRS, tid, (long long) &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,
@@ -1803,16 +1711,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);
+	  ptrace64aix (PTT_READ_GPRS, tid, (long long) gprs64, 0, NULL);
 	  fill_gprs64 (regcache, gprs64);
-	  ptrace64aix (PTT_WRITE_GPRS, tid, (unsigned long) gprs64, 0, NULL);
+	  ptrace64aix (PTT_WRITE_GPRS, tid, (long 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);
+	  ptrace64aix (PTT_READ_GPRS, tid, (long long) gprs32, 0, NULL);
 	  fill_gprs32 (regcache, gprs32);
-	  ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) gprs32, 0, NULL);
+	  ptrace64aix (PTT_WRITE_GPRS, tid, (long long) gprs32, 0, NULL);
 	}
     }
 
@@ -1824,9 +1732,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);
+      ptrace64aix (PTT_READ_FPRS, tid, (long long) fprs, 0, NULL);
       fill_fprs (regcache, fprs);
-      ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) fprs, 0, NULL);
+      ptrace64aix (PTT_WRITE_FPRS, tid, (long long) fprs, 0, NULL);
     }
 
   /* Special-purpose registers.  */
@@ -1836,47 +1744,27 @@ 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);
+	  ptrace64aix (PTT_READ_SPRS, tid, (long 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);
+	  ptrace64aix (PTT_WRITE_SPRS, tid, (long 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);
+	  ptrace64aix (PTT_READ_SPRS, tid, (long long) &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);
+	  ptrace64aix (PTT_WRITE_SPRS, tid, (long long) &sprs32, 0, NULL);
 	}
     }
 
@@ -1889,17 +1777,11 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
       __vmx_context_t vmx;
       if (__power_vmx ())
 	{
-	  if (data->arch64)
-	    ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
-	  else
-	    ret = ptrace32 (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
+	  ret = ptrace64aix (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);
-	      else
-		ret = ptrace32 (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
+	      ret = ptrace64aix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
 	      if (ret < 0)
 		perror_with_name (_("Unable to store AltiVec register after read"));
 	    }
@@ -1915,17 +1797,11 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
       __vsx_context_t vsx;
       if (__power_vsx ())
 	{
-	  if (data->arch64)
-	    ret = ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
-	  else
-	    ret = ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
+	  ret = ptrace64aix (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);
-	      else
-		ret = ptrace32 (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0);
+	      ret = ptrace64aix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0);
 	      if (ret < 0)
 		perror_with_name (_("Unable to store VSX register after read"));
 	    }
-- 
2.51.2


  parent reply	other threads:[~2026-10-13 11:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 11:19 [PATCH v5 1/4] Remove stale legacy code from rs6000-aix-nat.c file Aditya Vidyadhar Kamath
2026-10-13 11:19 ` [PATCH v5 2/4] Remove obsolete getthrds and HAVE_PTRACE64 configure checks Aditya Vidyadhar Kamath
2026-10-13 11:19 ` Aditya Vidyadhar Kamath [this message]
2026-10-13 11:19 ` [PATCH v5 4/4] Fix 32-bit GPR and SPR register reads/writes in pthdb callbacks Aditya Vidyadhar Kamath
2026-10-13 12:00 ` [PATCH v5 1/4] Remove stale legacy code from rs6000-aix-nat.c file Ulrich Weigand
2026-10-13 12:55   ` Aditya Kamath
2026-10-13 13:31     ` Ulrich Weigand
2026-10-13 17:16       ` Simon Marchi
2026-10-14  9:15         ` Aditya Kamath
2026-10-14 10:44           ` Ulrich Weigand
2026-10-15 13:38             ` Aditya Kamath
2026-10-15 14:37               ` 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=20261013111917.68981-6-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