[Lldb-commits] [lldb] [lldb][AIX] Added base file for AIX Register Context (PR #144645)

Hemang Gadhavi via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 20 02:11:56 PDT 2025


https://github.com/HemangGadhavi updated https://github.com/llvm/llvm-project/pull/144645

>From 5b842ed6c8721f314f677602a3b0ae81c4b39f27 Mon Sep 17 00:00:00 2001
From: HemangGadhavi <hemang.gadhavi at ibm.com>
Date: Tue, 17 Jun 2025 02:50:45 -0500
Subject: [PATCH 1/2] [lldb][AIX] Added base file for AIX Register Context

---
 .../source/Plugins/Process/AIX/CMakeLists.txt |  1 +
 .../Process/AIX/NativeRegisterContextAIX.cpp  | 66 +++++++++++++++++
 .../Process/AIX/NativeRegisterContextAIX.h    | 74 +++++++++++++++++++
 3 files changed, 141 insertions(+)
 create mode 100644 lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
 create mode 100644 lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h

diff --git a/lldb/source/Plugins/Process/AIX/CMakeLists.txt b/lldb/source/Plugins/Process/AIX/CMakeLists.txt
index 6b3151edbd1ef..3a6d9ec118e60 100644
--- a/lldb/source/Plugins/Process/AIX/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/AIX/CMakeLists.txt
@@ -1,6 +1,7 @@
 add_lldb_library(lldbPluginProcessAIX
   NativeProcessAIX.cpp
   NativeThreadAIX.cpp
+  NativeRegisterContextAIX.cpp
 
   LINK_COMPONENTS
     Support
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
new file mode 100644
index 0000000000000..0cb993110bf78
--- /dev/null
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
@@ -0,0 +1,66 @@
+//===-- NativeRegisterContextAIX.cpp ------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "NativeRegisterContextAIX.h"
+#include "Plugins/Process/AIX/NativeProcessAIX.h"
+
+using namespace lldb_private;
+using namespace lldb_private::process_aix;
+
+lldb::ByteOrder NativeRegisterContextAIX::GetByteOrder() const {
+  return m_thread.GetProcess().GetByteOrder();
+}
+
+Status NativeRegisterContextAIX::ReadRegisterRaw(uint32_t reg_index,
+                                                 RegisterValue &reg_value) {
+  return Status("unimplemented");
+}
+
+Status
+NativeRegisterContextAIX::WriteRegisterRaw(uint32_t reg_index,
+                                           const RegisterValue &reg_value) {
+  return Status("unimplemented");
+}
+
+Status NativeRegisterContextAIX::ReadGPR() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::WriteGPR() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::ReadFPR() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::WriteFPR() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::ReadVMX() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::WriteVMX() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::ReadVSX() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::WriteVSX() { return Status("unimplemented"); }
+
+Status NativeRegisterContextAIX::ReadRegisterSet(void *buf, size_t buf_size,
+                                                 unsigned int regset) {
+  return Status("unimplemented");
+}
+
+Status NativeRegisterContextAIX::WriteRegisterSet(void *buf, size_t buf_size,
+                                                  unsigned int regset) {
+  return Status("unimplemented");
+}
+
+Status NativeRegisterContextAIX::DoReadRegisterValue(uint32_t offset,
+                                                     const char *reg_name,
+                                                     uint32_t size,
+                                                     RegisterValue &value) {
+  return Status("unimplemented");
+}
+
+Status NativeRegisterContextAIX::DoWriteRegisterValue(
+    uint32_t offset, const char *reg_name, const RegisterValue &value) {
+  return Status("unimplemented");
+}
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
new file mode 100644
index 0000000000000..2a22c45ce008c
--- /dev/null
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
@@ -0,0 +1,74 @@
+//===-- NativeRegisterContextAIX.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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_NativeRegisterContextAIX_h
+#define lldb_NativeRegisterContextAIX_h
+
+#include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
+
+namespace lldb_private {
+namespace process_aix {
+
+class NativeThreadAIX;
+
+class NativeRegisterContextAIX
+    : public virtual NativeRegisterContextRegisterInfo {
+protected:
+  NativeRegisterContextAIX(NativeThreadProtocol &thread)
+      : NativeRegisterContextRegisterInfo(thread, nullptr) {}
+
+  lldb::ByteOrder GetByteOrder() const;
+
+  virtual Status ReadRegisterRaw(uint32_t reg_index, RegisterValue &reg_value);
+
+  virtual Status WriteRegisterRaw(uint32_t reg_index,
+                                  const RegisterValue &reg_value);
+
+  virtual Status ReadRegisterSet(void *buf, size_t buf_size,
+                                 unsigned int regset);
+
+  virtual Status WriteRegisterSet(void *buf, size_t buf_size,
+                                  unsigned int regset);
+
+  virtual Status ReadGPR();
+
+  virtual Status WriteGPR();
+
+  virtual Status ReadFPR();
+
+  virtual Status WriteFPR();
+
+  virtual Status ReadVMX();
+
+  virtual Status WriteVMX();
+
+  virtual Status ReadVSX();
+
+  virtual Status WriteVSX();
+
+  virtual void *GetGPRBuffer() = 0;
+
+  virtual size_t GetGPRSize() = 0;
+
+  virtual void *GetFPRBuffer() = 0;
+
+  virtual size_t GetFPRSize() = 0;
+
+  // The Do*** functions are executed on the privileged thread and can perform
+  // ptrace operations directly.
+  virtual Status DoReadRegisterValue(uint32_t offset, const char *reg_name,
+                                     uint32_t size, RegisterValue &value);
+
+  virtual Status DoWriteRegisterValue(uint32_t offset, const char *reg_name,
+                                      const RegisterValue &value);
+};
+
+} // namespace process_aix
+} // namespace lldb_private
+
+#endif // #ifndef lldb_NativeRegisterContextAIX_h

>From a0e87b568791e37a9b6b4f6a6ca4762c438bb2b5 Mon Sep 17 00:00:00 2001
From: HemangGadhavi <hemang.gadhavi at ibm.com>
Date: Thu, 19 Jun 2025 00:42:43 -0500
Subject: [PATCH 2/2] Addressed review comments

---
 .../Process/AIX/NativeRegisterContextAIX.cpp  | 16 ++-----------
 .../Process/AIX/NativeRegisterContextAIX.h    | 24 +++++--------------
 2 files changed, 8 insertions(+), 32 deletions(-)

diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
index 0cb993110bf78..e44cd7b5a30f5 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextAIX.cpp ------------------------------------===//
+//===---- NativeRegisterContextAIX.cpp ------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +13,7 @@ using namespace lldb_private;
 using namespace lldb_private::process_aix;
 
 lldb::ByteOrder NativeRegisterContextAIX::GetByteOrder() const {
-  return m_thread.GetProcess().GetByteOrder();
+  return lldb::eByteOrderInvalid;
 }
 
 Status NativeRegisterContextAIX::ReadRegisterRaw(uint32_t reg_index,
@@ -52,15 +52,3 @@ Status NativeRegisterContextAIX::WriteRegisterSet(void *buf, size_t buf_size,
                                                   unsigned int regset) {
   return Status("unimplemented");
 }
-
-Status NativeRegisterContextAIX::DoReadRegisterValue(uint32_t offset,
-                                                     const char *reg_name,
-                                                     uint32_t size,
-                                                     RegisterValue &value) {
-  return Status("unimplemented");
-}
-
-Status NativeRegisterContextAIX::DoWriteRegisterValue(
-    uint32_t offset, const char *reg_name, const RegisterValue &value) {
-  return Status("unimplemented");
-}
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
index 2a22c45ce008c..e78483a7670f6 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
@@ -1,4 +1,4 @@
-//===-- NativeRegisterContextAIX.h ----------------------------*- C++ -*-===//
+//===---- NativeRegisterContextAIX.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.
@@ -6,15 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef lldb_NativeRegisterContextAIX_h
-#define lldb_NativeRegisterContextAIX_h
+#ifndef LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVEREGISTERCONTEXTAIX_H
+#define LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVEREGISTERCONTEXTAIX_H
 
 #include "Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h"
 
-namespace lldb_private {
-namespace process_aix {
-
-class NativeThreadAIX;
+namespace lldb_private::process_aix {
 
 class NativeRegisterContextAIX
     : public virtual NativeRegisterContextRegisterInfo {
@@ -58,17 +55,8 @@ class NativeRegisterContextAIX
   virtual void *GetFPRBuffer() = 0;
 
   virtual size_t GetFPRSize() = 0;
-
-  // The Do*** functions are executed on the privileged thread and can perform
-  // ptrace operations directly.
-  virtual Status DoReadRegisterValue(uint32_t offset, const char *reg_name,
-                                     uint32_t size, RegisterValue &value);
-
-  virtual Status DoWriteRegisterValue(uint32_t offset, const char *reg_name,
-                                      const RegisterValue &value);
 };
 
-} // namespace process_aix
-} // namespace lldb_private
+} // namespace lldb_private::process_aix
 
-#endif // #ifndef lldb_NativeRegisterContextAIX_h
+#endif // #ifndef LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVEREGISTERCONTEXTAIX_H



More information about the lldb-commits mailing list