public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix attach-twice.c testcase for AIX.
@ 2024-01-25  3:57 Aditya Kamath1
  2024-01-25 11:29 ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Kamath1 @ 2024-01-25  3:57 UTC (permalink / raw)
  To: Ulrich Weigand, Aditya Kamath1 via Gdb-patches; +Cc: Sangamesh Mallayya


[-- Attachment #1.1: Type: text/plain, Size: 512 bytes --]

Respected community members,

Hi,

Please find attached a patch. (See: 0001-Fix-attach-twice.c-testcase-for-AIX.patch)

This is a small fix to resolve the attach-twice untested test case in AIX. Currently we are getting an error

gdb/testsuite/gdb.base/attach-twice.c:43:7: error: too few arguments to function 'ptrace'

which is why this testcase is untested. In AIX, we use 5 arguments for ptrace. Kindly give me your feedback for the same.

Have a nice day ahead.

Thanks and regards,
Aditya.

[-- Attachment #2: 0001-Fix-attach-twice.c-testcase-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 1640 bytes --]

From 000cf41f3048f5df1a90fbeda5a6091c68b97734 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Wed, 24 Jan 2024 21:51:04 -0600
Subject: [PATCH] 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.
---
 gdb/testsuite/gdb.base/attach-twice.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/attach-twice.c b/gdb/testsuite/gdb.base/attach-twice.c
index ecb882a0e7b..19687116739 100644
--- a/gdb/testsuite/gdb.base/attach-twice.c
+++ b/gdb/testsuite/gdb.base/attach-twice.c
@@ -26,6 +26,14 @@
 #define PTRACE_ATTACH PT_ATTACH
 #endif
 
+#ifdef _AIX
+#define PTRACE_FUNC ptrace64 (PTRACE_ATTACH, getppid (), NULL, 0, NULL)
+#elif
+/* The 4th argument to ptrace () is 0 on purpose, as it is compatible
+     between kernels that accept void* (like Linux) and int (NetBSD).  */
+#define PTRACE_FUNC ptrace (PTRACE_ATTACH, getppid (), NULL, 0); 
+#endif
+
 int
 main (void)
 {
@@ -38,9 +46,7 @@ main (void)
       exit (1);
     case 0:
       errno = 0;
-      /* 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);
+      PTRACE_FUNC;
       if (errno != 0)
 	perror ("PTRACE_ATTACH");
       break;
-- 
2.41.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-25 14:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25  3:57 [PATCH] Fix attach-twice.c testcase for AIX Aditya Kamath1
2024-01-25 11:29 ` Ulrich Weigand
2024-01-25 12:34   ` Aditya Kamath1
2024-01-25 13:57     ` Ulrich Weigand
2024-01-25 14:42       ` Aditya Kamath1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).