Author: Hemang Gadhavi
Date: 2026-04-07T21:39:52+05:30
New Revision: 1604565e5ed772f02d2a2c0ef40bddf4f9e8f35d

URL: 
https://github.com/llvm/llvm-project/commit/1604565e5ed772f02d2a2c0ef40bddf4f9e8f35d
DIFF: 
https://github.com/llvm/llvm-project/commit/1604565e5ed772f02d2a2c0ef40bddf4f9e8f35d.diff

LOG: [lldb][AIX] Enable NativeProcessAIX Manager for lldb-server (#190173)

This PR is in reference to porting LLDB on AIX. Ref discusssions: [llvm
discourse](https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640) and
https://github.com/llvm/llvm-project/issues/101657.
Complete changes together in this draft:
- https://github.com/llvm/llvm-project/pull/102601

Description:
This change enables proper AIX processes integration with lldb-server,
ensuring correct loading and handling of AIX target architectures.
It also retrieves the target process architecture from the host and
configures NativeProcessAIX accordingly.

Added: 
    

Modified: 
    lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
    lldb/tools/lldb-server/lldb-gdbserver.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp 
b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
index 66eeb213436a2..af54b043cc44c 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
@@ -84,9 +84,19 @@ NativeProcessAIX::Manager::Launch(ProcessLaunchInfo 
&launch_info,
   }
   LLDB_LOG(log, "inferior started, now in stopped state");
 
+  ProcessInstanceInfo Info;
+  if (!Host::GetProcessInfo(pid, Info)) {
+    return llvm::make_error<StringError>("Cannot get process architecture",
+                                         llvm::inconvertibleErrorCode());
+  }
+
+  // Set the architecture to the exe architecture.
+  LLDB_LOG(log, "pid = {0}, detected architecture {1}", pid,
+           Info.GetArchitecture().GetArchitectureName());
+
   return std::unique_ptr<NativeProcessAIX>(new NativeProcessAIX(
       pid, launch_info.GetPTY().ReleasePrimaryFileDescriptor(), 
native_delegate,
-      HostInfo::GetArchitecture(HostInfo::eArchKind64), *this, {pid}));
+      Info.GetArchitecture(), *this, {pid}));
 }
 
 llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
@@ -242,6 +252,11 @@ size_t NativeProcessAIX::UpdateThreads() {
   return m_threads.size();
 }
 
+Status NativeProcessAIX::GetFileLoadAddress(const llvm::StringRef &file_name,
+                                            lldb::addr_t &load_addr) {
+  return Status("unsupported");
+}
+
 Status NativeProcessAIX::GetLoadedModuleFileSpec(const char *module_path,
                                                  FileSpec &file_spec) {
   return Status("unsupported");

diff  --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp 
b/lldb/tools/lldb-server/lldb-gdbserver.cpp
index c5c0d4b97e935..bb758bffad076 100644
--- a/lldb/tools/lldb-server/lldb-gdbserver.cpp
+++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp
@@ -46,6 +46,8 @@
 #include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
 #elif defined(_WIN32)
 #include "Plugins/Process/Windows/Common/NativeProcessWindows.h"
+#elif defined(_AIX)
+#include "Plugins/Process/AIX/NativeProcessAIX.h"
 #endif
 
 #ifndef LLGS_PROGRAM_NAME
@@ -71,6 +73,8 @@ typedef process_freebsd::NativeProcessFreeBSD::Manager 
NativeProcessManager;
 typedef process_netbsd::NativeProcessNetBSD::Manager NativeProcessManager;
 #elif defined(_WIN32)
 typedef NativeProcessWindows::Manager NativeProcessManager;
+#elif defined(_AIX)
+typedef process_aix::NativeProcessAIX::Manager NativeProcessManager;
 #else
 // Dummy implementation to make sure the code compiles
 class NativeProcessManager : public NativeProcessProtocol::Manager {


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to