From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0aZXNvmnw2q5pjwAWB0awg (envelope-from ) for ; Mon, 05 Oct 2026 09:36:57 -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=L9cOvBMa; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D7A261E050; Mon, 05 Oct 2026 09:36:57 -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 43E101E04E for ; Mon, 05 Oct 2026 09:36:56 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 42A664BA9028 for ; Mon, 5 Oct 2026 13:36:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 42A664BA9028 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=L9cOvBMa Received: from mail-dl2-x0e.google.com (mail-dl2-x0e.google.com [IPv6:2607:f8b0:4864:38::e]) by sourceware.org (Postfix) with ESMTPS id 1F92F4BA23EB for ; Mon, 5 Oct 2026 13:36:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F92F4BA23EB 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 1F92F4BA23EB Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:38::e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791207387; cv=none; b=POsHq/nAolYcqvIM6aVbatjHEGAYFkD4+uaTLQtmi3ODY4VKkYFu92MOCY7r+6a09zvldgNHAujUBYYn7pwhwJXvZhUMeXSXL6clbXEp32vT8jKT6RBX+rFkLE3YyK3hvrYzqTSpRC8hDwp8sMpEWCJbBPyVnBQfPLnaZ2NTs+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791207387; c=relaxed/simple; bh=av6P1S3SRevVbcy3Ye1aZTI9v+t/Xn+xbtlIDgKJda8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wvkoez12BFCrJTs6VnPL87Wz96xw8Y4lELknh4UQlxrBUIKDyWuXJy+8xdAFlAfrTjgv7UoWIGoqq8sfbjb3h9WoFx4aeIhEKEG+zt0HvKWzXQ1M41FQa56/Cn+QKZdgaNggAdH2pBP2YKu+Vxft2jcvvHmUnkttfcH4EDGI5zs= 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=L9cOvBMa DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F92F4BA23EB Received: by mail-dl2-x0e.google.com with SMTP id a92af1059eb24-1438cb9b3a3so1465385c88.2 for ; Mon, 05 Oct 2026 06:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791207386; x=1791812186; darn=sourceware.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wNPkZ5MunOulPhOrcoDV9s9W9FWE/rg3wQbXTAZU7+g=; b=L9cOvBMaTmtrBACIcMwX4yeWKAVfMCGwmGadUpRp6ktjxxSxxG9XSnAhcfuyrFfh6Y B1cc4eu1zxzAs3AWEEC807zJZWU2odI7lEPfwnaPwc0iiBbR/ZafZ4L8EUhVGddpVmKc D42hemASleKr8JrBGxSAHdVLOOKRR3mYVStLFgA9kLX2iwX2PkwCU2d4x/uiZsPwSKbg 8svs3sV5YdW25zj+dK/aZ4uxdlgWZkbWKKUEIs0p8/Haq5HZOwuSbsSeWfhK5sPPTmlZ UACtD/bnrYET/7g8IDSQc/lWJ46Wfq28JU1MmYPDKK3dPKQY8qNzvmOrjRlI78Ce9Tfm 1oDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791207386; x=1791812186; h=content-transfer-encoding:content-type: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=wNPkZ5MunOulPhOrcoDV9s9W9FWE/rg3wQbXTAZU7+g=; b=wxe6NV9N1SLFI8pj6LS5zMtOlJpBGGogtsXV1zlkYeOXejpe0uHsQXYxcBq8hIxts0 CFNCfZlS/AGwq7PPr557OStA4l0+qlpDFp0M/vJ1s4a3NNDs0RdZqBXI/TbTa4YoStR/ YJf1PelD3aHffw5Df2vgukdjeIlRGJSgeWshaHKLUX8Rt0AsNxybLDYltnVhfkBwsLEC 5zXwZDXzZihHz3A5yol/ThUAaBgiqsXw2HfYeIPqF8mTyvK9YZOZfzk+ehLz5DC6EsHq yHszQWqpnup88XdG57YYhMFCmwprb9qrNuoT/40DEvEbILCDPjXugl6111ar066oCreu KVWw== X-Gm-Message-State: AFuF++nRwXOQFeE5pCfL6z0xSD4ok6z/0rFr4tm+TKyixIBLI3wLqTeG aTur7tUuDWHcxd4STCtW9MplNVR4IoOh5OUYjZwGUJpaFANTpAPbJjo5 X-Gm-Gg: AYBFou2B4+e9aiittA+U9Ee1+g/X1lCKShievNmx2CX5CUgPa5eMysTSz0EZLM2zfEK kZKo+Uq+DP/684M1/UAj4/bLhlhgNMDqRS6Yip63BGUP3q1+LY6/9P3CYPVVMgPZxFtCxaPHsQ2 v2mQksVcEdhtdpgWIFsHN9PMRzPkWPgMgtanaElvtmq/g5FcE1cR3vEWX+D4cCXEGtiGRNt03VO 2iCXYSd9nkKrEaGeEm6gQF3WXdrNV2FXwDpqZstJ9/XletwLXrnVFU8c5p14SK7aZWVcKlihdId anfyMxfZWwL+kf9FSFCP5J1drdbYMrbdGECN1KxfVGQMVD3Z7AxmaeoxtNiMZtOB9a1aTazaiDc PtZWEkNspT5KdoIdsBsynLGL3p1QBZmjLaqNfkx1IYEfho744OKfz8K7MHGed42uhmDB3bEx1vK 0IDaMnpuhvSmLg1xuOzZF4tXfAblGzRkQZvnGUuIA4Ro6e/Ib6nvm3euq9pZ+JLnvYqjSymN21X /SP+z5DXq2rJG0+a0ZOJq12BkY= X-Received: by 2002:a05:7022:5f04:b0:154:dc96:c1d8 with SMTP id a92af1059eb24-154dc96c48amr6288471c88.2.1791207385579; Mon, 05 Oct 2026 06:36:25 -0700 (PDT) Received: from localhost.localdomain ([122.171.21.153]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-151fce9a619sm20825621c88.14.2026.10.05.06.36.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Oct 2026 06:36:25 -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 v4 4/4][RFC] Moderninse aix-thread.c by combining ptrace wrappers Date: Mon, 5 Oct 2026 19:05:08 +0530 Message-ID: <20261005133509.32304-2-akamath996@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 With AIX 7.2 as the minimum supported AIX release, a number of legacy compatibility paths in aix-thread.c are no longer needed. This patch modernizes the file by: 1: Combining the ptrace checking and wrapper logic into a single helper, 2: Removing obsolete compatibility code for older AIX releases (ptrace/ptracex/PTHDB_VERSION_3) 3: Using ptrace64 consistently for thread and register operations in 64-bit GDB. 4: Made sure no manual declration of getthrds (). The resulting code is smaller and easier to follow while preserving existing behaviour. Then for testing: I ran the GDB thread testsuite before and after this change Before this patch: 32 bit -------------------------------------------------- === gdb Summary === # of unexpected core files 1 # of expected passes 2138 # of unexpected failures 747 # of expected failures 4 # of known failures 20 # of unresolved testcases 1 # of untested testcases 11 # of unsupported tests 83 # of paths in test names 3 64 bit === gdb Summary === # of unexpected core files 1 # of expected passes 2125 # of unexpected failures 749 # of expected failures 4 # of known failures 20 # of unresolved testcases 1 # of untested testcases 10 # of unsupported tests 84 # of paths in test names 3 After this patch: 64 bit === gdb Summary === # of unexpected core files 1 # of expected passes 2115 # of unexpected failures 732 # of expected failures 4 # of known failures 20 # of unresolved testcases 2 # of untested testcases 13 # of unsupported tests 83 # of paths in test names 3 # of duplicate test names 1 /current_gdb/binutils-gdb/gdb/gdb version 19.0.50.20261001-git -nw -nx -q -iex “set height 0” -iex “set width 0" -data-directory /current_gdb/binutils-gdb/gdb/data-directory -iex “set interactive-mode on” The overall results remain consistent with the current state of AIX thread support. Most failures are unrelated to this patch and fall into a few known categories: Approx 300 failures are because we do not have scheduler-locking on AIX. Approx 150 failures are because we do not have async mode on AIX. TLS we have 30 failures. That is work in progress. I also see failures due to exec after thread not handled. Then there are also minor issues like test tries to link with a text_segment option not there on AIX. So these are the reasons for the same. While working on this cleanup, I also noticed duplication between aix-thread.c and rs6000-aix-nat.c. In particular, the AltiVec (__vmx_context_t), VSX (__vsx_context_t), and register supply/collect logic appear to be good candidates for consolidation into shared AIX target helpers. That refactoring would be a follow-up series; for now this patch focuses solely on cleanup and removal of obsolete compatibility code. --- gdb/aix-thread.c | 258 +++++++++++++++-------------------------------- 1 file changed, 82 insertions(+), 176 deletions(-) diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 95aa18985ed..4826e33265c 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -262,13 +262,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; @@ -306,22 +309,6 @@ ptrace_check (int req, int id, int ret) return 0; /* Not reached. */ } -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)); -} - - -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. */ @@ -416,14 +403,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)); } @@ -432,7 +418,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)); } @@ -442,14 +428,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)); } @@ -459,36 +444,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; } @@ -519,51 +486,23 @@ pdc_write_regs (pthdb_user_t user_current_pid, /* 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; } @@ -1052,12 +991,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); } } @@ -1332,14 +1267,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]); @@ -1351,14 +1285,11 @@ 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++) - regcache->raw_supply (tdep->ppc_vr0_regnum + i, &(vmx.__vr[i])); + regcache->raw_supply (tdep->ppc_vr0_regnum + i, &(vmx.__vr[i])); regcache->raw_supply (tdep->ppc_vrsave_regnum, &(vmx.__vrsave)); regcache->raw_supply (tdep->ppc_vrsave_regnum - 1, &(vmx.__vscr)); } @@ -1368,14 +1299,12 @@ 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++) - regcache->raw_supply (tdep->ppc_vsr0_upper_regnum + i, &(vsx.__vsr_dw1[i])); + regcache->raw_supply (tdep->ppc_vsr0_upper_regnum + i, + &(vsx.__vsr_dw1[i])); } /* Floating-point registers. */ @@ -1385,7 +1314,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); } @@ -1396,8 +1325,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, @@ -1405,7 +1333,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, @@ -1761,16 +1689,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); } } @@ -1782,9 +1710,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. */ @@ -1794,29 +1722,19 @@ 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); + ptrace64aix (PTT_READ_SPRS, tid, (long long) &sprs32, 0, NULL); fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer, &tmp_fpscr); @@ -1834,59 +1752,47 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, (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); } } - /* Vector registers. */ - if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1 - && (regno == -1 || (regno >= tdep->ppc_vr0_regnum - && regno <= tdep->ppc_vrsave_regnum))) - { - __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); - 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); - if (ret < 0) - perror_with_name (_("Unable to store AltiVec register after read")); - } - } - } + /* Vector registers. */ + if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1 + && (regno == -1 || (regno >= tdep->ppc_vr0_regnum + && regno <= tdep->ppc_vrsave_regnum))) + { + __vmx_context_t vmx; + if (__power_vmx ()) + { + ret = ptrace64aix (PTT_READ_VEC, tid, (long long) &vmx, 0, 0); + if (ret > 0) + { + fill_altivec (regcache, &vmx); + ret = ptrace64aix (PTT_WRITE_VEC, tid, (long long) &vmx, 0, 0); + if (ret < 0) + perror_with_name (_("Unable to store AltiVec register after read")); + } + } + } - /* VSX registers. */ - if (tdep->ppc_vsr0_upper_regnum != -1 && (regno == -1 - || (regno >= tdep->ppc_vsr0_upper_regnum - && regno < tdep->ppc_vsr0_upper_regnum + ppc_num_vshrs))) - { - __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); - 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); - if (ret < 0) - perror_with_name (_("Unable to store VSX register after read")); - } - } - } + /* VSX registers. */ + if (tdep->ppc_vsr0_upper_regnum != -1 && (regno == -1 + || (regno >= tdep->ppc_vsr0_upper_regnum + && regno < tdep->ppc_vsr0_upper_regnum + ppc_num_vshrs))) + { + __vsx_context_t vsx; + if (__power_vsx ()) + { + ret = ptrace64aix (PTT_READ_VSX, tid, (long long) &vsx, 0, 0); + if (ret > 0) + { + fill_vsx (regcache, &vsx); + ret = ptrace64aix (PTT_WRITE_VSX, tid, (long long) &vsx, 0, 0); + if (ret < 0) + perror_with_name (_("Unable to store VSX register after read")); + } + } + } } /* Store gdb's current view of the register set into the -- 2.51.2