From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GZ5ULCoUzmpU7gAAWB0awg (envelope-from ) for ; Tue, 13 Oct 2026 07:21:14 -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=MN3bfOKY; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id ACC2E1E051; Tue, 13 Oct 2026 07:21:14 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 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 autolearn=ham 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 B6D031E04E for ; Tue, 13 Oct 2026 07:21:10 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 06EFC4BA79A3 for ; Tue, 13 Oct 2026 11:21:09 +0000 (GMT) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 112074BA23E1 for ; Tue, 13 Oct 2026 11:20:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 112074BA23E1 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 112074BA23E1 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791890429; cv=none; b=NaDrF9nHoI+wDOhc+q5EhFTFpScPO5OhkIaRqKO55gbDInruZNZOoCIuq/A69lA1A3JRbmubdkmIzrS6BV+1Z+z+kAMrD0tSEKEij+QSYfs1yRBJZD5vhM87gqN2Mo/tpmWA+2/y69WcU+hsJt5W+fGZd4WNE2Mp7xZX1HbAFZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791890429; c=relaxed/simple; bh=6OHtle0svLmN9mX/5CgKR8PD36y04eRbzJgGQxmxigY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=p8TA8Aih8ABltdLzi+KClF6RIJNUMvW3zy5HzcIAx1fopD4id5kVO8oC92JElbAPV/tFxt2Y4Fpo7TmJUljBldg8+B2y0Xpcbd60i/neWc/WGeuPQ/NKfN13bhGhktFhkkNvV7ZHLBrXhDqpdwd8p6p7SvMrvVunViHRAHhFmBc= ARC-Authentication-Results: i=1; sourceware.org Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-8819033dbadso1690586b3a.0 for ; Tue, 13 Oct 2026 04:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791890428; x=1792495228; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Hc/3wbQNLgchezB9kFsuKnaQQ3U2I6Au0lwJ9Ej0u28=; b=MN3bfOKYffDwHctWYE8JybrxqDkN5VXtOJ5bX/p4N+R6SRKsUqnISXDgttyyMrkGQ3 6A32SfRP3Sc/ldDoppi22IMeweQ2Ouw7bKG35DS0PkGrYDvk4s8npKCLaLD6FHlKzmzg Ojmq1pMBpnZcE/330E0oE8tI76E05O3odO9q75u09gAKceayyv0OrIbUqgSg7Cd6IBX/ ZC/t2YkrsH5qG/iCTbwmfQWYwN3ZbD1iJwvIPpuaFRn92/eQ2NTPHtcLwQboDTjk5Xp4 qAXwgxsGBEsUsf/NJR7NW6XmTWwEsBvvr07oUEOkZ2QjChCKyahyc4Sj0oE44fP4GPa1 1ONg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791890428; x=1792495228; h=content-transfer-encoding:mime-version:references:in-reply-to :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=Hc/3wbQNLgchezB9kFsuKnaQQ3U2I6Au0lwJ9Ej0u28=; b=zaKxOwuyjiHAzZ65zoB/Y2ICGyYgUoyvePLwzF6ksiO2Wdouo9dU1N5dHsD+G3tklU SNDumUsOYqVUSruDiECjAnJHeq4GmPXF7e3s5F3spgcWrmfyTpjLB07DhtSySDj3xRUp ZrEipLJ2SYmcONI0Pu7mLTWdOFL6y6r/aYokFBdJpM9hjgSEeIdFKsP3XrEL/mEAODCt XZjtWfdwW/dLfsvLrIZjBsPbq8a0C2CxKJ5nz0dqblNpfTx/LrcUfQ3jG+ZRH1LnEN10 nS/i0objRVzTgpAr1VRdvzdvcgPrx/u8w0ob4bef42ifwqPO2+sbOnO0cEb+1O66akjj 13Sw== X-Gm-Message-State: AFq9FYJJ38SuARQWDwy+2teQGMMpmtFI37UO/hfLrdLd3afWzbv1UuJ3 rpSsJfYbQrEzUMbMQ7j6o2OqSk1zVXGoTtpSoky6VKzIcee1+VUY/K76 X-Gm-Gg: AYBFou26VCJ5VIeIWz3I8552qgcQ2z9yJbjlewPoRTjpR7630JOPtoYMN58uuS/8lKb FBR6kQyy17TiRmPya7MZVM6SYuW8X5LrXKG0qbs9/lCaNif5LNlhZ7lvu7TEoTPt7W/LwAHz0M+ Oa/S5p9h1GknIyMr16BOUq8kfAqeaBOQaj5MDJ1g52y0gf6HtUp/xvgxP4XGTBjTq1Oc3+BO5gl EIeM9TnYkvPaMJpfaxnB13cDQUxwCmy9uVZN7IpK1pxZQCf8uYbSPRjV00xGmyqvSciutKEg84+ B1obd2WO/rI/BDhTlUXNwKUDtFmxMPjbizyfWSeFwU5BKDewDQGdlYPAjC5wlL+K+aiXiDI8K3j kOU5rLidcnhfY/r+qcDSPPt0otcUd3M+DRLong7Vk7PK3BiMOQ8Pr0D+CCU4jFavmw6cLsBnWBo t7WeG24T9vlmvyCZDbe5OewxiYb6u4+FfHIWw/qkHUdRomv0cGHgkFpfY+8k5CKM341ZhU1WIJM 3i4ohUVqazVCb53RLb7kqYiyj6Iz98PTslk X-Received: by 2002:a05:6a00:9190:b0:899:13ee:1bd7 with SMTP id d2e1a72fcca58-89913ee2127mr6745353b3a.35.1791890427747; Tue, 13 Oct 2026 04:20:27 -0700 (PDT) Received: from dhcp-9-123-1-12.bl1-in.ibm.com ([129.41.58.4]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-896c469ea49sm4858351b3a.53.2026.10.13.04.20.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 13 Oct 2026 04:20:27 -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, Aditya Vidyadhar Kamath Subject: [PATCH v5 3/4] Modernise aix-thread.c by combining ptrace wrappers. Date: Tue, 13 Oct 2026 16:49:19 +0530 Message-ID: <20261013111917.68981-6-akamath996@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261013111917.68981-2-akamath996@gmail.com> References: <20261013111917.68981-2-akamath996@gmail.com> 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 Vidyadhar Kamath AIX 7.2 is now the minimum supported release. 64-bit GDB on AIX always calls ptrace64, so remove 32-bit and 64-bit ptrace wrappers. Merge ptrace_check () into ptrace64aix (). ptrace64aix () now calls ptrace64 itself and handles the error cases directly, removing a layer of indirection. The VMX and VSX paths in pdc_read_regs () and pdc_write_regs () no longer need separate arch64 branches, since both paths were already identical after the ptrace32 () stub was made to call ptrace64. Remove the struct ptsprs workaround in store_regs_kernel_thread (). The fields were "unsigned long" up to AIX 5.2 but are "unsigned int" on all supported releases. fill_sprs32 () now writes straight into sprs32 without temporaries. The related comment and gdb_assert are removed. This cleanup also shows duplicated code between aix-thread.c and rs6000-aix-nat.c (AltiVec/VSX supply and collect routines, and GPR/FPR/SPR handling). Moving it into shared AIX helpers is left for a follow-up patch. Testing I ran the gdb.threads testsuite before and after this patch, from the gdb/testsuite directory, with 64-bit and 32-bit test programs. 64-bit: gmake check RUNTESTFLAGS='--directory=gdb.threads \ CC_FOR_TARGET="/opt/freeware/bin/gcc" \ CXX_FOR_TARGET="/opt/freeware/bin/g++" \ CXXFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64" \ CFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64"' 32-bit (same command without -maix64): gmake check RUNTESTFLAGS='--directory=gdb.threads \ CC_FOR_TARGET="/opt/freeware/bin/gcc" \ CXX_FOR_TARGET="/opt/freeware/bin/g++" \ CXXFLAGS_FOR_TARGET="-O0 -w -g -gdwarf" \ CFLAGS_FOR_TARGET="-O0 -w -g -gdwarf"' 64-bit 32-bit before after before after expected passes 2125 2154 2138 2179 unexpected failures 749 677 747 665 expected failures 4 4 4 4 known failures 20 20 20 20 unresolved testcases 1 1 1 1 untested testcases 10 13 11 13 unsupported tests 84 81 83 83 The number of unexpected failures decreases in both modes. The failures that remain are pre-existing. I grouped the 677 64-bit failures by test file: Group Failures Test files --------------------------------------- -------- ------------------- Fork, vfork and exec with other 276 foll-fork-other- threads thread (135), vfork-multi- inferior (43), next-fork-exec- other-thread (20), next-fork-other- thread (18), and others Step-over, break-while-running, 231 detach-step-over signal and async (52), multiple- step-overs (38), break-while- running (22), step-over-lands- on-breakpoint (21), async (6), and others Inferior calls from breakpoint 102 infcall-from-bp- conditions cond-other-thread- event (32), infcall-from-bp- cond-timeout (24), and others Multi-inferior and detach 40 process-dies-while- detaching (24), threadapply (16) Thread-local storage 14 tls (10), tls-core, tls-var, tls-nodebug, tls-nodebug-pie Other 14 pthreads (9), threadcrash (3), and others --------------------------------------- -------- Total 677 The 32-bit run has the same shape: 665 failures in the same test files. One thing is scheduler lock on AIX is yet to be implemented and TLS is work in progress. Async related test cases have failures on AIX. Detach has issues while working with multiple threads. None of the failure categories above are related to the changes in this patch. --- gdb/aix-thread.c | 224 +++++++++++------------------------------------ 1 file changed, 50 insertions(+), 174 deletions(-) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 7596bd844cf..795948424b2 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -295,13 +295,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; @@ -338,34 +341,6 @@ ptrace_check (int req, int id, int ret) return 0; /* Not reached. */ } -/* Call ptrace64 (REQ, ID, ADDR, DATA, BUF). Return success. */ - -#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) -{ - errno = 0; - return ptrace_check (req, id, ptracex (req, id, addr, data, buf)); -} - -/* 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) -{ - 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. */ @@ -460,14 +435,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)); } @@ -476,7 +450,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)); } @@ -486,14 +460,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)); } @@ -503,36 +476,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; } @@ -553,61 +508,29 @@ pdc_write_regs (pthdb_user_t user_current_pid, this is needed, I have implemented what I think it should do, however this code is untested. */ - struct aix_thread_variables *data; - - data = get_thread_data_helper_for_pid (user_current_pid); - if (debug_aix_thread) gdb_printf (gdb_stdlog, "pdc_write_regs tid=%d flags=%s\n", (int) tid, hex_string (flags)); /* 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; } @@ -1070,9 +993,6 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig) { struct thread_info *thread; pthdb_tid_t tid[2]; - struct aix_thread_variables *data; - - data = get_thread_data_helper_for_ptid (ptid); if (ptid.tid () == 0) { @@ -1096,12 +1016,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); } } @@ -1375,14 +1291,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]); @@ -1394,10 +1309,7 @@ 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++) @@ -1411,10 +1323,7 @@ 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++) @@ -1428,7 +1337,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); } @@ -1439,8 +1348,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, @@ -1448,7 +1356,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, @@ -1803,16 +1711,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); } } @@ -1824,9 +1732,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. */ @@ -1836,47 +1744,27 @@ 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); - - fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, - &tmp_ctr, &tmp_xer, &tmp_fpscr); + ptrace64aix (PTT_READ_SPRS, tid, (long long) &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); + ptrace64aix (PTT_WRITE_SPRS, tid, (long long) &sprs32, 0, NULL); } } @@ -1889,17 +1777,11 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, __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); + ret = ptrace64aix (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); + ret = ptrace64aix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0); if (ret < 0) perror_with_name (_("Unable to store AltiVec register after read")); } @@ -1915,17 +1797,11 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, __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); + ret = ptrace64aix (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); + ret = ptrace64aix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0); if (ret < 0) perror_with_name (_("Unable to store VSX register after read")); } -- 2.51.2