From: Aditya Vidyadhar Kamath Date: Thu, 25 Jan 2024 12:28:29 +0000 (-0600) Subject: Fix attach-twice.c testcase for AIX. X-Git-Tag: gdb-15-branchpoint~1151 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0759c1bc9f0eb096ac5a04ce4abb1510e9963fbb;p=thirdparty%2Fbinutils-gdb.git Fix attach-twice.c testcase for AIX. Currently, in AIX attach-twice.exp testcase is untested due to the below error. gdb/testsuite/gdb.base/attach-twice.c:43:7: error: too few arguments to function 'ptrace' This is because in AIX ptrace has five arguments. This patch is a fix for the same such that this test case runs in AIX and other targets as well. --- diff --git a/gdb/testsuite/gdb.base/attach-twice.c b/gdb/testsuite/gdb.base/attach-twice.c index ecb882a0e7b..7b0af35a566 100644 --- a/gdb/testsuite/gdb.base/attach-twice.c +++ b/gdb/testsuite/gdb.base/attach-twice.c @@ -38,9 +38,15 @@ main (void) exit (1); case 0: errno = 0; + #if defined(_AIX) && defined (__64BIT__) + ptrace64 (PTRACE_ATTACH, getppid (), NULL, 0, NULL); + #elif defined(_AIX) && !defined (__64BIT__) + ptrace (PTRACE_ATTACH, getppid (), NULL, 0, NULL); + #else /* The 4th argument to ptrace () is 0 on purpose, as it is compatible between kernels that accept void* (like Linux) and int (NetBSD). */ ptrace (PTRACE_ATTACH, getppid (), NULL, 0); + #endif if (errno != 0) perror ("PTRACE_ATTACH"); break;