From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yVSUFyPRyGrb3h4AWB0awg (envelope-from ) for ; Fri, 09 Oct 2026 07:33:55 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hboHg+ih; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 59D961E051; Fri, 09 Oct 2026 07:33:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7583C1E04E for ; Fri, 09 Oct 2026 07:33:51 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACD2B4BA2E25 for ; Fri, 9 Oct 2026 11:33:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACD2B4BA2E25 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hboHg+ih Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id B6D1E4BA2E1C for ; Fri, 9 Oct 2026 11:32:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6D1E4BA2E1C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B6D1E4BA2E1C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791545558; cv=none; b=cjDgTRY9O3a7TkU5d2MlPF7omZuhsqsJ+V9Re+ihAcX0i2HkWao915JcK8Bws5/gi8DGq895aF1TIUqXAEe4o26qhM7MvULo+Ii3OTWFiY9cKv07h/XcA9J5lek/rflca3DB7fjQHT13WCcZB4pXtCP5JaI8+Sjiuc2HL7X0/cU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791545558; c=relaxed/simple; bh=M1wtA/lCf8VJ6JhFtEEbxAm+D9kfIyWVHVRda07Pf9g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ggHgbdyr7hx3W5Q6MYW9ILOwUTugCoJml7yYpFkif4iEUsinoNLMQrZJeaiuoOz7B6a/n/9vrnzG6LwgcWHjrtDYJK1XP3gRfu2OVet+qT4I1/LzwH80SASBQLFxGA2S7T7aolYSECndlufWgHvZ+3qNoJOoTK+IGbJJVxeXZZ8= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hboHg+ih DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6D1E4BA2E1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791545556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BsAmlJd4si02gUKe/yH26dDOZL+pNqyDjXUgMtdEb5U=; b=hboHg+ihgVsUZWMiHIyefospeab6G5QLeMnJgRyjEzFzATsA7X7nXzM5u5PWk3YPfgrK9U 8mt6w8KHzg2gtpdzwuxHhI9OSLcJX7jzUjTyUAM7oScPbIixiA2kdrGrVhaWMhccrStAYp jplcw79dzMyUO7uCCYnbtzOgq8Sg7Aw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-675-c_6EBZ6tNkulwDNxQ6dkWA-1; Fri, 9 Oct 2026 11:32:35 +0000 X-MC-Unique: c_6EBZ6tNkulwDNxQ6dkWA-1 X-Mimecast-MFC-AGG-ID: c_6EBZ6tNkulwDNxQ6dkWA_1791545554 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a020cf06c3so36582435e9.3 for ; Fri, 09 Oct 2026 04:32:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791545554; x=1792150354; h=content-transfer-encoding:content-type:mime-version:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pq1cSq4aq+5QK906tbmT8eF4/aVMrKmD5R19Nhve8WA=; b=cDll2AleWndWbPLuiTBYdVnwxO5/H+lx2L9AP+Nk62Y831dtikxceR4Hd+X2v/QCD7 sESwQDrXJTIdZPS91GMIr+b+sg5AAwFc73xutTbsDbfcGvR1sq8C/0rACDeKDT96I9y+ rAEb+kAjlhXIjraDK/MS2bPS9SwY2Eyz+OMZt8FzE/sS4ivUgtzw1WZ9GLI9dre9EivZ 2Xz5MfuqR/A5vnajcA4aATpOzWWmz8CxoqmlTgVsyJBfTuo6ZQMK2zvGZIi2XHtJmXJ0 gBvGnPHZnQCy4Qh/EhD7fUSOuL5xePJBGCf7dASnHctTTNoq3tR7ZLcY6W+bsPmFsdit qQ6A== X-Gm-Message-State: AFuF++m1r6DogD1C10U9k1EIKTb/3reA6Wi9nlk8BziZs43NIh7T6a/F Dz2s/4d+mbo0x6JOHynGzYTi6hPPzLvuBnLmrpvLW70Nq4XvL3U3Z+YaMh5j60x/hWw0OoBmbYn 7nVl0ppogAIqmLE28OqHMuShF+ebaeA11pXEVG0bXq1qBOoXRp4v39r7IrR8s9vQ= X-Gm-Gg: AYBFou3JhNnDkHtVrLEn4PII151IDNhKl81kqBFX5Dvb1edJsdj8rFub26ZUyUP9j1W pVfzQjJXlINaWauERzaXCwKs+ouw9NwD6b1KVXwMzAGMOORsEN4/Cvekzgz5C3z4cqypsRkiRYt YMfgrqyn7ir8U3/hmXxcE/EyfFte8qh0dDbgVCjkYofXGczG9C20ZXBAp6l4YtP1bmcSwsP50z6 spJ4dzN85iDotOrVKE3weZmLntR/xxM9t0f7gZQkhR1Z9CaSbZA0WEVURTt+spQll0iw1YHOVlm /jn2XJf02MV7G9mxpHkOHe8FPld3Hq6cFut/xgz5y4HhPIjHyrfVL+wJSKyGKZyPnakS X-Received: by 2002:a05:600c:1e0f:b0:4a0:1f51:ba2d with SMTP id 5b1f17b1804b1-4a18e4adcbamr27324755e9.22.1791545554205; Fri, 09 Oct 2026 04:32:34 -0700 (PDT) X-Received: by 2002:a05:600c:1e0f:b0:4a0:1f51:ba2d with SMTP id 5b1f17b1804b1-4a18e4adcbamr27323915e9.22.1791545553550; Fri, 09 Oct 2026 04:32:33 -0700 (PDT) Received: from localhost ([213.31.44.29]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48db9463230sm4171862f8f.1.2026.10.09.04.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2026 04:32:32 -0700 (PDT) From: Andrew Burgess To: Aditya Vidyadhar Kamath , 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 Subject: Re: [PATCH v4 3/4] Remove obsolete getthrds and HAVE_PTRACE64 configure checks. In-Reply-To: <20261005123854.31854-2-akamath996@gmail.com> References: <20261005123854.31854-2-akamath996@gmail.com> Date: Fri, 09 Oct 2026 12:32:31 +0100 Message-ID: <87jynrt8hc.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0CWUVd3dfbJRISrOgT7FHJRJoCXhfDW2uo-qHBuStPY_1791545554 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Aditya Vidyadhar Kamath writes: > From: Aditya Vidyadhar Kamath > > AIX 7.2 is the baseline supported AIX release. On all AIX supported rele= ases, > getthrds is there declared, and ptrace64 is in > declared and defined in libc.a. > > This patch removes the obsolete configure checks and cleans up. > > We are doing 2 things: > 1: Remove AC_CHECK_DECLS (getthrds) in configure.ac and config.in. > 2: Remove obsolete #ifdef HAVE_PTRACE64 in gdb/nat/gdb_ptrace.h > and use ptrace64 directly under PTRACE_TYPE_ARG5. I ran this through an AI/LLV review agent which raised the following 3 points: Issue 1: addr_ptr is undefined after the patch =20 The patch removes the #define addr_ptr macros (both the long long and int= * variants, lines 370=E2=80=93376), but addr_ptr is still used in two plac= es that are NOT modified by the patch: =20 gdb/aix-thread.c:379: ptrace32 (int req, int id, addr_ptr addr, int d= ata, int *buf) gdb/aix-thread.c:1120: ptrace32 (PTT_CONTINUE, tid[0], (addr_ptr) 1, = ...) =20 This will cause a build failure on AIX because addr_ptr is no longer defi= ned as either long long or int *. Issue 2: 5-argument ptrace macro removed, but ptrace32() still calls ptra= ce() with 5 arguments =20 The patch removes the 5-argument #define ptrace(request, pid, addr, data, buf) macro (lines 370=E2=80=93376). After this removal, the only pt= race macro in scope comes from gdb/nat/gdb_ptrace.h, which defines ptrace as a 4-argument macro: =20 #define ptrace(request, pid, addr, data) \ ptrace64 (request, pid, addr, data, 0) =20 However, ptrace32() at line 383 still calls ptrace (req, id, addr, data, buf) with 5 arguments. This will cause a preprocessor error (wrong number of macro arguments) or at least a compilation error. Issue 3: rs6000-aix-nat.c still uses HAVE_PTRACE64 =20 rs6000-aix-nat.c uses #ifdef HAVE_PTRACE64 at lines 254 and 272. The patch removes HAVE_PTRACE64 from gdb/config.in but does NOT remove the AC_CHECK_FUNCS for ptrace64 from gdbsupport/common.m4:74. This means: =20 If gdbsupport/common.m4 is not also updated, HAVE_PTRACE64 is still d= efined by the configure system, and the #undef removal from config.in is wr= ong (it will be regenerated with HAVE_PTRACE64 back). If the intent is to remove HAVE_PTRACE64 entirely, then rs6000-aix-na= t.c must also be updated, and gdbsupport/common.m4 must have ptrace64 remov= ed from the AC_CHECK_FUNCS list. =20 Either way, the current patch is inconsistent. For issue #3 I tried on an x86-64 GNU/Linux machine running autoheader in the binutils-gdb/gdb/ directory, and indeed HAVE_PTRACE64 as added back, so it does look like there is an inconsistency there. To validate issues #1 and #2 I'd need to try building on an AIX machine, which I assume is working for you, so maybe you can extend the commit message to talk about these issues, e.g. "Remove the addr_ptr define, GDB now picks up the definition from ....". And similarly for the ptrace macro: "GDB finds the 5 argument ptrace macro ....". Though issues #1 and #2 might be obvious for someone familiar with AIX, I do find the questions raised to be good ones, and even if the AI's diagnosis of these as bugs is wrong, I think it would be worth explaining these better in the commit message. > --- > gdb/aix-thread.c | 33 ++------------------------------- > gdb/config.in | 7 ------- > gdb/configure.ac | 5 ----- If you change configure.ac then you need to regenerate the configure file. This, combined with issue #3 above, makes me thing you are hand editing config.in, which is the wrong approach. As the comment at the top of that file says, config.in is auto-generated. You'll need automake 1.15.1 and autoconf 2.69, then in the gdb/ directory just run `autoreconf`. You probably should also do this in the gdbserver/ directory once issue #3 is addressed. > gdb/nat/gdb_ptrace.h | 13 ++++--------- > 4 files changed, 6 insertions(+), 52 deletions(-) > > diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c > index 65b9c5f7479..95aa18985ed 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. > =20 > Copyright (C) 1999-2026 Free Software Foundation, Inc. > Written by Nick Duffek . > @@ -19,7 +19,7 @@ > along with this program. If not, see .= */ > =20 > =20 > -/* 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. > =20 > Some name prefix conventions: > @@ -56,18 +56,9 @@ > #include > #include > =20 > -#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; > =20 > -/* In AIX 5.1, functions use pthdb_tid_t instead of tid_t. */ > -#ifndef PTHDB_VERSION_3 > -#define pthdb_tid_t=09tid_t > -#endif > - > /* Success and failure values returned by pthdb callbacks. */ > =20 > #define PDC_SUCCESS=09PTHDB_SUCCESS > @@ -315,15 +306,6 @@ ptrace_check (int req, int id, int ret) > return 0; /* Not reached. */ > } > =20 > -/* 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) \ > -=09 ptrace64 (request, pid, addr, data, buf) > -#endif > - > static int > ptrace64aix (int req, int id, long long addr, int data, int *buf) > { > @@ -331,17 +313,6 @@ ptrace64aix (int req, int id, long long addr, int da= ta, int *buf) > return ptrace_check (req, id, ptracex (req, id, addr, data, buf)); > } > =20 > -/* 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) \ > -=09 ptrace64 (request, pid, addr, data, buf) > -# define addr_ptr long long > -#else > -# define addr_ptr int * > -#endif > =20 > static int > ptrace32 (int req, int id, addr_ptr addr, int data, int *buf) The change above leaves 2 blank lines between the end of ptrace64aix and ptrace32, just a single blank line is the normal GDB style. > 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 > =20 > -/* Define to 1 if you have the declaration of `getthrds', and to 0 if yo= u > - don't. */ > -#undef HAVE_DECL_GETTHRDS > - > /* Define to 1 if you have the declaration of `snprintf', and to 0 if yo= u > don't. */ > #undef HAVE_DECL_SNPRINTF > @@ -397,9 +393,6 @@ > /* Define to 1 if you have the `pthread_sigmask' function. */ > #undef HAVE_PTHREAD_SIGMASK > =20 > -/* 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 > =20 > 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}" =3D "${host}" -a "${host}" =3D = "${target}" ; then > =09 CONFIG_SRCS=3D"${CONFIG_SRCS} aix-thread.c" > =09 CONFIG_OBS=3D"${CONFIG_OBS} aix-thread.o" > =09 LIBS=3D"$LIBS -lpthdebug" > - > -=09 # Older versions of AIX do not provide the declaration for > -=09 # the getthrds function (it appears that it was introduced > -=09 # with AIX 6.x). > -=09 AC_CHECK_DECLS(getthrds, [], [], [[#include ]]) > fi > ;; > esac > diff --git a/gdb/nat/gdb_ptrace.h b/gdb/nat/gdb_ptrace.h > index e0607164260..0d06cb8eb55 100644 > --- a/gdb/nat/gdb_ptrace.h > +++ b/gdb/nat/gdb_ptrace.h > @@ -127,15 +127,10 @@ > zero. */ > =20 > #ifdef PTRACE_TYPE_ARG5 > -# ifdef HAVE_PTRACE64 > -# define ptrace(request, pid, addr, data) \ > -=09 ptrace64 (request, pid, addr, data, 0) > -# undef PTRACE_TYPE_ARG3 > -# define PTRACE_TYPE_ARG3 long long > -# else > -# define ptrace(request, pid, addr, data) \ > -=09 ptrace (request, pid, addr, data, 0) > -# endif > +# define ptrace(request, pid, addr, data) \ > +=09 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) \ The comment block right about this talks about AIX and HP-UX, but support for GDB was removed some time ago now. As this is a cleanup commit, it would be nice to update this comment to remove the HP-UX references. Thanks, Andrew