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 2/4] Remove obsolete getthrds and HAVE_PTRACE64 configure checks.
Date: Tue, 13 Oct 2026 16:49:17 +0530	[thread overview]
Message-ID: <20261013111917.68981-4-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 the baseline supported AIX release.  On all supported AIX
releases, getthrds is declared in <procinfo.h>, and ptrace64 is declared
in <sys/ptrace.h> and defined in libc.a.  The configure checks for both
were added for older AIX versions that are no longer supported.

Remove AC_CHECK_DECLS (getthrds) from gdb/configure.ac and the
corresponding entry from gdb/config.in.  Remove the conditional extern
declaration in gdb/aix-thread.c that the check guarded.

Remove ptrace64 from the AC_CHECK_FUNCS list in gdbsupport/common.m4
and drop HAVE_PTRACE64 from all three config.in files.  In
gdb/aix-thread.c, remove the #ifdef HAVE_PTRACE64 guards; the ptracex
and ptrace wrapper macros now call ptrace64 unconditionally, and addr_ptr
is defined unconditionally as long long.

In gdb/nat/gdb_ptrace.h, remove the #ifdef HAVE_PTRACE64 guard and
always define the ptrace macro to call ptrace64 under PTRACE_TYPE_ARG5.
Also remove the stale HP-UX reference from the comment above that block.

No other files in the tree reference HAVE_PTRACE64 or HAVE_DECL_GETTHRDS
outside generated build files.  The gdb/configure, gdbserver/configure
and gdbsupport/configure scripts are regenerated from the updated .ac and
.m4 sources using autoconf 2.69.
---
 gdb/aix-thread.c     | 41 ++++++++++++-----------------------------
 gdb/config.in        |  7 -------
 gdb/configure        | 17 -----------------
 gdb/configure.ac     |  5 -----
 gdb/nat/gdb_ptrace.h | 20 +++++++-------------
 gdbserver/config.in  |  3 ---
 gdbserver/configure  |  1 -
 gdbsupport/common.m4 |  1 -
 gdbsupport/config.in |  3 ---
 gdbsupport/configure |  1 -
 10 files changed, 19 insertions(+), 80 deletions(-)

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 869947b902f..7596bd844cf 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
@@ -347,14 +338,10 @@ 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.  */
+/* Call ptrace64 (REQ, ID, ADDR, DATA, BUF).  Return success.  */
 
-#ifdef HAVE_PTRACE64
-# define ptracex(request, pid, addr, data, buf) \
-	 ptrace64 (request, pid, addr, data, buf)
-#endif
+#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)
@@ -363,17 +350,13 @@ ptrace64aix (int req, int id, long long addr, int data, int *buf)
   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
+/* 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)
diff --git a/gdb/config.in b/gdb/config.in
index 0e5a6637c2b..dab7a3e7239 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
@@ -397,9 +393,6 @@
 /* Define to 1 if you have the `pthread_sigmask' function. */
 #undef HAVE_PTHREAD_SIGMASK
 
-/* Define to 1 if you have the `ptrace64' function. */
-#undef HAVE_PTRACE64
-
 /* Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request. */
 #undef HAVE_PTRACE_GETFPXREGS
 
diff --git a/gdb/configure b/gdb/configure
index 810e9ed7a37..e0ecf0ef8d6 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -20321,7 +20321,6 @@ fi
     pipe \
     pipe2 \
     poll \
-    ptrace64 \
     sbrk \
     setns \
     setpgid \
@@ -31139,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 0d88a280b16..684ce8e21fb 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1915,11 +1915,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/nat/gdb_ptrace.h b/gdb/nat/gdb_ptrace.h
index e0607164260..c8ae89cd19e 100644
--- a/gdb/nat/gdb_ptrace.h
+++ b/gdb/nat/gdb_ptrace.h
@@ -121,21 +121,15 @@
 # endif
 #endif
 
-/* Some systems, at least AIX and HP-UX have a ptrace with five
-   arguments.  Since we never use the fifth argument, define a ptrace
-   macro that calls the real ptrace with the last argument set to
-   zero.  */
+/* AIX has a ptrace with five arguments.  Since we never use the fifth
+   argument, define a ptrace macro that calls ptrace64 with the last
+   argument set to zero.  */
 
 #ifdef PTRACE_TYPE_ARG5
-# ifdef HAVE_PTRACE64
-#  define ptrace(request, pid, addr, data) \
-	  ptrace64 (request, pid, addr, data, 0)
-#  undef PTRACE_TYPE_ARG3
-#  define PTRACE_TYPE_ARG3 long long
-# else
-#  define ptrace(request, pid, addr, data) \
-	  ptrace (request, pid, addr, data, 0)
-# endif
+# define ptrace(request, pid, addr, data) \
+      ptrace64 (request, pid, addr, data, 0)
+# undef PTRACE_TYPE_ARG3
+# define PTRACE_TYPE_ARG3 long long
 #else
 /* Wrapper that avoids adding a pointless cast to all callers.  */
 # define ptrace(request, pid, addr, data) \
diff --git a/gdbserver/config.in b/gdbserver/config.in
index ead66ce7a57..4223c68d4af 100644
--- a/gdbserver/config.in
+++ b/gdbserver/config.in
@@ -245,9 +245,6 @@
 /* Define to 1 if you have the `pthread_sigmask' function. */
 #undef HAVE_PTHREAD_SIGMASK
 
-/* Define to 1 if you have the `ptrace64' function. */
-#undef HAVE_PTRACE64
-
 /* Define if the target supports PTRACE_GETFPXREGS for extended register
    access. */
 #undef HAVE_PTRACE_GETFPXREGS
diff --git a/gdbserver/configure b/gdbserver/configure
index dd749fcb55b..327f3fec124 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -8525,7 +8525,6 @@ fi
     pipe \
     pipe2 \
     poll \
-    ptrace64 \
     sbrk \
     setns \
     setpgid \
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
index 6bf15fff670..bce8f19e803 100644
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -71,7 +71,6 @@ AC_CHECK_HEADERS([ \
     pipe \
     pipe2 \
     poll \
-    ptrace64 \
     sbrk \
     setns \
     setpgid \
diff --git a/gdbsupport/config.in b/gdbsupport/config.in
index 2957ee0f030..321e1aaecf8 100644
--- a/gdbsupport/config.in
+++ b/gdbsupport/config.in
@@ -202,9 +202,6 @@
 /* Define to 1 if you have the `pthread_sigmask' function. */
 #undef HAVE_PTHREAD_SIGMASK
 
-/* Define to 1 if you have the `ptrace64' function. */
-#undef HAVE_PTRACE64
-
 /* Define to 1 if you have the <ptrace.h> header file. */
 #undef HAVE_PTRACE_H
 
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 0bc9ff1db9a..df932c4c5dd 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -11424,7 +11424,6 @@ fi
     pipe \
     pipe2 \
     poll \
-    ptrace64 \
     sbrk \
     setns \
     setpgid \
-- 
2.51.2


  reply	other threads:[~2026-10-13 11:20 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 ` Aditya Vidyadhar Kamath [this message]
2026-10-13 11:19 ` [PATCH v5 3/4] Modernise aix-thread.c by combining ptrace wrappers Aditya Vidyadhar Kamath
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-4-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