* [PATCH 1/3] Remove stale pre-AIX-7.2 compatibility guards
@ 2026-09-16 11:45 Aditya Vidyadhar Kamath
2026-09-16 15:14 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Vidyadhar Kamath @ 2026-09-16 11:45 UTC (permalink / raw)
To: ulrich.weigand, simon.marchi, tom
Cc: gdb-patches, Aditya.Kamath1, sangamesh.swamy, Aditya Vidyadhar Kamath
From: Aditya Vidyadhar 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.
---
gdb/aix-thread.c | 67 ++++++++----------------------------------------
1 file changed, 11 insertions(+), 56 deletions(-)
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 5ac71d22237..aa14f8ff045 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,22 @@ 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)
{
errno = 0;
- return ptrace_check (req, id, ptracex (req, id, addr, data, buf));
+ return ptrace_check (req, id, ptrace64 (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
+/* Call ptrace64 (REQ, ID, ADDR, DATA, BUF). Return success. */
static int
-ptrace32 (int req, int id, addr_ptr addr, int data, int *buf)
+ptrace32 (int req, int id, long long 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
@@ -1082,7 +1055,7 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
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,
+ ptrace32 (PTT_CONTINUE, tid[0], (long long) 1,
gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
}
}
@@ -1826,30 +1799,12 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
}
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);
-
- 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
--
2.51.2
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/3] Remove stale pre-AIX-7.2 compatibility guards
2026-09-16 11:45 [PATCH 1/3] Remove stale pre-AIX-7.2 compatibility guards Aditya Vidyadhar Kamath
@ 2026-09-16 15:14 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2026-09-16 15:14 UTC (permalink / raw)
To: Aditya Vidyadhar Kamath
Cc: ulrich.weigand, simon.marchi, tom, gdb-patches, Aditya.Kamath1,
sangamesh.swamy
>>>>> Aditya Vidyadhar Kamath <akamath996@gmail.com> writes:
> From: Aditya Vidyadhar 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.
Hi. I saw this and had a few comments.
> -#if !HAVE_DECL_GETTHRDS
> -extern int getthrds (pid_t, struct thrdsinfo64 *, int, tid_t *, int);
> -#endif
I think this is the last use of HAVE_DECL_GETTHRDS, so the corresponding
configure check can be removed:
# 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>]])
> 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));
> + return ptrace_check (req, id, ptrace64 (req, id, addr, data, buf));
> static int
> -ptrace32 (int req, int id, addr_ptr addr, int data, int *buf)
> +ptrace32 (int req, int id, long long 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));
AFAICT ptrace64aix and ptrace32 are now identical. If this is
intentional then I think they could be combined. But then it looks like
they could also just be merged into ptrace_check as well.
If that's done then there are other spots that could be simplified, for
example:
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);
}
In gdb it's very unusual to use "long long" here but OTOH the rules are
more lax for native code. So I don't know if that's a problem.
thanks,
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-16 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 11:45 [PATCH 1/3] Remove stale pre-AIX-7.2 compatibility guards Aditya Vidyadhar Kamath
2026-09-16 15:14 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox