]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix attach-twice.c testcase for AIX.
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Thu, 25 Jan 2024 12:28:29 +0000 (06:28 -0600)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 25 Jan 2024 13:55:27 +0000 (14:55 +0100)
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.

gdb/testsuite/gdb.base/attach-twice.c

index ecb882a0e7b80eb71f8a8fe65f2ba30c0b841b1a..7b0af35a566e0c3bc23b00358b48ca876058d0dd 100644 (file)
@@ -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;