https://github.com/DhruvSrivastavaX created https://github.com/llvm/llvm-project/pull/120390
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. https://github.com/llvm/llvm-project/issues/101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 Adding changes for minimal build for lldb binary on AIX. ptrace64 is needed to debug 64-bit AIX debuggee, and its format is different than the traditional ptrace on other platforms: https://www.ibm.com/docs/fr/aix/7.3?topic=p-ptrace-ptracex-ptrace64-subroutine Review Request: @labath @DavidSpickett >From 6361863d1533361146677c3bac8ce325ed2721a9 Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava <dhruv.srivast...@ibm.com> Date: Wed, 18 Dec 2024 03:10:23 -0600 Subject: [PATCH] Added AIX version of ptrace --- lldb/source/Host/posix/ProcessLauncherPosixFork.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp index 4a9469bde2f186..0e162d04c35837 100644 --- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -21,8 +21,8 @@ #include <sys/wait.h> #include <unistd.h> -#include <sstream> #include <csignal> +#include <sstream> #ifdef __ANDROID__ #include <android/api-level.h> @@ -47,8 +47,7 @@ static void write_string(int error_fd, const char *str) { (void)r; } -[[noreturn]] static void ExitWithError(int error_fd, - const char *operation) { +[[noreturn]] static void ExitWithError(int error_fd, const char *operation) { int err = errno; write_string(error_fd, operation); write_string(error_fd, " failed: "); @@ -193,8 +192,13 @@ struct ForkLaunchInfo { } // Start tracing this child that is about to exec. +#if !defined(_AIX) if (ptrace(PT_TRACE_ME, 0, nullptr, 0) == -1) ExitWithError(error_fd, "ptrace"); +#else + if (ptrace64(PT_TRACE_ME, 0, 0, 0, nullptr) == -1) + ExitWithError(error_fd, "ptrace"); +#endif } // Execute. We should never return... _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits