public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: [PATCH] Fix attach-twice.c testcase for AIX.
Date: Thu, 25 Jan 2024 03:57:56 +0000	[thread overview]
Message-ID: <CH2PR15MB3544511340CB88D1BDF037C3D67A2@CH2PR15MB3544.namprd15.prod.outlook.com> (raw)


[-- 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


             reply	other threads:[~2024-01-25  3:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25  3:57 Aditya Kamath1 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR15MB3544511340CB88D1BDF037C3D67A2@CH2PR15MB3544.namprd15.prod.outlook.com \
    --to=aditya.kamath1@ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).