[Lldb-commits] [lldb] [lldb][AIX] Added Ptrace extensions for AIX (PR #108000)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 10 09:34:23 PDT 2024
================
@@ -0,0 +1,44 @@
+//===-- 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_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)
----------------
labath wrote:
ok, so if I understand what you're saying, these definitions don't correspond to any actual values defined or supported by the system.
In that case, I think these values do not belong here, as this is basically an OS compatibility header. In fact, I think there's no reason for these constants should exist. You don't have to follow the patterns in NativeProcessLinux, if they don't make sense for you. There's nothing forcing you do implement ReadGPR like this
```
Status NativeRegisterContextAIX::ReadGPR() {
return NativeProcessAIX::PtraceWrapper(
PTRACE_GETREGS, m_thread.GetID(), nullptr, GetGPRBuffer(), GetGPRSize());
}
```
If your host ptrace call does not support reading GPRs in bulk. If you need to read registers one by one, the most obvious implementation is to just do that directly inside the ReadGPR function -- basically inline the relevant part of PtraceWrapper into this function (and then get rid of the constant).
https://github.com/llvm/llvm-project/pull/108000
More information about the lldb-commits
mailing list