[Lldb-commits] [lldb] [lldb][AIX] Added Ptrace extensions for AIX (PR #108000)
Dhruv Srivastava via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 10 06:35:05 PDT 2024
https://github.com/DhruvSrivastavaX updated https://github.com/llvm/llvm-project/pull/108000
>From 426874ab276182858b75e9bbf8704dab1742757c Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava <dhruv.srivastava at ibm.com>
Date: Tue, 10 Sep 2024 04:38:32 -0500
Subject: [PATCH 1/3] Ptrace code base for AIX
---
lldb/include/lldb/Host/aix/Ptrace.h | 60 +++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 lldb/include/lldb/Host/aix/Ptrace.h
diff --git a/lldb/include/lldb/Host/aix/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
new file mode 100644
index 00000000000000..aabd3fd4fc5573
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -0,0 +1,60 @@
+//===-- Ptrace.h ------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This file defines ptrace functions & structures
+
+#ifndef liblldb_Host_linux_Ptrace_h_
+#define liblldb_Host_linux_Ptrace_h_
+
+#include <sys/ptrace.h>
+
+#ifndef __GLIBC__
+typedef int __ptrace_request;
+#endif
+
+#define DEBUG_PTRACE_MAXBYTES 20
+
+// Support ptrace extensions even when compiled without required kernel support
+#ifndef PTRACE_GETREGS
+#define PTRACE_GETREGS 12
+#endif
+#ifndef PTRACE_SETREGS
+#define PTRACE_SETREGS 13
+#endif
+#ifndef PTRACE_GETFPREGS
+#define PTRACE_GETFPREGS 14
+#endif
+#ifndef PTRACE_SETFPREGS
+#define PTRACE_SETFPREGS 15
+#endif
+#ifndef PTRACE_GETREGSET
+#define PTRACE_GETREGSET 0x4204
+#endif
+#ifndef PTRACE_SETREGSET
+#define PTRACE_SETREGSET 0x4205
+#endif
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+#ifndef PTRACE_ARCH_PRCTL
+#define PTRACE_ARCH_PRCTL 30
+#endif
+#ifndef ARCH_GET_FS
+#define ARCH_SET_GS 0x1001
+#define ARCH_SET_FS 0x1002
+#define ARCH_GET_FS 0x1003
+#define ARCH_GET_GS 0x1004
+#endif
+#ifndef PTRACE_PEEKMTETAGS
+#define PTRACE_PEEKMTETAGS 33
+#endif
+#ifndef PTRACE_POKEMTETAGS
+#define PTRACE_POKEMTETAGS 34
+#endif
+
+#endif // liblldb_Host_linux_Ptrace_h_
>From 61bdaf75ddbd5940af5f23363311ffcacb0540d7 Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava <dhruv.srivastava at ibm.com>
Date: Tue, 10 Sep 2024 05:43:37 -0500
Subject: [PATCH 2/3] Modified specific to AIX
---
lldb/include/lldb/Host/aix/Ptrace.h | 38 +++++++++--------------------
1 file changed, 11 insertions(+), 27 deletions(-)
diff --git a/lldb/include/lldb/Host/aix/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
index aabd3fd4fc5573..5d5ae82c9dab7d 100644
--- a/lldb/include/lldb/Host/aix/Ptrace.h
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -8,29 +8,25 @@
// This file defines ptrace functions & structures
-#ifndef liblldb_Host_linux_Ptrace_h_
-#define liblldb_Host_linux_Ptrace_h_
+#ifndef liblldb_Host_aix_Ptrace_h_
+#define liblldb_Host_aix_Ptrace_h_
#include <sys/ptrace.h>
-#ifndef __GLIBC__
-typedef int __ptrace_request;
-#endif
-
#define DEBUG_PTRACE_MAXBYTES 20
// Support ptrace extensions even when compiled without required kernel support
#ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS 12
+#define PTRACE_GETREGS (PT_COMMAND_MAX + 1)
#endif
#ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS 13
+#define PTRACE_SETREGS (PT_COMMAND_MAX + 2)
#endif
#ifndef PTRACE_GETFPREGS
-#define PTRACE_GETFPREGS 14
+#define PTRACE_GETFPREGS (PT_COMMAND_MAX + 3)
#endif
#ifndef PTRACE_SETFPREGS
-#define PTRACE_SETFPREGS 15
+#define PTRACE_SETFPREGS (PT_COMMAND_MAX + 4)
#endif
#ifndef PTRACE_GETREGSET
#define PTRACE_GETREGSET 0x4204
@@ -38,23 +34,11 @@ typedef int __ptrace_request;
#ifndef PTRACE_SETREGSET
#define PTRACE_SETREGSET 0x4205
#endif
-#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA 25
-#endif
-#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL 30
-#endif
-#ifndef ARCH_GET_FS
-#define ARCH_SET_GS 0x1001
-#define ARCH_SET_FS 0x1002
-#define ARCH_GET_FS 0x1003
-#define ARCH_GET_GS 0x1004
-#endif
-#ifndef PTRACE_PEEKMTETAGS
-#define PTRACE_PEEKMTETAGS 33
+#ifndef PTRACE_GETVRREGS
+#define PTRACE_GETVRREGS (PT_COMMAND_MAX + 5)
#endif
-#ifndef PTRACE_POKEMTETAGS
-#define PTRACE_POKEMTETAGS 34
+#ifndef PTRACE_GETVSRREGS
+#define PTRACE_GETVSRREGS (PT_COMMAND_MAX + 6)
#endif
-#endif // liblldb_Host_linux_Ptrace_h_
+#endif // liblldb_Host_aix_Ptrace_h_
>From 1134b6fb81cedd75e447f42f788bb6d96351cdf3 Mon Sep 17 00:00:00 2001
From: Dhruv-Srivastava <dhruv.srivastava at ibm.com>
Date: Tue, 10 Sep 2024 08:32:41 -0500
Subject: [PATCH 3/3] Addressed comments
---
lldb/include/lldb/Host/aix/Ptrace.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lldb/include/lldb/Host/aix/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
index 5d5ae82c9dab7d..06678d1e1a2484 100644
--- a/lldb/include/lldb/Host/aix/Ptrace.h
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -8,13 +8,11 @@
// This file defines ptrace functions & structures
-#ifndef liblldb_Host_aix_Ptrace_h_
-#define liblldb_Host_aix_Ptrace_h_
+#ifndef LIBLLDB_HOST_AIX_PTRACE_H_
+#define LIBLLDB_HOST_AIX_PTRACE_H_
#include <sys/ptrace.h>
-#define DEBUG_PTRACE_MAXBYTES 20
-
// Support ptrace extensions even when compiled without required kernel support
#ifndef PTRACE_GETREGS
#define PTRACE_GETREGS (PT_COMMAND_MAX + 1)
@@ -41,4 +39,4 @@
#define PTRACE_GETVSRREGS (PT_COMMAND_MAX + 6)
#endif
-#endif // liblldb_Host_aix_Ptrace_h_
+#endif // LIBLLDB_HOST_AIX_PTRACE_H_
More information about the lldb-commits
mailing list