https://github.com/DhruvSrivastavaX created https://github.com/llvm/llvm-project/pull/108000
This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. #101657 The complete changes for porting are present in this draft PR: #102601 Added Ptrace extensions for AIX. - Commit 1: Taken Linux version for reference. - Commit 2: Modified the extensions for AIX. Review Request: @DavidSpickett >From 426874ab276182858b75e9bbf8704dab1742757c Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava <dhruv.srivast...@ibm.com> Date: Tue, 10 Sep 2024 04:38:32 -0500 Subject: [PATCH 1/2] 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.srivast...@ibm.com> Date: Tue, 10 Sep 2024 05:43:37 -0500 Subject: [PATCH 2/2] 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_ _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits