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 v4 4/4][RFC] Moderninse aix-thread.c by combining ptrace wrappers
Date: Mon,  5 Oct 2026 19:05:08 +0530	[thread overview]
Message-ID: <20261005133509.32304-2-akamath996@gmail.com> (raw)

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

With AIX 7.2 as the minimum supported AIX release, a number of legacy
compatibility paths in aix-thread.c are no longer needed. This patch
modernizes the file by:

1: Combining the ptrace checking and wrapper logic into a single helper,
2: Removing obsolete compatibility code for older AIX releases (ptrace/ptracex/PTHDB_VERSION_3)
3: Using ptrace64 consistently for thread and register operations in 64-bit GDB.
4: Made sure no manual declration of getthrds ().

The resulting code is smaller and easier to follow while preserving existing behaviour.

Then for testing:
I ran the GDB thread testsuite before and after this change

Before this patch:

32 bit
--------------------------------------------------
                === gdb Summary ===

# of unexpected core files      1
# of expected passes            2138
# of unexpected failures        747
# of expected failures          4
# of known failures             20
# of unresolved testcases       1
# of untested testcases         11
# of unsupported tests          83
# of paths in test names        3

64 bit 

=== gdb Summary ===

# of unexpected core files      1
# of expected passes            2125
# of unexpected failures        749
# of expected failures          4
# of known failures             20
# of unresolved testcases       1
# of untested testcases         10
# of unsupported tests          84
# of paths in test names        3

After this patch:

64 bit 

=== gdb Summary ===

# of unexpected core files      1
# of expected passes            2115
# of unexpected failures        732
# of expected failures          4
# of known failures             20
# of unresolved testcases       2
# of untested testcases         13
# of unsupported tests          83
# of paths in test names        3
# of duplicate test names       1
/current_gdb/binutils-gdb/gdb/gdb version  19.0.50.20261001-git -nw -nx -q -iex “set height 0” -iex “set width 0" -data-directory /current_gdb/binutils-gdb/gdb/data-directory -iex “set interactive-mode on”


The overall results remain consistent with the current state of AIX thread support.

Most failures are unrelated to this patch and fall into a few known categories:
Approx 300 failures are because we do not have scheduler-locking on AIX.
Approx 150 failures are because we do not have async mode on AIX.
TLS we have 30 failures. That is work in progress.
I also see failures due to exec after thread not handled.
Then there are also minor issues like test tries to link with a text_segment option not there on AIX.

So these are the reasons for the same.

While working on this cleanup, I also noticed duplication between aix-thread.c and rs6000-aix-nat.c. 
In particular, the AltiVec (__vmx_context_t), VSX (__vsx_context_t), and register supply/collect logic appear to
be good candidates for consolidation into shared AIX target helpers. That refactoring would be a follow-up series;
for now this patch focuses solely on cleanup and removal of obsolete compatibility code.

---
 gdb/aix-thread.c | 258 +++++++++++++++--------------------------------
 1 file changed, 82 insertions(+), 176 deletions(-)

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 95aa18985ed..4826e33265c 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -262,13 +262,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;
 
@@ -306,22 +309,6 @@ ptrace_check (int req, int id, int ret)
   return 0;  /* Not reached.  */
 }
 
-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));
-}
-
-
-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.  */
 
@@ -416,14 +403,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));
 	}
@@ -432,7 +418,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));
     }
@@ -442,14 +428,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));
 	}
@@ -459,36 +444,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;
 }
@@ -519,51 +486,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);
-    }
+    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;
 }
 
@@ -1052,12 +991,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);
     }
 }
 
@@ -1332,14 +1267,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]);
@@ -1351,14 +1285,11 @@ 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++)
-	regcache->raw_supply (tdep->ppc_vr0_regnum + i, &(vmx.__vr[i]));
+	 regcache->raw_supply (tdep->ppc_vr0_regnum + i, &(vmx.__vr[i]));
       regcache->raw_supply (tdep->ppc_vrsave_regnum, &(vmx.__vrsave));
       regcache->raw_supply (tdep->ppc_vrsave_regnum - 1, &(vmx.__vscr));
     }
@@ -1368,14 +1299,12 @@ 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++)
-	regcache->raw_supply (tdep->ppc_vsr0_upper_regnum + i, &(vsx.__vsr_dw1[i]));
+	 regcache->raw_supply (tdep->ppc_vsr0_upper_regnum + i,
+			       &(vsx.__vsr_dw1[i]));
     }
 
   /* Floating-point registers.  */
@@ -1385,7 +1314,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);
     }
@@ -1396,8 +1325,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,
@@ -1405,7 +1333,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,
@@ -1761,16 +1689,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);
 	}
     }
 
@@ -1782,9 +1710,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.  */
@@ -1794,29 +1722,19 @@ 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);
+	  ptrace64aix (PTT_READ_SPRS, tid, (long long) &sprs32, 0, NULL);
 
 	  fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr,
 		       &tmp_ctr, &tmp_xer, &tmp_fpscr);
@@ -1834,59 +1752,47 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
 			       (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);
 	}
     }
 
-    /* Vector registers.  */
-    if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1
-	&& (regno == -1 || (regno >= tdep->ppc_vr0_regnum
-	&& regno <= tdep->ppc_vrsave_regnum)))
-      {
-	__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);
-	    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);
-		if (ret < 0)
-		  perror_with_name (_("Unable to store AltiVec register after read"));
-	      }
-	  }
-      }
+  /* Vector registers.  */
+  if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1
+      && (regno == -1 || (regno >= tdep->ppc_vr0_regnum
+			  && regno <= tdep->ppc_vrsave_regnum)))
+    {
+      __vmx_context_t vmx;
+      if (__power_vmx ())
+	{
+	  ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0);
+	  if (ret > 0)
+	    {
+	      fill_altivec (regcache, &vmx);
+	      ret = ptrace64aix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0);
+	      if (ret < 0)
+		perror_with_name (_("Unable to store AltiVec register after read"));
+	    }
+	}
+    }
 
-    /* VSX registers.  */
-    if (tdep->ppc_vsr0_upper_regnum != -1 && (regno == -1
-	|| (regno >= tdep->ppc_vsr0_upper_regnum
-	&& regno < tdep->ppc_vsr0_upper_regnum + ppc_num_vshrs)))
-      {
-	__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);
-	    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);
-		if (ret < 0)
-		  perror_with_name (_("Unable to store VSX register after read"));
-	      }
-	  }
-      }
+  /* VSX registers.  */
+  if (tdep->ppc_vsr0_upper_regnum != -1 && (regno == -1
+		|| (regno >= tdep->ppc_vsr0_upper_regnum
+		&& regno < tdep->ppc_vsr0_upper_regnum + ppc_num_vshrs)))
+    {
+      __vsx_context_t vsx;
+      if (__power_vsx ())
+	{
+	  ret = ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0);
+	  if (ret > 0)
+	    {
+	       fill_vsx (regcache, &vsx);
+	       ret = ptrace64aix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0);
+	       if (ret < 0)
+		 perror_with_name (_("Unable to store VSX register after read"));
+	    }
+	}
+    }
 }
 
 /* Store gdb's current view of the register set into the
-- 
2.51.2


                 reply	other threads:[~2026-10-05 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261005133509.32304-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