From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UQ5tINsJsmpY1zAAWB0awg (envelope-from ) for ; Tue, 22 Sep 2026 00:53:47 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=o0Nrdh/0; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 811431E033; Tue, 22 Sep 2026 00:53:47 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 EF0581E033 for ; Tue, 22 Sep 2026 00:53:45 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B49AA4BA9014 for ; Tue, 22 Sep 2026 04:53:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B49AA4BA9014 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=o0Nrdh/0 Received: from mail-pj2-x0f.google.com (mail-pj2-x0f.google.com [IPv6:2607:f8b0:4864:39::f]) by sourceware.org (Postfix) with ESMTPS id 5196D4BAE7C1 for ; Tue, 22 Sep 2026 04:53:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5196D4BAE7C1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5196D4BAE7C1 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:39::f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790052797; cv=none; b=nho4S4RGKPV99Kbqojpr177B4FO0Poy/rdcmdAfBqI4iuAV8cwRq3KoQwXvAriskcXwZ118PDbPGQux7esUXdTVx/iuCFOmHK34igpBZABRVDQ0CyrKomcJrpKdbUQcf/amHr96oQH6d5/dVqzBhc+SEXLOX7/6gz4vIjwcDMjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790052797; c=relaxed/simple; bh=uOMYzUX4b+FXhTEjMg2lzOhEMAHqPVibJCfzt/ZGYHA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Fg+Q6b0+sHDG3OHQ5HxGAzrx4d2QcsIQQLpqckOTlCFOx2SYnmL4clg/W4O9WIS2M4nwJioNWEw1CLngJQo1bU4VTWTypKNITUVWIoKctRcymFtrF3eC1mAyzsgnItEKmr3JZ2KvOfdTCAT93C4DEmVWJRqrathLB8o57Z1AksU= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=o0Nrdh/0 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5196D4BAE7C1 Received: by mail-pj2-x0f.google.com with SMTP id 98e67ed59e1d1-398b3b189e0so3225044a91.2 for ; Mon, 21 Sep 2026 21:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790052796; x=1790657596; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=+796+xZyQIW1K5qbG1qbLTyFcHXI6dRKHDOGf9NlDNQ=; b=o0Nrdh/0bQhGB/ly6t3y3+mb2GN2CqD9xdMReEFG1bPuoofp95Gx3bKO3A+4saghS+ V+Oyxtp9rZ2Y4kHsLw2HvE+PhZKwo+EryHZwY689NPIR58Qq5gXZP2b2kOJacoLGuAeb 7GqyRwYWY4R3bJ9t64cPEwQB4+Q2uK5GxCpD7Cl1yUEo5GH5caAQl29Ep6zMD5+Y7yXF ++sIuKoBN4VOHW+LpwV4kxZVgbsoj3IybxdX/kFb6d03bIJvVjZdxcbnsAnPIpE3xrAM c7pQuyqh9b8iDGe3Yc2yW8iZRGmBDJB6ieYymm5Qdm/d/Eex7uNXY98GXhKXCz+th4b0 XrKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790052796; x=1790657596; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+796+xZyQIW1K5qbG1qbLTyFcHXI6dRKHDOGf9NlDNQ=; b=26j2NXsoJe0F0LWH6kFlAqob93fC/AuH/xjBRu1e2fqUR6sJSxwjVJKPb+p+TFs8Gg 403yR6vQtUYmfRE7Eda6Puvll1swEohsy8Ig6nRaZO3ewlck0ITHE8q1k2CUT7kpb2dN CjD6TZG0rPTxz6fxvrMIP9hNZ9zxCihvU0gIcfQpYy2TsYiqfeMf5JFs6Y3zD3mZgWYk 32OZJOETEPIuQ+DvQk9Tnk2Lg1XVPvB0WMYfm9EKwNcbQTymEWTJ4szaUru/ZYnIdlqV sV5lgPsWGDsRV98JoKf2tG1HrvXeVAG8mcay6Wc8SSa57q1lFVtyw5MNNGL9/X9yfb4u bIMw== X-Gm-Message-State: AFuF++lcGWBRZVBcIYvzfGUUAz1+/9Dy/KiJL071jfX24wlJaxQyowv3 vY5r5RDQAElVG4TA+U5vnZuUj+odCrY8R5Fxokucb/GIFrh8lG3kFZRXLWC9ZPmt X-Gm-Gg: AYBFou1gy75aWT300Tdnq9tXfFNr8rhF3tHEpuVkG/Tz0jfZjBFZj52uAi7FH6im/D3 Fb7wLwgppA7cLjA85SRYA5TAUdNOjGm7yHZInvP9JCn1QDZ3KSRumm5PvH+dI0iGqg1PWTv17RM 3UAvsCHqqzsNvg2A91WM4swmk3m5SMNAtVpwhN6J4Mva9IF9Ny+B3+WcYVE6usLa8rpFFyK2f5j gjaAQpA/9VkHleVsK3xQcPxky3DQg1we5amhNIHViurrP+vstXdodPurGegS/1MEdXMpy1xaxcc b2uHu071s5Ja4DQ6DlhqjN/boIW8vInxY60JtJTRRge+3RZwe4wyfpwuXhM7gcQyRBiizcEp95J 2rL3YDCc0XLyYlRu+rPrAR9bNh5h59yVeOcJkaO3eYUVKrtuLzGg2PMLV+aUWV43XEqdCGHWwWE Jkg2h2NgO1WeVzcd8xhuTWKOYwAEroE6vZ14buNfChLWVwDnLj1Ir2vW5QkVKx3x5FyTCiAArx2 Ukes3NapU8+JgImXjsjF9hbkuo= X-Received: by 2002:a17:90b:4d12:b0:39e:6c69:34dc with SMTP id 98e67ed59e1d1-3a06b0c8bdbmr1183649a91.64.1790052795897; Mon, 21 Sep 2026 21:53:15 -0700 (PDT) Received: from localhost.localdomain ([122.171.20.203]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33e61270bfesm1708521eec.9.2026.09.21.21.53.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Sep 2026 21:53:15 -0700 (PDT) From: Aditya Vidyadhar Kamath 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 Subject: [PATCH v3] Remove stale pre-AIX-7.2 compatibility guards Date: Tue, 22 Sep 2026 10:22:31 +0530 Message-ID: <20260922045230.58748-2-akamath996@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Aditya Kamath 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. Remove the HAVE_DECL_GETTHRDS configure check since aix-thread.c was the last user of that macro. Merge ptrace64aix and ptrace32 into a single ptrace_aix function since they became identical after this cleanup, and collapse all call sites that branched on arch64 just to pick between the two. Also clean up rs6000-aix-nat.c by removing the ARCH3264 and HAVE_PTRACE64 guards along with the ptracex fallback in rs6000_ptrace32 and rs6000_ptrace64, which are now simple wrappers around ptrace64. Also as per https://www.ibm.com/docs/en/aix/7.2.0?topic=p-ptrace-ptracex-ptrace64-subroutine ptrace64 will also support 32-bit debugees. In store_regs_user_thread we use ppc_vsr0_upper_regnum when checking validity and collecting the VSX upper-doubleword registers. In store_regs_user_thread guard ctx.fpscr with ppc_fpscr_regnum instead of ppc_xer_regnum, and add the ppc_fpscr_regnum >= 0 check to match the 64-bit path. Use ppc_num_gprs instead of ppc_num_fprs in the GPR regno range check. --- gdb/aix-thread.c | 238 ++++++++++++++----------------------------- gdb/config.in | 4 - gdb/configure | 16 --- gdb/configure.ac | 5 - gdb/rs6000-aix-nat.c | 47 +-------- 5 files changed, 80 insertions(+), 230 deletions(-) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 5ac71d22237..b74540c1a8f 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 . @@ -19,7 +19,7 @@ along with this program. If not, see . */ -/* 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 #include -#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,13 @@ 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) +ptraceaix (int req, int id, long long addr, int data, int *buf) { errno = 0; - 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 - -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)); + return ptrace_check (req, id, ptrace64 (req, id, addr, data, buf)); } /* If *PIDP is a composite process/thread id, convert it to a @@ -444,23 +408,26 @@ pdc_read_regs (pthdb_user_t user_current_pid, { if (data->arch64) { - if (!ptrace64aix (PTT_READ_GPRS, tid, - (unsigned long) gprs64, 0, NULL)) + if (!ptraceaix (PTT_READ_GPRS, tid, + (unsigned long) gprs64, 0, NULL)) memset (gprs64, 0, sizeof (gprs64)); - memcpy (context->gpr, gprs64, sizeof(gprs64)); + memcpy (context->gpr, gprs64, sizeof (gprs64)); } else { - if (!ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL)) + if (!ptraceaix (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL)) memset (gprs32, 0, sizeof (gprs32)); - memcpy (context->gpr, gprs32, sizeof(gprs32)); + /* context->gpr is uint64_t[]; zero-extend each 32-bit register + value rather than copying raw bytes. */ + for (int i = 0; i < ppc_num_gprs; i++) + context->gpr[i] = gprs32[i]; } } /* Floating-point registers. */ if (flags & PTHDB_FLAG_FPRS) { - if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL)) + if (!ptraceaix (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL)) memset (fprs, 0, sizeof (fprs)); memcpy (context->fpr, fprs, sizeof(fprs)); } @@ -470,14 +437,14 @@ pdc_read_regs (pthdb_user_t user_current_pid, { if (data->arch64) { - if (!ptrace64aix (PTT_READ_SPRS, tid, + if (!ptraceaix (PTT_READ_SPRS, tid, (unsigned 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 (!ptraceaix (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL)) memset (&sprs32, 0, sizeof (sprs32)); memcpy (&context->msr, &sprs32, sizeof(sprs32)); } @@ -487,36 +454,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 (!ptraceaix (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 (!ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0)) + memset (&vsx, 0, sizeof (vsx)); + memcpy (&context->vsx, &vsx, sizeof (__vsx_context_t)); } return 0; } @@ -549,49 +498,33 @@ pdc_write_regs (pthdb_user_t user_current_pid, if (flags & PTHDB_FLAG_GPRS) { if (data->arch64) - ptrace64aix (PTT_WRITE_GPRS, tid, - (unsigned long) context->gpr, 0, NULL); + ptraceaix (PTT_WRITE_GPRS, tid, (long long) context->gpr, 0, NULL); else - ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) context->gpr, 0, NULL); + { + /* PTT_WRITE_GPRS for a 32-bit inferior expects a uint32_t array; + truncate each 64-bit context register to 32 bits. */ + uint32_t gprs32[ppc_num_gprs]; + for (int i = 0; i < ppc_num_gprs; i++) + gprs32[i] = (uint32_t) context->gpr[i]; + ptraceaix (PTT_WRITE_GPRS, tid, (uintptr_t) gprs32, 0, NULL); + } } - /* Floating-point registers. */ + /* Floating-point registers. */ if (flags & PTHDB_FLAG_FPRS) - { - ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) context->fpr, 0, NULL); - } + ptraceaix (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); - } - } + ptraceaix (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); - } + ptraceaix (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); - } + ptraceaix (PTT_WRITE_VSX, tid, (long long) &context->vsx, 0, 0); return 0; } @@ -1078,12 +1011,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); + ptraceaix (PTT_CONTINUE, tid[0], (long long) 1, + gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid); } } @@ -1357,14 +1286,14 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, { if (data->arch64) { - if (!ptrace64aix (PTT_READ_GPRS, tid, + if (!ptraceaix (PTT_READ_GPRS, tid, (unsigned 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 (!ptraceaix (PTT_READ_GPRS, tid, (uintptr_t) 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]); @@ -1377,9 +1306,9 @@ 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); + ret = ptraceaix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0); else - ret = ptrace32 (PTT_READ_VEC, tid, (uintptr_t) &vmx, 0, 0); + ret = ptraceaix (PTT_READ_VEC, tid, (uintptr_t) &vmx, 0, 0); if (ret < 0) memset(&vmx, 0, sizeof(__vmx_context_t)); for (i = 0; i < ppc_num_vrs; i++) @@ -1394,9 +1323,9 @@ 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); + ret = ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0); else - ret = ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0); + ret = ptraceaix (PTT_READ_VSX, tid, (uintptr_t) &vsx, 0, 0); if (ret < 0) memset(&vsx, 0, sizeof(__vsx_context_t)); for (i = 0; i < ppc_num_vshrs; i++) @@ -1410,7 +1339,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 (!ptraceaix (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL)) memset (fprs, 0, sizeof (fprs)); supply_fprs (regcache, fprs); } @@ -1421,7 +1350,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, { if (data->arch64) { - if (!ptrace64aix (PTT_READ_SPRS, tid, + if (!ptraceaix (PTT_READ_SPRS, tid, (unsigned long) &sprs64, 0, NULL)) memset (&sprs64, 0, sizeof (sprs64)); supply_sprs64 (regcache, sprs64.pt_iar, sprs64.pt_msr, @@ -1430,7 +1359,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, } else { - if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL)) + if (!ptraceaix (PTT_READ_SPRS, tid, (uintptr_t) &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, @@ -1678,9 +1607,9 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid) { memset(&vsx, 0, sizeof(__vsx_context_t)); for (i = 0; i < ppc_num_vshrs; i++) - if (REG_VALID == regcache->get_register_status (tdep->ppc_vsr0_regnum + i)) + if (REG_VALID == regcache->get_register_status (tdep->ppc_vsr0_upper_regnum + i)) { - regcache->raw_collect (tdep->ppc_vr0_regnum + i, + regcache->raw_collect (tdep->ppc_vsr0_upper_regnum + i, &(vsx.__vsr_dw1[i])); ctx.vsx.__vsr_dw1[i] = vsx.__vsr_dw1[i]; } @@ -1735,7 +1664,8 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid) ctx.ctr = tmp_ctr; if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum)) ctx.xer = tmp_xer; - if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum)) + if (tdep->ppc_fpscr_regnum >= 0 + && REG_VALID == regcache->get_register_status (tdep->ppc_fpscr_regnum)) ctx.fpscr = tmp_fpscr; } @@ -1778,21 +1708,21 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, /* General-purpose registers. */ if (regno == -1 || (tdep->ppc_gp0_regnum <= regno - && regno < tdep->ppc_gp0_regnum + ppc_num_fprs)) + && regno < tdep->ppc_gp0_regnum + ppc_num_gprs)) { if (data->arch64) { /* Pre-fetch: some regs may not be in the cache. */ - ptrace64aix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0, NULL); + ptraceaix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0, NULL); fill_gprs64 (regcache, gprs64); - ptrace64aix (PTT_WRITE_GPRS, tid, (unsigned long) gprs64, 0, NULL); + ptraceaix (PTT_WRITE_GPRS, tid, (unsigned 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); + ptraceaix (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL); fill_gprs32 (regcache, gprs32); - ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) gprs32, 0, NULL); + ptraceaix (PTT_WRITE_GPRS, tid, (uintptr_t) gprs32, 0, NULL); } } @@ -1804,9 +1734,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); + ptraceaix (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL); fill_fprs (regcache, fprs); - ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) fprs, 0, NULL); + ptraceaix (PTT_WRITE_FPRS, tid, (uintptr_t) fprs, 0, NULL); } /* Special-purpose registers. */ @@ -1816,47 +1746,29 @@ 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); + ptraceaix (PTT_READ_SPRS, tid, + (unsigned 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); + ptraceaix (PTT_WRITE_SPRS, tid, + (unsigned 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); + ptraceaix (PTT_READ_SPRS, tid, (uintptr_t) &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); + ptraceaix (PTT_WRITE_SPRS, tid, (uintptr_t) &sprs32, 0, NULL); } } @@ -1869,16 +1781,16 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, if (__power_vmx()) { if (data->arch64) - ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0); + ret = ptraceaix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0); else - ret = ptrace32 (PTT_READ_VEC, tid, (long long) &vmx, 0, 0); + ret = ptraceaix (PTT_READ_VEC, tid, (uintptr_t) &vmx, 0, 0); if (ret > 0) { fill_altivec(regcache, &vmx); if (data->arch64) - ret = ptrace64aix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0); + ret = ptraceaix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0); else - ret = ptrace32 (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0); + ret = ptraceaix (PTT_WRITE_VEC, tid, (uintptr_t) &vmx, 0, 0); if (ret < 0) perror_with_name (_("Unable to store AltiVec register after read")); } @@ -1894,16 +1806,16 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, if (__power_vsx()) { if (data->arch64) - ret = ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0); + ret = ptraceaix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0); else - ret = ptrace32 (PTT_READ_VSX, tid, (long long) &vsx, 0, 0); + ret = ptraceaix (PTT_READ_VSX, tid, (uintptr_t) &vsx, 0, 0); if (ret > 0) { fill_vsx (regcache, &vsx); if (data->arch64) - ret = ptrace64aix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0); + ret = ptraceaix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0); else - ret = ptrace32 (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0); + ret = ptraceaix (PTT_WRITE_VSX, tid, (uintptr_t) &vsx, 0, 0); if (ret < 0) perror_with_name (_("Unable to store VSX register after read")); } diff --git a/gdb/config.in b/gdb/config.in index 74745665d4d..b68cc29d587 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 diff --git a/gdb/configure b/gdb/configure index f411113ea66..0ed570e0571 100755 --- a/gdb/configure +++ b/gdb/configure @@ -31138,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 -" -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 5d8e2d6628f..20d4bef68d4 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1914,11 +1914,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 ]]) fi ;; esac diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c index 276df378824..ada24b19779 100644 --- a/gdb/rs6000-aix-nat.c +++ b/gdb/rs6000-aix-nat.c @@ -60,24 +60,9 @@ /* Header files for alti-vec reg. */ #include -/* On AIX4.3+, sys/ldr.h provides different versions of struct ld_info for - debugging 32-bit and 64-bit processes. Define a typedef and macros for - accessing fields in the appropriate structures. */ - -/* In 32-bit compilation mode (which is the only mode from which ptrace() - works on 4.3), __ld_info32 is #defined as equivalent to ld_info. */ - -#if defined (__ld_info32) || defined (__ld_info64) -# define ARCH3264 -#endif - /* Return whether the current architecture is 64-bit. */ -#ifndef ARCH3264 -# define ARCH64() 0 -#else -# define ARCH64() (register_size (current_inferior ()->arch (), 0) == 8) -#endif +#define ARCH64() (register_size (current_inferior ()->arch (), 0) == 8) class rs6000_nat_target final : public inf_ptrace_target { @@ -246,42 +231,20 @@ regmap (struct gdbarch *gdbarch, int regno, int *isfloat) return -1; } -/* Call ptrace(REQ, ID, ADDR, DATA, BUF). */ +/* Call ptrace64(REQ, ID, ADDR, DATA, BUF). */ static int rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf) { -#ifdef HAVE_PTRACE64 - int ret = ptrace64 (req, id, (uintptr_t) addr, data, buf); -#else - int ret = ptrace (req, id, (int *)addr, data, buf); -#endif -#if 0 - printf ("rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n", - req, id, (unsigned int)addr, data, (unsigned int)buf, ret); -#endif - return ret; + return ptrace64 (req, id, (uintptr_t) addr, data, buf); } -/* Call ptracex(REQ, ID, ADDR, DATA, BUF). */ +/* Call ptrace64(REQ, ID, ADDR, DATA, BUF). */ static int rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf) { -#ifdef ARCH3264 -# ifdef HAVE_PTRACE64 - int ret = ptrace64 (req, id, addr, data, (PTRACE_TYPE_ARG5) buf); -# else - int ret = ptracex (req, id, addr, data, (PTRACE_TYPE_ARG5) buf); -# endif -#else - int ret = 0; -#endif -#if 0 - printf ("rs6000_ptrace64 (%d, %d, %s, %08x, 0x%x) = 0x%x\n", - req, id, hex_string (addr), data, (unsigned int)buf, ret); -#endif - return ret; + return ptrace64 (req, id, addr, data, (PTRACE_TYPE_ARG5) buf); } /* Store the vsx registers. */ -- 2.51.2