[Lldb-commits] [lldb] [lldb][AIX] Adding AIX version of ptrace64 (PR #120390)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 18 01:18:55 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Dhruv Srivastava (DhruvSrivastavaX)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/120390.diff
1 Files Affected:
- (modified) lldb/source/Host/posix/ProcessLauncherPosixFork.cpp (+7-3)
``````````diff
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...
``````````
</details>
https://github.com/llvm/llvm-project/pull/120390
More information about the lldb-commits
mailing list