Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending LLDB to work on AIX #102601

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

DhruvSrivastavaX
Copy link
Contributor

@DhruvSrivastavaX DhruvSrivastavaX commented Aug 9, 2024

We have Implemented the necessary code changes required to run LLDB on AIX. This PR is for discussion as asked in #101657
With this PR, we request your inputs and feedback about our code changes.

This is also opened for discussion on the discourse platfom:
https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640

Co-authored by: Felix (Ting Wang) https://github.com/orcguru

Copy link

github-actions bot commented Aug 9, 2024

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category lldb clang:codegen debuginfo llvm:binary-utilities labels Aug 9, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 9, 2024

@llvm/pr-subscribers-lldb
@llvm/pr-subscribers-llvm-binary-utilities

@llvm/pr-subscribers-clang-codegen

Author: None (Dhruv-Srivastava-IBM)

Changes

We have Implemented the necessary code changes required to run LLDB on AIX. This PR is for discussion as asked in #101657
With this PR, we request your inputs and feedback about our code changes.


Patch is 388.02 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/102601.diff

128 Files Affected:

  • (modified) clang/lib/CodeGen/CGObjCMac.cpp (+5-1)
  • (modified) lldb/CMakeLists.txt (+4)
  • (added) lldb/NOTICE.TXT (+7)
  • (modified) lldb/cmake/modules/LLDBConfig.cmake (+1-1)
  • (modified) lldb/include/lldb/Core/Module.h (+3)
  • (modified) lldb/include/lldb/Core/ModuleSpec.h (+21-2)
  • (modified) lldb/include/lldb/Host/HostGetOpt.h (+1-1)
  • (modified) lldb/include/lldb/Host/HostInfo.h (+3)
  • (modified) lldb/include/lldb/Host/HostInfoBase.h (+1-1)
  • (modified) lldb/include/lldb/Host/XML.h (+5)
  • (added) lldb/include/lldb/Host/aix/AbstractSocket.h (+25)
  • (added) lldb/include/lldb/Host/aix/Host.h (+22)
  • (added) lldb/include/lldb/Host/aix/HostInfoAIX.h (+42)
  • (added) lldb/include/lldb/Host/aix/Ptrace.h (+62)
  • (added) lldb/include/lldb/Host/aix/Support.h (+29)
  • (added) lldb/include/lldb/Host/aix/Uio.h (+23)
  • (modified) lldb/include/lldb/Host/common/GetOptInc.h (+3-3)
  • (modified) lldb/include/lldb/Symbol/ObjectFile.h (+5)
  • (modified) lldb/include/lldb/Target/ABI.h (+6)
  • (modified) lldb/include/lldb/Target/DynamicLoader.h (+6)
  • (modified) lldb/include/lldb/Target/Process.h (+14)
  • (modified) lldb/include/lldb/Target/RegisterContextUnwind.h (+4)
  • (modified) lldb/include/lldb/Target/ThreadPlanCallFunction.h (+6)
  • (modified) lldb/include/lldb/Utility/StringExtractorGDBRemote.h (+1)
  • (modified) lldb/include/lldb/lldb-private-enumerations.h (+1)
  • (modified) lldb/source/API/CMakeLists.txt (+108)
  • (modified) lldb/source/API/SBBreakpoint.cpp (+3-3)
  • (modified) lldb/source/API/SBBreakpointLocation.cpp (+3-3)
  • (modified) lldb/source/API/SBBreakpointName.cpp (+2-2)
  • (modified) lldb/source/Core/DynamicLoader.cpp (+10)
  • (modified) lldb/source/Core/Mangled.cpp (+2)
  • (modified) lldb/source/Core/Module.cpp (+12)
  • (modified) lldb/source/Core/Section.cpp (+4)
  • (modified) lldb/source/Expression/DWARFExpression.cpp (+5-5)
  • (modified) lldb/source/Host/CMakeLists.txt (+13)
  • (added) lldb/source/Host/aix/AbstractSocket.cpp (+21)
  • (added) lldb/source/Host/aix/Host.cpp (+304)
  • (added) lldb/source/Host/aix/HostInfoAIX.cpp (+215)
  • (added) lldb/source/Host/aix/Support.cpp (+44)
  • (modified) lldb/source/Host/common/GetOptInc.cpp (+1-1)
  • (modified) lldb/source/Host/common/Host.cpp (+174-6)
  • (added) lldb/source/Host/common/LICENSE.aix-netbsd.txt (+125)
  • (modified) lldb/source/Host/common/XML.cpp (+3)
  • (modified) lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp (+2)
  • (modified) lldb/source/Host/posix/FileSystemPosix.cpp (+2)
  • (modified) lldb/source/Host/posix/MainLoopPosix.cpp (+17)
  • (modified) lldb/source/Host/posix/ProcessLauncherPosixFork.cpp (+5)
  • (modified) lldb/source/Initialization/CMakeLists.txt (+1-1)
  • (modified) lldb/source/Initialization/SystemInitializerCommon.cpp (+2-2)
  • (modified) lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp (+130-1)
  • (modified) lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h (+6)
  • (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt (+11)
  • (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp (+272)
  • (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h (+55)
  • (modified) lldb/source/Plugins/DynamicLoader/CMakeLists.txt (+1)
  • (modified) lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (+2-2)
  • (modified) lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (+1-1)
  • (modified) lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp (+193-3)
  • (modified) lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h (+14)
  • (modified) lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp (+1-1)
  • (modified) lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp (+7-7)
  • (modified) lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp (+1-1)
  • (modified) lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp (+4)
  • (modified) lldb/source/Plugins/Language/ObjC/Cocoa.cpp (+2)
  • (modified) lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp (+1-1)
  • (modified) lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (+1-1)
  • (added) lldb/source/Plugins/ObjectContainer/Big-Archive/CMakeLists.txt (+10)
  • (added) lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp (+522)
  • (added) lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h (+177)
  • (modified) lldb/source/Plugins/ObjectContainer/CMakeLists.txt (+1)
  • (modified) lldb/source/Plugins/ObjectFile/CMakeLists.txt (+1)
  • (modified) lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (+3-3)
  • (modified) lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp (+2)
  • (modified) lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp (+14-1)
  • (modified) lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (+16-2)
  • (added) lldb/source/Plugins/ObjectFile/XCOFF/CMakeLists.txt (+13)
  • (added) lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp (+780)
  • (added) lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h (+243)
  • (modified) lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (+1-1)
  • (added) lldb/source/Plugins/Platform/AIX/CMakeLists.txt (+13)
  • (added) lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp (+471)
  • (added) lldb/source/Plugins/Platform/AIX/PlatformAIX.h (+74)
  • (modified) lldb/source/Plugins/Platform/CMakeLists.txt (+1)
  • (added) lldb/source/Plugins/Process/AIX/CMakeLists.txt (+19)
  • (added) lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp (+2048)
  • (added) lldb/source/Plugins/Process/AIX/NativeProcessAIX.h (+283)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp (+157)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h (+133)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp (+744)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h (+138)
  • (added) lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp (+526)
  • (added) lldb/source/Plugins/Process/AIX/NativeThreadAIX.h (+126)
  • (modified) lldb/source/Plugins/Process/CMakeLists.txt (+3)
  • (modified) lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp (+33)
  • (modified) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp (+4)
  • (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.cpp (+1-1)
  • (modified) lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt (+5)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (+30)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (+7)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (+28)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h (+2)
  • (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+12-1)
  • (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (+8)
  • (modified) lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp (+4-4)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt (+5)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (+4)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+11-1)
  • (modified) lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp (+1-1)
  • (modified) lldb/source/Symbol/DWARFCallFrameInfo.cpp (+2-2)
  • (modified) lldb/source/Target/ABI.cpp (+9)
  • (modified) lldb/source/Target/CMakeLists.txt (+5)
  • (modified) lldb/source/Target/Process.cpp (+10)
  • (modified) lldb/source/Target/RegisterContextUnwind.cpp (+46)
  • (modified) lldb/source/Target/ThreadPlanCallFunction.cpp (+34)
  • (modified) lldb/source/Target/UnwindLLDB.cpp (+15)
  • (modified) lldb/source/Utility/ArchSpec.cpp (+17-1)
  • (modified) lldb/source/Utility/StringExtractorGDBRemote.cpp (+2)
  • (modified) lldb/test/CMakeLists.txt (+1-1)
  • (modified) lldb/tools/driver/CMakeLists.txt (+5)
  • (modified) lldb/tools/driver/Driver.cpp (+4-1)
  • (modified) lldb/tools/lldb-dap/CMakeLists.txt (+4)
  • (modified) lldb/tools/lldb-server/CMakeLists.txt (+7)
  • (modified) lldb/tools/lldb-server/SystemInitializerLLGS.cpp (+15)
  • (modified) lldb/tools/lldb-server/lldb-gdbserver.cpp (+4)
  • (modified) lldb/unittests/Host/FileSystemTest.cpp (+1-1)
  • (modified) lldb/unittests/Host/posix/TerminalTest.cpp (+4)
  • (modified) llvm/include/llvm/Object/XCOFFObjectFile.h (+3-1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp (+13-2)
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 30f3911a8b03c2..fc91981db68c12 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -5052,10 +5052,14 @@ std::string CGObjCCommonMac::GetSectionName(StringRef Section,
   case llvm::Triple::COFF:
     assert(Section.starts_with("__") && "expected the name to begin with __");
     return ("." + Section.substr(2) + "$B").str();
+  case llvm::Triple::XCOFF:
+    // Hack to allow "p 10+1" on AIX for lldb
+    assert(Section.substr(0, 2) == "__" &&
+           "expected the name to begin with __");
+    return Section.substr(2).str();
   case llvm::Triple::Wasm:
   case llvm::Triple::GOFF:
   case llvm::Triple::SPIRV:
-  case llvm::Triple::XCOFF:
   case llvm::Triple::DXContainer:
     llvm::report_fatal_error(
         "Objective-C support is unimplemented for object file format");
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 59cdc4593463c1..2e9ae0d0b3221c 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -38,6 +38,10 @@ endif()
 include(LLDBConfig)
 include(AddLLDB)
 
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D__AIX__")
+endif()
+
 # Define the LLDB_CONFIGURATION_xxx matching the build type.
 if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   add_definitions(-DLLDB_CONFIGURATION_DEBUG)
diff --git a/lldb/NOTICE.TXT b/lldb/NOTICE.TXT
new file mode 100644
index 00000000000000..d814272967476e
--- /dev/null
+++ b/lldb/NOTICE.TXT
@@ -0,0 +1,7 @@
+
+This product contains small piece of code to support AIX, taken from netbsd.
+
+  * LICENSE:
+    * lldb/source/Host/common/LICENSE.aix-netbsd.txt (OpenSSL License)
+  * HOMEPAGE:
+    * https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/crypto/external/bsd/openssl/dist
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index a60921990cf775..a0f118a11984c2 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -299,7 +299,7 @@ endif()
 
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
-if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows")
+if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows|AIX")
   set(LLDB_CAN_USE_LLDB_SERVER ON)
 else()
   set(LLDB_CAN_USE_LLDB_SERVER OFF)
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 5589c1c9a350dc..3829386562795c 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -196,6 +196,9 @@ class Module : public std::enable_shared_from_this<Module>,
   bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset,
                       bool &changed);
 
+  bool SetLoadAddressByType(Target &target, lldb::addr_t value,
+                            bool value_is_offset, bool &changed, int type_id);
+
   /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
   ///
   /// \see SymbolContextScope
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 4cbbbfa8a26e13..4fe06412b6b0b8 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -21,6 +21,7 @@
 
 #include <mutex>
 #include <vector>
+#include <string.h>
 
 namespace lldb_private {
 
@@ -41,8 +42,26 @@ class ModuleSpec {
   }
 
   ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
-      : m_file(file_spec), m_arch(arch), m_object_offset(0),
-        m_object_size(FileSystem::Instance().GetByteSize(file_spec)) {}
+      : m_arch(arch), m_object_offset(0) {
+    // parse object inside module format for example: /usr/ccs/lib/libc.a(shr_64.o)
+    llvm::SmallString<256> path_with_object;
+    file_spec.GetPath(path_with_object);
+    if (strstr(path_with_object.c_str(), "(") != nullptr) {
+      char *part;
+      char *str = (char *)path_with_object.c_str();
+      part = strtok(str, "()");
+      assert(part);
+      llvm::StringRef file_name(part);
+      part = strtok(nullptr, "()");
+      assert(part);
+      m_object_name = ConstString(part);
+      m_file = FileSpec(file_name);
+      m_object_size = FileSystem::Instance().GetByteSize(m_file);
+    } else {
+      m_file = file_spec;
+      m_object_size = FileSystem::Instance().GetByteSize(file_spec);
+    }
+  }
 
   FileSpec *GetFileSpecPtr() { return (m_file ? &m_file : nullptr); }
 
diff --git a/lldb/include/lldb/Host/HostGetOpt.h b/lldb/include/lldb/Host/HostGetOpt.h
index 52cfdf4dbb89c2..f450e561d6afb1 100644
--- a/lldb/include/lldb/Host/HostGetOpt.h
+++ b/lldb/include/lldb/Host/HostGetOpt.h
@@ -9,7 +9,7 @@
 #ifndef LLDB_HOST_HOSTGETOPT_H
 #define LLDB_HOST_HOSTGETOPT_H
 
-#if !defined(_MSC_VER) && !defined(__NetBSD__)
+#if !defined(_MSC_VER) && !defined(__NetBSD__) && !defined(__AIX__)
 
 #include <getopt.h>
 #include <unistd.h>
diff --git a/lldb/include/lldb/Host/HostInfo.h b/lldb/include/lldb/Host/HostInfo.h
index b7010d69d88e7f..156df8cf6901df 100644
--- a/lldb/include/lldb/Host/HostInfo.h
+++ b/lldb/include/lldb/Host/HostInfo.h
@@ -55,6 +55,9 @@
 #elif defined(__APPLE__)
 #include "lldb/Host/macosx/HostInfoMacOSX.h"
 #define HOST_INFO_TYPE HostInfoMacOSX
+#elif defined(__AIX__)
+#include "lldb/Host/aix/HostInfoAIX.h"
+#define HOST_INFO_TYPE HostInfoAIX
 #else
 #include "lldb/Host/posix/HostInfoPosix.h"
 #define HOST_INFO_TYPE HostInfoPosix
diff --git a/lldb/include/lldb/Host/HostInfoBase.h b/lldb/include/lldb/Host/HostInfoBase.h
index 705aad559f3b78..29e6acf39bfb24 100644
--- a/lldb/include/lldb/Host/HostInfoBase.h
+++ b/lldb/include/lldb/Host/HostInfoBase.h
@@ -149,6 +149,7 @@ class HostInfoBase {
     return {};
   }
 
+  static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
   /// Returns the distribution id of the host
   ///
   /// This will be something like "ubuntu", "fedora", etc. on Linux.
@@ -158,7 +159,6 @@ class HostInfoBase {
   static llvm::StringRef GetDistributionId() { return llvm::StringRef(); }
 
 protected:
-  static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
   static bool ComputeSupportExeDirectory(FileSpec &file_spec);
   static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
   static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
diff --git a/lldb/include/lldb/Host/XML.h b/lldb/include/lldb/Host/XML.h
index da0f9cd7aa8c06..cf359f7726d5d6 100644
--- a/lldb/include/lldb/Host/XML.h
+++ b/lldb/include/lldb/Host/XML.h
@@ -11,6 +11,11 @@
 
 #include "lldb/Host/Config.h"
 
+#if defined(__AIX__)
+//FIXME for AIX
+#undef LLDB_ENABLE_LIBXML2
+#endif
+
 #if LLDB_ENABLE_LIBXML2
 #include <libxml/xmlreader.h>
 #endif
diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h
new file mode 100644
index 00000000000000..78a567a6b90953
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/AbstractSocket.h
@@ -0,0 +1,25 @@
+//===-- AbstractSocket.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 liblldb_AbstractSocket_h_
+#define liblldb_AbstractSocket_h_
+
+#include "lldb/Host/posix/DomainSocket.h"
+
+namespace lldb_private {
+class AbstractSocket : public DomainSocket {
+public:
+  AbstractSocket(bool child_processes_inherit);
+
+protected:
+  size_t GetNameOffset() const override;
+  void DeleteSocketFile(llvm::StringRef name) override;
+};
+}
+
+#endif // ifndef liblldb_AbstractSocket_h_
diff --git a/lldb/include/lldb/Host/aix/Host.h b/lldb/include/lldb/Host/aix/Host.h
new file mode 100644
index 00000000000000..1e3487752995fb
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Host.h
@@ -0,0 +1,22 @@
+//===-- Host.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_HOST_AIX_HOST_H
+#define LLDB_HOST_AIX_HOST_H
+
+#include "lldb/lldb-types.h"
+#include <optional>
+
+namespace lldb_private {
+
+// Get PID (i.e. the primary thread ID) corresponding to the specified TID.
+std::optional<lldb::pid_t> getPIDForTID(lldb::pid_t tid);
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_HOST_AIX_HOST_H
diff --git a/lldb/include/lldb/Host/aix/HostInfoAIX.h b/lldb/include/lldb/Host/aix/HostInfoAIX.h
new file mode 100644
index 00000000000000..ced4cf34d38a81
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/HostInfoAIX.h
@@ -0,0 +1,42 @@
+//===-- HostInfoAIX.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_Host_aix_HostInfoAIX_h_
+#define lldb_Host_aix_HostInfoAIX_h_
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/VersionTuple.h"
+
+#include <string>
+
+namespace lldb_private {
+
+class HostInfoAIX : public HostInfoPosix {
+  friend class HostInfoBase;
+
+public:
+  static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr);
+  static void Terminate();
+
+  static llvm::VersionTuple GetOSVersion();
+  static std::optional<std::string> GetOSBuildString();
+  static llvm::StringRef GetDistributionId();
+  static FileSpec GetProgramFileSpec();
+
+protected:
+  static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+  static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+  static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+  static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+                                             ArchSpec &arch_64);
+};
+}
+
+#endif
diff --git a/lldb/include/lldb/Host/aix/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
new file mode 100644
index 00000000000000..88928f18102d7c
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -0,0 +1,62 @@
+//===-- 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)
+#endif
+#ifndef PTRACE_SETREGS
+#define PTRACE_SETREGS          (PT_COMMAND_MAX+2)
+#endif
+#ifndef PTRACE_GETFPREGS
+#define PTRACE_GETFPREGS        (PT_COMMAND_MAX+3)
+#endif
+#ifndef PTRACE_SETFPREGS
+#define PTRACE_SETFPREGS        (PT_COMMAND_MAX+4)
+#endif
+#ifndef PTRACE_GETREGSET
+#define PTRACE_GETREGSET 0x4204
+#endif
+#ifndef PTRACE_SETREGSET
+#define PTRACE_SETREGSET 0x4205
+#endif
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA  (PT_COMMAND_MAX+5)
+#endif
+#ifndef PTRACE_ARCH_PRCTL
+#define PTRACE_ARCH_PRCTL       (PT_COMMAND_MAX+6)
+#endif
+#ifndef ARCH_GET_FS
+#define ARCH_SET_GS 0x1001
+#define ARCH_SET_FS 0x1002
+#define ARCH_GET_FS 0x1003
+#define ARCH_GET_GS 0x1004
+#endif
+#ifndef PTRACE_PEEKMTETAGS
+#define PTRACE_PEEKMTETAGS      (PT_COMMAND_MAX+7)
+#endif
+#ifndef PTRACE_POKEMTETAGS
+#define PTRACE_POKEMTETAGS      (PT_COMMAND_MAX+8)
+#endif
+#ifndef PTRACE_GETVRREGS
+#define PTRACE_GETVRREGS        (PT_COMMAND_MAX+9)
+#endif
+#ifndef PTRACE_GETVSRREGS
+#define PTRACE_GETVSRREGS       (PT_COMMAND_MAX+10)
+#endif
+
+#endif // liblldb_Host_aix_Ptrace_h_
diff --git a/lldb/include/lldb/Host/aix/Support.h b/lldb/include/lldb/Host/aix/Support.h
new file mode 100644
index 00000000000000..27d6c2b50a35b0
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Support.h
@@ -0,0 +1,29 @@
+//===-- Support.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_HOST_AIX_SUPPORT_H
+#define LLDB_HOST_AIX_SUPPORT_H
+
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include <memory>
+
+namespace lldb_private {
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file);
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(::pid_t pid, const llvm::Twine &file);
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(const llvm::Twine &file);
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_HOST_AIX_SUPPORT_H
diff --git a/lldb/include/lldb/Host/aix/Uio.h b/lldb/include/lldb/Host/aix/Uio.h
new file mode 100644
index 00000000000000..acf79ecc6a1d0d
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Uio.h
@@ -0,0 +1,23 @@
+//===-- Uio.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 liblldb_Host_aix_Uio_h_
+#define liblldb_Host_aix_Uio_h_
+
+#include "lldb/Host/Config.h"
+#include <sys/uio.h>
+
+// We shall provide our own implementation of process_vm_readv if it is not
+// present
+#if !HAVE_PROCESS_VM_READV
+ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
+                         unsigned long liovcnt, const struct iovec *remote_iov,
+                         unsigned long riovcnt, unsigned long flags);
+#endif
+
+#endif // liblldb_Host_aix_Uio_h_
diff --git a/lldb/include/lldb/Host/common/GetOptInc.h b/lldb/include/lldb/Host/common/GetOptInc.h
index 3fb9add4795417..ebb475bfaf6b8d 100644
--- a/lldb/include/lldb/Host/common/GetOptInc.h
+++ b/lldb/include/lldb/Host/common/GetOptInc.h
@@ -11,11 +11,11 @@
 
 #include "lldb/lldb-defines.h"
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__AIX__)
 #define REPLACE_GETOPT
 #define REPLACE_GETOPT_LONG
 #endif
-#if defined(_MSC_VER) || defined(__NetBSD__)
+#if defined(_MSC_VER) || defined(__NetBSD__) || defined(__AIX__)
 #define REPLACE_GETOPT_LONG_ONLY
 #endif
 
@@ -35,7 +35,7 @@ struct option {
   int val;
 };
 
-int getopt(int argc, char *const argv[], const char *optstring);
+int getopt(int argc, char *const argv[], const char *optstring) throw();
 
 // from getopt.h
 extern char *optarg;
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index 8592323322e383..bf66ccec263d24 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -401,6 +401,11 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
     return false;
   }
 
+  virtual bool SetLoadAddressByType(Target &target, lldb::addr_t value,
+                              bool value_is_offset, int type_id) {
+    return false;
+  }
+
   /// Gets whether endian swapping should occur when extracting data from this
   /// object file.
   ///
diff --git a/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h
index 7b646d743346b7..281a89951ef885 100644
--- a/lldb/include/lldb/Target/ABI.h
+++ b/lldb/include/lldb/Target/ABI.h
@@ -47,6 +47,12 @@ class ABI : public PluginInterface {
                                   lldb::addr_t returnAddress,
                                   llvm::ArrayRef<lldb::addr_t> args) const = 0;
 
+  virtual bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+                                  lldb::addr_t functionAddress,
+                                  lldb::addr_t tocAddress,
+                                  lldb::addr_t returnAddress,
+                                  llvm::ArrayRef<lldb::addr_t> args) const;
+
   // Prepare trivial call used from ThreadPlanFunctionCallUsingABI
   // AD:
   //  . Because i don't want to change other ABI's this is not declared pure
diff --git a/lldb/include/lldb/Target/DynamicLoader.h b/lldb/include/lldb/Target/DynamicLoader.h
index 0629e2faae7e9e..7dccd317c2dca1 100644
--- a/lldb/include/lldb/Target/DynamicLoader.h
+++ b/lldb/include/lldb/Target/DynamicLoader.h
@@ -359,6 +359,12 @@ class DynamicLoader : public PluginInterface {
                                     lldb::addr_t base_addr,
                                     bool base_addr_is_offset);
 
+  virtual void UpdateLoadedSectionsByType(lldb::ModuleSP module,
+                                    lldb::addr_t link_map_addr,
+                                    lldb::addr_t base_addr,
+                                    bool base_addr_is_offset,
+                                    int type_id);
+
   // Utility method so base classes can share implementation of
   // UpdateLoadedSections
   void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr,
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index cf16fbc812aa48..886ca766112c8d 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -63,6 +63,10 @@
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/VersionTuple.h"
 
+#if defined(__AIX__)
+struct ld_xinfo;
+#endif
+
 namespace lldb_private {
 
 template <typename B, typename S> struct Range;
@@ -1915,6 +1919,10 @@ class Process : public std::enable_shared_from_this<Process>,
   Status GetMemoryRegionInfo(lldb::addr_t load_addr,
                              MemoryRegionInfo &range_info);
 
+#if defined(__AIX__)
+  Status GetLDXINFO(struct ld_xinfo *info_ptr);
+#endif
+
   /// Obtain all the mapped memory regions within this process.
   ///
   /// \param[out] region_list
@@ -2855,6 +2863,12 @@ void PruneThreadPlans();
     return Status("Process::DoGetMemoryRegionInfo() not supported");
   }
 
+#if defined(__AIX__)
+  virtual Status DoGetLDXINFO(struct ld_xinfo *info_ptr) {
+    return Status("Process::DoGetLDXINFO() not supported");
+  }
+#endif
+
   /// Provide an override value in the subclass for lldb's
   /// CPU-based logic for whether watchpoint exceptions are
   /// received before or after an instruction executes.
diff --git a/lldb/include/lldb/Target/RegisterContextUnwind.h b/lldb/include/lldb/Target/RegisterContextUnwind.h
index ef8ae884038663..00a95853800edd 100644
--- a/lldb/include/lldb/Target/RegisterContextUnwind.h
+++ b/lldb/include/lldb/Target/RegisterContextUnwind.h
@@ -67,6 +67,10 @@ class RegisterContextUnwind : public lldb_private::RegisterContext {
 
   bool ReadPC(lldb::addr_t &start_pc);
 
+#ifdef __AIX__
+  bool ReadLR(lldb::addr_t &lr);
+#endif
+
   // Indicates whether this frame *behaves* like frame zero -- the currently
   // executing frame -- or not.  This can be true in the middle of the stack
   // above asynchronous trap handlers (sigtramp) for instance.
diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index cb6e7caebb4adf..7880db1592e04a 100644
--- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -27,6 +27,12 @@ class ThreadPlanCallFunction : public ThreadPlan {
                          llvm::ArrayRef<lldb::addr_t> args,
                          const EvaluateExpressionOptions &options);
 
+  ThreadPlanCallFunction(Thread &thread, const Address &function,
+                         const Address &toc,
+                 ...
[truncated]

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 9, 2024

@llvm/pr-subscribers-clang

Author: None (Dhruv-Srivastava-IBM)

Changes

We have Implemented the necessary code changes required to run LLDB on AIX. This PR is for discussion as asked in #101657
With this PR, we request your inputs and feedback about our code changes.


Patch is 388.02 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/102601.diff

128 Files Affected:

  • (modified) clang/lib/CodeGen/CGObjCMac.cpp (+5-1)
  • (modified) lldb/CMakeLists.txt (+4)
  • (added) lldb/NOTICE.TXT (+7)
  • (modified) lldb/cmake/modules/LLDBConfig.cmake (+1-1)
  • (modified) lldb/include/lldb/Core/Module.h (+3)
  • (modified) lldb/include/lldb/Core/ModuleSpec.h (+21-2)
  • (modified) lldb/include/lldb/Host/HostGetOpt.h (+1-1)
  • (modified) lldb/include/lldb/Host/HostInfo.h (+3)
  • (modified) lldb/include/lldb/Host/HostInfoBase.h (+1-1)
  • (modified) lldb/include/lldb/Host/XML.h (+5)
  • (added) lldb/include/lldb/Host/aix/AbstractSocket.h (+25)
  • (added) lldb/include/lldb/Host/aix/Host.h (+22)
  • (added) lldb/include/lldb/Host/aix/HostInfoAIX.h (+42)
  • (added) lldb/include/lldb/Host/aix/Ptrace.h (+62)
  • (added) lldb/include/lldb/Host/aix/Support.h (+29)
  • (added) lldb/include/lldb/Host/aix/Uio.h (+23)
  • (modified) lldb/include/lldb/Host/common/GetOptInc.h (+3-3)
  • (modified) lldb/include/lldb/Symbol/ObjectFile.h (+5)
  • (modified) lldb/include/lldb/Target/ABI.h (+6)
  • (modified) lldb/include/lldb/Target/DynamicLoader.h (+6)
  • (modified) lldb/include/lldb/Target/Process.h (+14)
  • (modified) lldb/include/lldb/Target/RegisterContextUnwind.h (+4)
  • (modified) lldb/include/lldb/Target/ThreadPlanCallFunction.h (+6)
  • (modified) lldb/include/lldb/Utility/StringExtractorGDBRemote.h (+1)
  • (modified) lldb/include/lldb/lldb-private-enumerations.h (+1)
  • (modified) lldb/source/API/CMakeLists.txt (+108)
  • (modified) lldb/source/API/SBBreakpoint.cpp (+3-3)
  • (modified) lldb/source/API/SBBreakpointLocation.cpp (+3-3)
  • (modified) lldb/source/API/SBBreakpointName.cpp (+2-2)
  • (modified) lldb/source/Core/DynamicLoader.cpp (+10)
  • (modified) lldb/source/Core/Mangled.cpp (+2)
  • (modified) lldb/source/Core/Module.cpp (+12)
  • (modified) lldb/source/Core/Section.cpp (+4)
  • (modified) lldb/source/Expression/DWARFExpression.cpp (+5-5)
  • (modified) lldb/source/Host/CMakeLists.txt (+13)
  • (added) lldb/source/Host/aix/AbstractSocket.cpp (+21)
  • (added) lldb/source/Host/aix/Host.cpp (+304)
  • (added) lldb/source/Host/aix/HostInfoAIX.cpp (+215)
  • (added) lldb/source/Host/aix/Support.cpp (+44)
  • (modified) lldb/source/Host/common/GetOptInc.cpp (+1-1)
  • (modified) lldb/source/Host/common/Host.cpp (+174-6)
  • (added) lldb/source/Host/common/LICENSE.aix-netbsd.txt (+125)
  • (modified) lldb/source/Host/common/XML.cpp (+3)
  • (modified) lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp (+2)
  • (modified) lldb/source/Host/posix/FileSystemPosix.cpp (+2)
  • (modified) lldb/source/Host/posix/MainLoopPosix.cpp (+17)
  • (modified) lldb/source/Host/posix/ProcessLauncherPosixFork.cpp (+5)
  • (modified) lldb/source/Initialization/CMakeLists.txt (+1-1)
  • (modified) lldb/source/Initialization/SystemInitializerCommon.cpp (+2-2)
  • (modified) lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp (+130-1)
  • (modified) lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h (+6)
  • (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt (+11)
  • (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp (+272)
  • (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h (+55)
  • (modified) lldb/source/Plugins/DynamicLoader/CMakeLists.txt (+1)
  • (modified) lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (+2-2)
  • (modified) lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (+1-1)
  • (modified) lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp (+193-3)
  • (modified) lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h (+14)
  • (modified) lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp (+1-1)
  • (modified) lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp (+7-7)
  • (modified) lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp (+1-1)
  • (modified) lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp (+4)
  • (modified) lldb/source/Plugins/Language/ObjC/Cocoa.cpp (+2)
  • (modified) lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp (+1-1)
  • (modified) lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (+1-1)
  • (added) lldb/source/Plugins/ObjectContainer/Big-Archive/CMakeLists.txt (+10)
  • (added) lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp (+522)
  • (added) lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h (+177)
  • (modified) lldb/source/Plugins/ObjectContainer/CMakeLists.txt (+1)
  • (modified) lldb/source/Plugins/ObjectFile/CMakeLists.txt (+1)
  • (modified) lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (+3-3)
  • (modified) lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp (+2)
  • (modified) lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp (+14-1)
  • (modified) lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (+16-2)
  • (added) lldb/source/Plugins/ObjectFile/XCOFF/CMakeLists.txt (+13)
  • (added) lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp (+780)
  • (added) lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h (+243)
  • (modified) lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (+1-1)
  • (added) lldb/source/Plugins/Platform/AIX/CMakeLists.txt (+13)
  • (added) lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp (+471)
  • (added) lldb/source/Plugins/Platform/AIX/PlatformAIX.h (+74)
  • (modified) lldb/source/Plugins/Platform/CMakeLists.txt (+1)
  • (added) lldb/source/Plugins/Process/AIX/CMakeLists.txt (+19)
  • (added) lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp (+2048)
  • (added) lldb/source/Plugins/Process/AIX/NativeProcessAIX.h (+283)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp (+157)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h (+133)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp (+744)
  • (added) lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h (+138)
  • (added) lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp (+526)
  • (added) lldb/source/Plugins/Process/AIX/NativeThreadAIX.h (+126)
  • (modified) lldb/source/Plugins/Process/CMakeLists.txt (+3)
  • (modified) lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp (+33)
  • (modified) lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp (+4)
  • (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.cpp (+1-1)
  • (modified) lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt (+5)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (+30)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h (+7)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (+28)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h (+2)
  • (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+12-1)
  • (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (+8)
  • (modified) lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp (+4-4)
  • (modified) lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt (+5)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (+4)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+11-1)
  • (modified) lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp (+1-1)
  • (modified) lldb/source/Symbol/DWARFCallFrameInfo.cpp (+2-2)
  • (modified) lldb/source/Target/ABI.cpp (+9)
  • (modified) lldb/source/Target/CMakeLists.txt (+5)
  • (modified) lldb/source/Target/Process.cpp (+10)
  • (modified) lldb/source/Target/RegisterContextUnwind.cpp (+46)
  • (modified) lldb/source/Target/ThreadPlanCallFunction.cpp (+34)
  • (modified) lldb/source/Target/UnwindLLDB.cpp (+15)
  • (modified) lldb/source/Utility/ArchSpec.cpp (+17-1)
  • (modified) lldb/source/Utility/StringExtractorGDBRemote.cpp (+2)
  • (modified) lldb/test/CMakeLists.txt (+1-1)
  • (modified) lldb/tools/driver/CMakeLists.txt (+5)
  • (modified) lldb/tools/driver/Driver.cpp (+4-1)
  • (modified) lldb/tools/lldb-dap/CMakeLists.txt (+4)
  • (modified) lldb/tools/lldb-server/CMakeLists.txt (+7)
  • (modified) lldb/tools/lldb-server/SystemInitializerLLGS.cpp (+15)
  • (modified) lldb/tools/lldb-server/lldb-gdbserver.cpp (+4)
  • (modified) lldb/unittests/Host/FileSystemTest.cpp (+1-1)
  • (modified) lldb/unittests/Host/posix/TerminalTest.cpp (+4)
  • (modified) llvm/include/llvm/Object/XCOFFObjectFile.h (+3-1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp (+13-2)
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 30f3911a8b03c2..fc91981db68c12 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -5052,10 +5052,14 @@ std::string CGObjCCommonMac::GetSectionName(StringRef Section,
   case llvm::Triple::COFF:
     assert(Section.starts_with("__") && "expected the name to begin with __");
     return ("." + Section.substr(2) + "$B").str();
+  case llvm::Triple::XCOFF:
+    // Hack to allow "p 10+1" on AIX for lldb
+    assert(Section.substr(0, 2) == "__" &&
+           "expected the name to begin with __");
+    return Section.substr(2).str();
   case llvm::Triple::Wasm:
   case llvm::Triple::GOFF:
   case llvm::Triple::SPIRV:
-  case llvm::Triple::XCOFF:
   case llvm::Triple::DXContainer:
     llvm::report_fatal_error(
         "Objective-C support is unimplemented for object file format");
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 59cdc4593463c1..2e9ae0d0b3221c 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -38,6 +38,10 @@ endif()
 include(LLDBConfig)
 include(AddLLDB)
 
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D__AIX__")
+endif()
+
 # Define the LLDB_CONFIGURATION_xxx matching the build type.
 if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   add_definitions(-DLLDB_CONFIGURATION_DEBUG)
diff --git a/lldb/NOTICE.TXT b/lldb/NOTICE.TXT
new file mode 100644
index 00000000000000..d814272967476e
--- /dev/null
+++ b/lldb/NOTICE.TXT
@@ -0,0 +1,7 @@
+
+This product contains small piece of code to support AIX, taken from netbsd.
+
+  * LICENSE:
+    * lldb/source/Host/common/LICENSE.aix-netbsd.txt (OpenSSL License)
+  * HOMEPAGE:
+    * https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/crypto/external/bsd/openssl/dist
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index a60921990cf775..a0f118a11984c2 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -299,7 +299,7 @@ endif()
 
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
-if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows")
+if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows|AIX")
   set(LLDB_CAN_USE_LLDB_SERVER ON)
 else()
   set(LLDB_CAN_USE_LLDB_SERVER OFF)
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 5589c1c9a350dc..3829386562795c 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -196,6 +196,9 @@ class Module : public std::enable_shared_from_this<Module>,
   bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset,
                       bool &changed);
 
+  bool SetLoadAddressByType(Target &target, lldb::addr_t value,
+                            bool value_is_offset, bool &changed, int type_id);
+
   /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
   ///
   /// \see SymbolContextScope
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 4cbbbfa8a26e13..4fe06412b6b0b8 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -21,6 +21,7 @@
 
 #include <mutex>
 #include <vector>
+#include <string.h>
 
 namespace lldb_private {
 
@@ -41,8 +42,26 @@ class ModuleSpec {
   }
 
   ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
-      : m_file(file_spec), m_arch(arch), m_object_offset(0),
-        m_object_size(FileSystem::Instance().GetByteSize(file_spec)) {}
+      : m_arch(arch), m_object_offset(0) {
+    // parse object inside module format for example: /usr/ccs/lib/libc.a(shr_64.o)
+    llvm::SmallString<256> path_with_object;
+    file_spec.GetPath(path_with_object);
+    if (strstr(path_with_object.c_str(), "(") != nullptr) {
+      char *part;
+      char *str = (char *)path_with_object.c_str();
+      part = strtok(str, "()");
+      assert(part);
+      llvm::StringRef file_name(part);
+      part = strtok(nullptr, "()");
+      assert(part);
+      m_object_name = ConstString(part);
+      m_file = FileSpec(file_name);
+      m_object_size = FileSystem::Instance().GetByteSize(m_file);
+    } else {
+      m_file = file_spec;
+      m_object_size = FileSystem::Instance().GetByteSize(file_spec);
+    }
+  }
 
   FileSpec *GetFileSpecPtr() { return (m_file ? &m_file : nullptr); }
 
diff --git a/lldb/include/lldb/Host/HostGetOpt.h b/lldb/include/lldb/Host/HostGetOpt.h
index 52cfdf4dbb89c2..f450e561d6afb1 100644
--- a/lldb/include/lldb/Host/HostGetOpt.h
+++ b/lldb/include/lldb/Host/HostGetOpt.h
@@ -9,7 +9,7 @@
 #ifndef LLDB_HOST_HOSTGETOPT_H
 #define LLDB_HOST_HOSTGETOPT_H
 
-#if !defined(_MSC_VER) && !defined(__NetBSD__)
+#if !defined(_MSC_VER) && !defined(__NetBSD__) && !defined(__AIX__)
 
 #include <getopt.h>
 #include <unistd.h>
diff --git a/lldb/include/lldb/Host/HostInfo.h b/lldb/include/lldb/Host/HostInfo.h
index b7010d69d88e7f..156df8cf6901df 100644
--- a/lldb/include/lldb/Host/HostInfo.h
+++ b/lldb/include/lldb/Host/HostInfo.h
@@ -55,6 +55,9 @@
 #elif defined(__APPLE__)
 #include "lldb/Host/macosx/HostInfoMacOSX.h"
 #define HOST_INFO_TYPE HostInfoMacOSX
+#elif defined(__AIX__)
+#include "lldb/Host/aix/HostInfoAIX.h"
+#define HOST_INFO_TYPE HostInfoAIX
 #else
 #include "lldb/Host/posix/HostInfoPosix.h"
 #define HOST_INFO_TYPE HostInfoPosix
diff --git a/lldb/include/lldb/Host/HostInfoBase.h b/lldb/include/lldb/Host/HostInfoBase.h
index 705aad559f3b78..29e6acf39bfb24 100644
--- a/lldb/include/lldb/Host/HostInfoBase.h
+++ b/lldb/include/lldb/Host/HostInfoBase.h
@@ -149,6 +149,7 @@ class HostInfoBase {
     return {};
   }
 
+  static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
   /// Returns the distribution id of the host
   ///
   /// This will be something like "ubuntu", "fedora", etc. on Linux.
@@ -158,7 +159,6 @@ class HostInfoBase {
   static llvm::StringRef GetDistributionId() { return llvm::StringRef(); }
 
 protected:
-  static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
   static bool ComputeSupportExeDirectory(FileSpec &file_spec);
   static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
   static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
diff --git a/lldb/include/lldb/Host/XML.h b/lldb/include/lldb/Host/XML.h
index da0f9cd7aa8c06..cf359f7726d5d6 100644
--- a/lldb/include/lldb/Host/XML.h
+++ b/lldb/include/lldb/Host/XML.h
@@ -11,6 +11,11 @@
 
 #include "lldb/Host/Config.h"
 
+#if defined(__AIX__)
+//FIXME for AIX
+#undef LLDB_ENABLE_LIBXML2
+#endif
+
 #if LLDB_ENABLE_LIBXML2
 #include <libxml/xmlreader.h>
 #endif
diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h
new file mode 100644
index 00000000000000..78a567a6b90953
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/AbstractSocket.h
@@ -0,0 +1,25 @@
+//===-- AbstractSocket.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 liblldb_AbstractSocket_h_
+#define liblldb_AbstractSocket_h_
+
+#include "lldb/Host/posix/DomainSocket.h"
+
+namespace lldb_private {
+class AbstractSocket : public DomainSocket {
+public:
+  AbstractSocket(bool child_processes_inherit);
+
+protected:
+  size_t GetNameOffset() const override;
+  void DeleteSocketFile(llvm::StringRef name) override;
+};
+}
+
+#endif // ifndef liblldb_AbstractSocket_h_
diff --git a/lldb/include/lldb/Host/aix/Host.h b/lldb/include/lldb/Host/aix/Host.h
new file mode 100644
index 00000000000000..1e3487752995fb
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Host.h
@@ -0,0 +1,22 @@
+//===-- Host.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_HOST_AIX_HOST_H
+#define LLDB_HOST_AIX_HOST_H
+
+#include "lldb/lldb-types.h"
+#include <optional>
+
+namespace lldb_private {
+
+// Get PID (i.e. the primary thread ID) corresponding to the specified TID.
+std::optional<lldb::pid_t> getPIDForTID(lldb::pid_t tid);
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_HOST_AIX_HOST_H
diff --git a/lldb/include/lldb/Host/aix/HostInfoAIX.h b/lldb/include/lldb/Host/aix/HostInfoAIX.h
new file mode 100644
index 00000000000000..ced4cf34d38a81
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/HostInfoAIX.h
@@ -0,0 +1,42 @@
+//===-- HostInfoAIX.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_Host_aix_HostInfoAIX_h_
+#define lldb_Host_aix_HostInfoAIX_h_
+
+#include "lldb/Host/posix/HostInfoPosix.h"
+#include "lldb/Utility/FileSpec.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/VersionTuple.h"
+
+#include <string>
+
+namespace lldb_private {
+
+class HostInfoAIX : public HostInfoPosix {
+  friend class HostInfoBase;
+
+public:
+  static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr);
+  static void Terminate();
+
+  static llvm::VersionTuple GetOSVersion();
+  static std::optional<std::string> GetOSBuildString();
+  static llvm::StringRef GetDistributionId();
+  static FileSpec GetProgramFileSpec();
+
+protected:
+  static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+  static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+  static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+  static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+                                             ArchSpec &arch_64);
+};
+}
+
+#endif
diff --git a/lldb/include/lldb/Host/aix/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
new file mode 100644
index 00000000000000..88928f18102d7c
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -0,0 +1,62 @@
+//===-- 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)
+#endif
+#ifndef PTRACE_SETREGS
+#define PTRACE_SETREGS          (PT_COMMAND_MAX+2)
+#endif
+#ifndef PTRACE_GETFPREGS
+#define PTRACE_GETFPREGS        (PT_COMMAND_MAX+3)
+#endif
+#ifndef PTRACE_SETFPREGS
+#define PTRACE_SETFPREGS        (PT_COMMAND_MAX+4)
+#endif
+#ifndef PTRACE_GETREGSET
+#define PTRACE_GETREGSET 0x4204
+#endif
+#ifndef PTRACE_SETREGSET
+#define PTRACE_SETREGSET 0x4205
+#endif
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA  (PT_COMMAND_MAX+5)
+#endif
+#ifndef PTRACE_ARCH_PRCTL
+#define PTRACE_ARCH_PRCTL       (PT_COMMAND_MAX+6)
+#endif
+#ifndef ARCH_GET_FS
+#define ARCH_SET_GS 0x1001
+#define ARCH_SET_FS 0x1002
+#define ARCH_GET_FS 0x1003
+#define ARCH_GET_GS 0x1004
+#endif
+#ifndef PTRACE_PEEKMTETAGS
+#define PTRACE_PEEKMTETAGS      (PT_COMMAND_MAX+7)
+#endif
+#ifndef PTRACE_POKEMTETAGS
+#define PTRACE_POKEMTETAGS      (PT_COMMAND_MAX+8)
+#endif
+#ifndef PTRACE_GETVRREGS
+#define PTRACE_GETVRREGS        (PT_COMMAND_MAX+9)
+#endif
+#ifndef PTRACE_GETVSRREGS
+#define PTRACE_GETVSRREGS       (PT_COMMAND_MAX+10)
+#endif
+
+#endif // liblldb_Host_aix_Ptrace_h_
diff --git a/lldb/include/lldb/Host/aix/Support.h b/lldb/include/lldb/Host/aix/Support.h
new file mode 100644
index 00000000000000..27d6c2b50a35b0
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Support.h
@@ -0,0 +1,29 @@
+//===-- Support.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_HOST_AIX_SUPPORT_H
+#define LLDB_HOST_AIX_SUPPORT_H
+
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include <memory>
+
+namespace lldb_private {
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file);
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(::pid_t pid, const llvm::Twine &file);
+
+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
+getProcFile(const llvm::Twine &file);
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_HOST_AIX_SUPPORT_H
diff --git a/lldb/include/lldb/Host/aix/Uio.h b/lldb/include/lldb/Host/aix/Uio.h
new file mode 100644
index 00000000000000..acf79ecc6a1d0d
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Uio.h
@@ -0,0 +1,23 @@
+//===-- Uio.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 liblldb_Host_aix_Uio_h_
+#define liblldb_Host_aix_Uio_h_
+
+#include "lldb/Host/Config.h"
+#include <sys/uio.h>
+
+// We shall provide our own implementation of process_vm_readv if it is not
+// present
+#if !HAVE_PROCESS_VM_READV
+ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
+                         unsigned long liovcnt, const struct iovec *remote_iov,
+                         unsigned long riovcnt, unsigned long flags);
+#endif
+
+#endif // liblldb_Host_aix_Uio_h_
diff --git a/lldb/include/lldb/Host/common/GetOptInc.h b/lldb/include/lldb/Host/common/GetOptInc.h
index 3fb9add4795417..ebb475bfaf6b8d 100644
--- a/lldb/include/lldb/Host/common/GetOptInc.h
+++ b/lldb/include/lldb/Host/common/GetOptInc.h
@@ -11,11 +11,11 @@
 
 #include "lldb/lldb-defines.h"
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__AIX__)
 #define REPLACE_GETOPT
 #define REPLACE_GETOPT_LONG
 #endif
-#if defined(_MSC_VER) || defined(__NetBSD__)
+#if defined(_MSC_VER) || defined(__NetBSD__) || defined(__AIX__)
 #define REPLACE_GETOPT_LONG_ONLY
 #endif
 
@@ -35,7 +35,7 @@ struct option {
   int val;
 };
 
-int getopt(int argc, char *const argv[], const char *optstring);
+int getopt(int argc, char *const argv[], const char *optstring) throw();
 
 // from getopt.h
 extern char *optarg;
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index 8592323322e383..bf66ccec263d24 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -401,6 +401,11 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
     return false;
   }
 
+  virtual bool SetLoadAddressByType(Target &target, lldb::addr_t value,
+                              bool value_is_offset, int type_id) {
+    return false;
+  }
+
   /// Gets whether endian swapping should occur when extracting data from this
   /// object file.
   ///
diff --git a/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h
index 7b646d743346b7..281a89951ef885 100644
--- a/lldb/include/lldb/Target/ABI.h
+++ b/lldb/include/lldb/Target/ABI.h
@@ -47,6 +47,12 @@ class ABI : public PluginInterface {
                                   lldb::addr_t returnAddress,
                                   llvm::ArrayRef<lldb::addr_t> args) const = 0;
 
+  virtual bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
+                                  lldb::addr_t functionAddress,
+                                  lldb::addr_t tocAddress,
+                                  lldb::addr_t returnAddress,
+                                  llvm::ArrayRef<lldb::addr_t> args) const;
+
   // Prepare trivial call used from ThreadPlanFunctionCallUsingABI
   // AD:
   //  . Because i don't want to change other ABI's this is not declared pure
diff --git a/lldb/include/lldb/Target/DynamicLoader.h b/lldb/include/lldb/Target/DynamicLoader.h
index 0629e2faae7e9e..7dccd317c2dca1 100644
--- a/lldb/include/lldb/Target/DynamicLoader.h
+++ b/lldb/include/lldb/Target/DynamicLoader.h
@@ -359,6 +359,12 @@ class DynamicLoader : public PluginInterface {
                                     lldb::addr_t base_addr,
                                     bool base_addr_is_offset);
 
+  virtual void UpdateLoadedSectionsByType(lldb::ModuleSP module,
+                                    lldb::addr_t link_map_addr,
+                                    lldb::addr_t base_addr,
+                                    bool base_addr_is_offset,
+                                    int type_id);
+
   // Utility method so base classes can share implementation of
   // UpdateLoadedSections
   void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr,
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index cf16fbc812aa48..886ca766112c8d 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -63,6 +63,10 @@
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/VersionTuple.h"
 
+#if defined(__AIX__)
+struct ld_xinfo;
+#endif
+
 namespace lldb_private {
 
 template <typename B, typename S> struct Range;
@@ -1915,6 +1919,10 @@ class Process : public std::enable_shared_from_this<Process>,
   Status GetMemoryRegionInfo(lldb::addr_t load_addr,
                              MemoryRegionInfo &range_info);
 
+#if defined(__AIX__)
+  Status GetLDXINFO(struct ld_xinfo *info_ptr);
+#endif
+
   /// Obtain all the mapped memory regions within this process.
   ///
   /// \param[out] region_list
@@ -2855,6 +2863,12 @@ void PruneThreadPlans();
     return Status("Process::DoGetMemoryRegionInfo() not supported");
   }
 
+#if defined(__AIX__)
+  virtual Status DoGetLDXINFO(struct ld_xinfo *info_ptr) {
+    return Status("Process::DoGetLDXINFO() not supported");
+  }
+#endif
+
   /// Provide an override value in the subclass for lldb's
   /// CPU-based logic for whether watchpoint exceptions are
   /// received before or after an instruction executes.
diff --git a/lldb/include/lldb/Target/RegisterContextUnwind.h b/lldb/include/lldb/Target/RegisterContextUnwind.h
index ef8ae884038663..00a95853800edd 100644
--- a/lldb/include/lldb/Target/RegisterContextUnwind.h
+++ b/lldb/include/lldb/Target/RegisterContextUnwind.h
@@ -67,6 +67,10 @@ class RegisterContextUnwind : public lldb_private::RegisterContext {
 
   bool ReadPC(lldb::addr_t &start_pc);
 
+#ifdef __AIX__
+  bool ReadLR(lldb::addr_t &lr);
+#endif
+
   // Indicates whether this frame *behaves* like frame zero -- the currently
   // executing frame -- or not.  This can be true in the middle of the stack
   // above asynchronous trap handlers (sigtramp) for instance.
diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index cb6e7caebb4adf..7880db1592e04a 100644
--- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -27,6 +27,12 @@ class ThreadPlanCallFunction : public ThreadPlan {
                          llvm::ArrayRef<lldb::addr_t> args,
                          const EvaluateExpressionOptions &options);
 
+  ThreadPlanCallFunction(Thread &thread, const Address &function,
+                         const Address &toc,
+                 ...
[truncated]

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth putting the PR into draft mode just to be extra clear this is a request for early feedback.

This PR will be later split up of course, so very general comments from me. Very impressive effort overall.

@@ -38,6 +38,10 @@ endif()
include(LLDBConfig)
include(AddLLDB)

if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
add_definitions("-D__AIX__")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a macro that a compiler might set for you, is that not the case here?

Copy link
Collaborator

@DavidSpickett DavidSpickett Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also remember that users may be debugging AIX from a non-AIX host where the compiler would not be setting any macros like that.

(perhaps this is exactly why you defined this manually, just to get it working on AIX only as the first step)

This product contains small piece of code to support AIX, taken from netbsd.

* LICENSE:
* lldb/source/Host/common/LICENSE.aix-netbsd.txt (OpenSSL License)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to confirm license compatibility for this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if there is a way not to pull in this code, we're likely going to prefer that.

@@ -11,6 +11,11 @@

#include "lldb/Host/Config.h"

#if defined(__AIX__)
//FIXME for AIX
#undef LLDB_ENABLE_LIBXML2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory if you configure with -DLLDB_ENABLE_LIBXML2=OFF, the libxml2 parts will be removed. Was something else being included despite that?

#define ARCH_GET_GS 0x1004
#endif
#ifndef PTRACE_PEEKMTETAGS
#define PTRACE_PEEKMTETAGS (PT_COMMAND_MAX+7)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny seeing this here, I worked on lldb's MTE support for AArch64. Does AIX support a memory tagging feature as well?

If so I'd be quite interested to see how it fits into the memory tagging support code. I tried to make it generic but when you've only got one implementation, you never know if it's truly flexible or not.

#ifdef __AIX__
bool ReadLR(lldb::addr_t &lr);
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's likely we'd ask you to make this a method on all platforms that is only called on, or implemented for, AIX.

@@ -40,6 +40,113 @@ add_custom_target(lldb-sbapi-dwarf-enums
DEPENDS ${sb_languages_file})
set_target_properties(lldb-sbapi-dwarf-enums PROPERTIES FOLDER "LLDB/Tablegenning")

if(CMAKE_SYSTEM_NAME MATCHES "AIX")
add_lldb_library(liblldb STATIC ${option_framework}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure we can find a way to refactor this, deal with that later, but is there a reason that it needs to be static? Is this a property of libraries on AIX perhaps.

I know we had someone wanting to build a static library elsewhere but I'm not sure if it was this one.

@@ -342,7 +342,7 @@ uint32_t SBBreakpoint::GetIgnoreCount() const {
return count;
}

void SBBreakpoint::SetThreadID(tid_t tid) {
void SBBreakpoint::SetThreadID(lldb::tid_t tid) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these lldb:: are fixing compilation errors they would be welcome as a separate patch.

return true;
} else {
changed = false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip for later PRs, https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

(but don't bother with style changes at this point of course)

@bzEq bzEq requested a review from orcguru August 12, 2024 01:52
@DhruvSrivastavaX DhruvSrivastavaX marked this pull request as draft August 12, 2024 08:18
DavidSpickett pushed a commit that referenced this pull request Aug 20, 2024
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.  #101657 

The complete changes for porting are present in this draft PR:
#102601

The changes on this PR are intended to avoid namespace collision for
certain typedefs between lldb and other platforms:
1. tid_t --> lldb::tid_t
2. offset_t --> lldb::offset_t
DavidSpickett pushed a commit that referenced this pull request Aug 22, 2024
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. #101657 

The complete changes for porting are present in this draft PR:
#102601 

The changes in this PR are intended to update the Architecture entry for
LLDB with XCOFF,PPC.

1. Added new ArchitectureType `eArchTypeXCOFF`
2. Added a new `ArchDefinitionEntry g_xcoff_arch_entries[]`
3. Added a new case for `XCOFF in ArchSpec::SetArchitecture(..)`
4. Updated `ArchDefinition *g_arch_definitions[]`
Lakshmi Surekha Kovvuri added 2 commits August 22, 2024 08:49
cjdb pushed a commit to cjdb/llvm-project that referenced this pull request Aug 23, 2024
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. llvm#101657 

The complete changes for porting are present in this draft PR:
llvm#102601 

The changes in this PR are intended to update the Architecture entry for
LLDB with XCOFF,PPC.

1. Added new ArchitectureType `eArchTypeXCOFF`
2. Added a new `ArchDefinitionEntry g_xcoff_arch_entries[]`
3. Added a new case for `XCOFF in ArchSpec::SetArchitecture(..)`
4. Updated `ArchDefinition *g_arch_definitions[]`
Copy link

github-actions bot commented Aug 30, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff c3d3cef8d58377b02032b07b5f094a402a70435a c357357352ee860404a8bce16ca6d11b13ef8c1f --extensions h,cpp -- lldb/include/lldb/Host/aix/AbstractSocket.h lldb/include/lldb/Host/aix/Host.h lldb/include/lldb/Host/aix/HostInfoAIX.h lldb/include/lldb/Host/aix/Ptrace.h lldb/include/lldb/Host/aix/Support.h lldb/include/lldb/Host/aix/Uio.h lldb/source/Host/aix/AbstractSocket.cpp lldb/source/Host/aix/Host.cpp lldb/source/Host/aix/HostInfoAIX.cpp lldb/source/Host/aix/Support.cpp lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp lldb/source/Plugins/Platform/AIX/PlatformAIX.h lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp lldb/source/Plugins/Process/AIX/NativeProcessAIX.h lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp lldb/source/Plugins/Process/AIX/NativeThreadAIX.h clang/lib/CodeGen/CGObjCMac.cpp lldb/include/lldb/Core/Module.h lldb/include/lldb/Core/ModuleSpec.h lldb/include/lldb/Host/HostGetOpt.h lldb/include/lldb/Host/HostInfo.h lldb/include/lldb/Host/HostInfoBase.h lldb/include/lldb/Host/XML.h lldb/include/lldb/Host/common/GetOptInc.h lldb/include/lldb/Symbol/ObjectFile.h lldb/include/lldb/Target/ABI.h lldb/include/lldb/Target/DynamicLoader.h lldb/include/lldb/Target/Process.h lldb/include/lldb/Target/RegisterContextUnwind.h lldb/include/lldb/Target/ThreadPlanCallFunction.h lldb/include/lldb/Utility/StringExtractorGDBRemote.h lldb/source/Core/DynamicLoader.cpp lldb/source/Core/Mangled.cpp lldb/source/Core/Module.cpp lldb/source/Core/Section.cpp lldb/source/Host/common/GetOptInc.cpp lldb/source/Host/common/Host.cpp lldb/source/Host/common/XML.cpp lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/source/Host/posix/FileSystemPosix.cpp lldb/source/Host/posix/MainLoopPosix.cpp lldb/source/Host/posix/ProcessLauncherPosixFork.cpp lldb/source/Initialization/SystemInitializerCommon.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/Language/ObjC/Cocoa.cpp lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/source/Target/ABI.cpp lldb/source/Target/Process.cpp lldb/source/Target/RegisterContextUnwind.cpp lldb/source/Target/ThreadPlanCallFunction.cpp lldb/source/Target/UnwindLLDB.cpp lldb/source/Utility/ArchSpec.cpp lldb/source/Utility/StringExtractorGDBRemote.cpp lldb/tools/driver/Driver.cpp lldb/tools/lldb-server/SystemInitializerLLGS.cpp lldb/tools/lldb-server/lldb-gdbserver.cpp lldb/unittests/Host/MainLoopTest.cpp lldb/unittests/Host/PipeTest.cpp lldb/unittests/Host/posix/TerminalTest.cpp llvm/include/llvm/Object/XCOFFObjectFile.h llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
View the diff from clang-format here.
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 4fe06412b6..ddf35ed25e 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -20,8 +20,8 @@
 #include "llvm/Support/Chrono.h"
 
 #include <mutex>
-#include <vector>
 #include <string.h>
+#include <vector>
 
 namespace lldb_private {
 
@@ -43,7 +43,8 @@ public:
 
   ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
       : m_arch(arch), m_object_offset(0) {
-    // parse object inside module format for example: /usr/ccs/lib/libc.a(shr_64.o)
+    // parse object inside module format for example:
+    // /usr/ccs/lib/libc.a(shr_64.o)
     llvm::SmallString<256> path_with_object;
     file_spec.GetPath(path_with_object);
     if (strstr(path_with_object.c_str(), "(") != nullptr) {
diff --git a/lldb/include/lldb/Host/XML.h b/lldb/include/lldb/Host/XML.h
index cf359f7726..7c88f558a5 100644
--- a/lldb/include/lldb/Host/XML.h
+++ b/lldb/include/lldb/Host/XML.h
@@ -12,7 +12,7 @@
 #include "lldb/Host/Config.h"
 
 #if defined(__AIX__)
-//FIXME for AIX
+// FIXME for AIX
 #undef LLDB_ENABLE_LIBXML2
 #endif
 
diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h
index 78a567a6b9..f8741c99ae 100644
--- a/lldb/include/lldb/Host/aix/AbstractSocket.h
+++ b/lldb/include/lldb/Host/aix/AbstractSocket.h
@@ -20,6 +20,6 @@ protected:
   size_t GetNameOffset() const override;
   void DeleteSocketFile(llvm::StringRef name) override;
 };
-}
+} // namespace lldb_private
 
 #endif // ifndef liblldb_AbstractSocket_h_
diff --git a/lldb/include/lldb/Host/aix/HostInfoAIX.h b/lldb/include/lldb/Host/aix/HostInfoAIX.h
index ced4cf34d3..8f21379752 100644
--- a/lldb/include/lldb/Host/aix/HostInfoAIX.h
+++ b/lldb/include/lldb/Host/aix/HostInfoAIX.h
@@ -37,6 +37,6 @@ protected:
   static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
                                              ArchSpec &arch_64);
 };
-}
+} // namespace lldb_private
 
 #endif
diff --git a/lldb/include/lldb/Host/aix/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
index 88928f1810..72737fd9b1 100644
--- a/lldb/include/lldb/Host/aix/Ptrace.h
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -17,16 +17,16 @@
 
 // Support ptrace extensions even when compiled without required kernel support
 #ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS          (PT_COMMAND_MAX+1)
+#define PTRACE_GETREGS (PT_COMMAND_MAX + 1)
 #endif
 #ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS          (PT_COMMAND_MAX+2)
+#define PTRACE_SETREGS (PT_COMMAND_MAX + 2)
 #endif
 #ifndef PTRACE_GETFPREGS
-#define PTRACE_GETFPREGS        (PT_COMMAND_MAX+3)
+#define PTRACE_GETFPREGS (PT_COMMAND_MAX + 3)
 #endif
 #ifndef PTRACE_SETFPREGS
-#define PTRACE_SETFPREGS        (PT_COMMAND_MAX+4)
+#define PTRACE_SETFPREGS (PT_COMMAND_MAX + 4)
 #endif
 #ifndef PTRACE_GETREGSET
 #define PTRACE_GETREGSET 0x4204
@@ -35,10 +35,10 @@
 #define PTRACE_SETREGSET 0x4205
 #endif
 #ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA  (PT_COMMAND_MAX+5)
+#define PTRACE_GET_THREAD_AREA (PT_COMMAND_MAX + 5)
 #endif
 #ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL       (PT_COMMAND_MAX+6)
+#define PTRACE_ARCH_PRCTL (PT_COMMAND_MAX + 6)
 #endif
 #ifndef ARCH_GET_FS
 #define ARCH_SET_GS 0x1001
@@ -47,16 +47,16 @@
 #define ARCH_GET_GS 0x1004
 #endif
 #ifndef PTRACE_PEEKMTETAGS
-#define PTRACE_PEEKMTETAGS      (PT_COMMAND_MAX+7)
+#define PTRACE_PEEKMTETAGS (PT_COMMAND_MAX + 7)
 #endif
 #ifndef PTRACE_POKEMTETAGS
-#define PTRACE_POKEMTETAGS      (PT_COMMAND_MAX+8)
+#define PTRACE_POKEMTETAGS (PT_COMMAND_MAX + 8)
 #endif
 #ifndef PTRACE_GETVRREGS
-#define PTRACE_GETVRREGS        (PT_COMMAND_MAX+9)
+#define PTRACE_GETVRREGS (PT_COMMAND_MAX + 9)
 #endif
 #ifndef PTRACE_GETVSRREGS
-#define PTRACE_GETVSRREGS       (PT_COMMAND_MAX+10)
+#define PTRACE_GETVSRREGS (PT_COMMAND_MAX + 10)
 #endif
 
 #endif // liblldb_Host_aix_Ptrace_h_
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index 49be7bd88d..56b66830a3 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -402,7 +402,7 @@ public:
   }
 
   virtual bool SetLoadAddressByType(Target &target, lldb::addr_t value,
-                              bool value_is_offset, int type_id) {
+                                    bool value_is_offset, int type_id) {
     return false;
   }
 
diff --git a/lldb/include/lldb/Target/DynamicLoader.h b/lldb/include/lldb/Target/DynamicLoader.h
index 7dccd317c2..be41d440f1 100644
--- a/lldb/include/lldb/Target/DynamicLoader.h
+++ b/lldb/include/lldb/Target/DynamicLoader.h
@@ -360,10 +360,10 @@ protected:
                                     bool base_addr_is_offset);
 
   virtual void UpdateLoadedSectionsByType(lldb::ModuleSP module,
-                                    lldb::addr_t link_map_addr,
-                                    lldb::addr_t base_addr,
-                                    bool base_addr_is_offset,
-                                    int type_id);
+                                          lldb::addr_t link_map_addr,
+                                          lldb::addr_t base_addr,
+                                          bool base_addr_is_offset,
+                                          int type_id);
 
   // Utility method so base classes can share implementation of
   // UpdateLoadedSections
diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index 7880db1592..4925093c1c 100644
--- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -28,8 +28,7 @@ public:
                          const EvaluateExpressionOptions &options);
 
   ThreadPlanCallFunction(Thread &thread, const Address &function,
-                         const Address &toc,
-                         const CompilerType &return_type,
+                         const Address &toc, const CompilerType &return_type,
                          llvm::ArrayRef<lldb::addr_t> args,
                          const EvaluateExpressionOptions &options);
 
diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp
index ea43a7f98b..bb3280968b 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -114,13 +114,13 @@ void DynamicLoader::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr,
 }
 
 void DynamicLoader::UpdateLoadedSectionsByType(lldb::ModuleSP module,
-                                    lldb::addr_t link_map_addr,
-                                    lldb::addr_t base_addr,
-                                    bool base_addr_is_offset,
-                                    int type_id) {
+                                               lldb::addr_t link_map_addr,
+                                               lldb::addr_t base_addr,
+                                               bool base_addr_is_offset,
+                                               int type_id) {
   bool changed;
-  module->SetLoadAddressByType(m_process->GetTarget(), base_addr, base_addr_is_offset,
-                         changed, type_id);
+  module->SetLoadAddressByType(m_process->GetTarget(), base_addr,
+                               base_addr_is_offset, changed, type_id);
 }
 
 void DynamicLoader::UpdateLoadedSectionsCommon(ModuleSP module,
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 43c5b043ef..4bd1c75a6b 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -167,7 +167,7 @@ static char *GetItaniumDemangledStr(const char *M) {
            "Expected demangled_size to return length including trailing null");
   }
 
-#if !defined(__AIX__)  
+#if !defined(__AIX__)
   if (Log *log = GetLog(LLDBLog::Demangle)) {
     if (demangled_cstr)
       LLDB_LOGF(log, "demangled itanium: %s -> \"%s\"", M, demangled_cstr);
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 537f03233e..8d3b75f8c0 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1512,10 +1512,12 @@ bool Module::SetLoadAddress(Target &target, lldb::addr_t value,
 }
 
 bool Module::SetLoadAddressByType(Target &target, lldb::addr_t value,
-                            bool value_is_offset, bool &changed, int type_id) {
+                                  bool value_is_offset, bool &changed,
+                                  int type_id) {
   ObjectFile *object_file = GetObjectFile();
   if (object_file != nullptr) {
-    changed = object_file->SetLoadAddressByType(target, value, value_is_offset, type_id);
+    changed = object_file->SetLoadAddressByType(target, value, value_is_offset,
+                                                type_id);
     return true;
   } else {
     changed = false;
diff --git a/lldb/source/Host/aix/Host.cpp b/lldb/source/Host/aix/Host.cpp
index d82cb9049d..cf1343bdfb 100644
--- a/lldb/source/Host/aix/Host.cpp
+++ b/lldb/source/Host/aix/Host.cpp
@@ -161,7 +161,7 @@ static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) {
   if (len > 0) {
     ExePath.resize(len);
 
-    //FIXME: hack to get basename
+    // FIXME: hack to get basename
     struct stat statData;
 
     std::ostringstream oss;
@@ -170,12 +170,12 @@ static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) {
     assert(stat(oss.str().c_str(), &statData) == 0);
 
     const int fd = open(oss.str().c_str(), O_RDONLY);
-    assert (fd >= 0);
+    assert(fd >= 0);
 
     ssize_t readNum = read(fd, &psinfoData, sizeof(psinfoData));
-    assert (readNum >= 0);
+    assert(readNum >= 0);
 
-    close (fd);
+    close(fd);
   } else {
     LLDB_LOG(log, "failed to read link exe link for {0}: {1}", pid,
              Status(errno, eErrorTypePOSIX));
@@ -187,7 +187,8 @@ static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) {
   if (!PathRef.empty()) {
     process_info.GetExecutableFile().SetFile(PathRef, FileSpec::Style::native);
     ArchSpec arch_spec = ArchSpec();
-    arch_spec.SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE, llvm::Triple::AIX);
+    arch_spec.SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64,
+                              LLDB_INVALID_CPUTYPE, llvm::Triple::AIX);
     process_info.SetArchitecture(arch_spec);
   }
 }
diff --git a/lldb/source/Host/aix/HostInfoAIX.cpp b/lldb/source/Host/aix/HostInfoAIX.cpp
index 8bda09e017..646c26f517 100644
--- a/lldb/source/Host/aix/HostInfoAIX.cpp
+++ b/lldb/source/Host/aix/HostInfoAIX.cpp
@@ -197,7 +197,7 @@ bool HostInfoAIX::ComputeUserPluginsDirectory(FileSpec &file_spec) {
 }
 
 void HostInfoAIX::ComputeHostArchitectureSupport(ArchSpec &arch_32,
-                                                   ArchSpec &arch_64) {
+                                                 ArchSpec &arch_64) {
   HostInfoPosix::ComputeHostArchitectureSupport(arch_32, arch_64);
 
   const char *distribution_id = GetDistributionId().data();
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 94b1d0fd57..508f632487 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -364,47 +364,47 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) { return false; }
 extern char **p_xargv;
 
 /* Fix missing Dl_info & dladdr in AIX
- * The code is taken from netbsd.org (src/crypto/external/bsd/openssl/dist/crypto/dso/dso_dlfcn.c)
- * except strlcpy & strlcat (those are taken from openbsd.org (src/lib/libc/string))
+ * The code is taken from netbsd.org
+ * (src/crypto/external/bsd/openssl/dist/crypto/dso/dso_dlfcn.c) except strlcpy
+ * & strlcat (those are taken from openbsd.org (src/lib/libc/string))
  */
 /*-
  * See IBM's AIX Version 7.2, Technical Reference:
  *  Base Operating System and Extensions, Volume 1 and 2
  *  https://www.ibm.com/support/knowledgecenter/ssw_aix_72/com.ibm.aix.base/technicalreferences.htm
  */
-#include <sys/ldr.h>
 #include <errno.h>
+#include <sys/ldr.h>
 
 /* strlcpy:
  * Copy string src to buffer dst of size dsize.  At most dsize-1
  * chars will be copied.  Always NUL terminates (unless dsize == 0).
  * Returns strlen(src); if retval >= dsize, truncation occurred.
  */
-size_t strlcpy(char *dst, const char *src, size_t dsize)
-{
-    const char *osrc = src;
-    size_t nleft = dsize;
-
-    /* Copy as many bytes as will fit. */
-    if (nleft != 0) {
-        while (--nleft != 0) {
-            if ((*dst++ = *src++) == '\0') {
-                break;
-            }
-        }
+size_t strlcpy(char *dst, const char *src, size_t dsize) {
+  const char *osrc = src;
+  size_t nleft = dsize;
+
+  /* Copy as many bytes as will fit. */
+  if (nleft != 0) {
+    while (--nleft != 0) {
+      if ((*dst++ = *src++) == '\0') {
+        break;
+      }
     }
+  }
 
-    /* Not enough room in dst, add NUL and traverse rest of src. */
-    if (nleft == 0) {
-        if (dsize != 0) {
-            *dst = '\0';		/* NUL-terminate dst */
-        }
-        while (*src++) {
-            ;
-        }
+  /* Not enough room in dst, add NUL and traverse rest of src. */
+  if (nleft == 0) {
+    if (dsize != 0) {
+      *dst = '\0'; /* NUL-terminate dst */
     }
+    while (*src++) {
+      ;
+    }
+  }
 
-    return src - osrc - 1;	/* count does not include NUL */
+  return src - osrc - 1; /* count does not include NUL */
 }
 
 /* strlcat:
@@ -414,110 +414,108 @@ size_t strlcpy(char *dst, const char *src, size_t dsize)
  * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  * If retval >= dsize, truncation occurred.
  */
-size_t strlcat(char *dst, const char *src, size_t dsize)
-{
-    const char *odst = dst;
-    const char *osrc = src;
-    size_t n = dsize;
-    size_t dlen;
-
-    /* Find the end of dst and adjust bytes left but don't go past end. */
-    while (n-- != 0 && *dst != '\0') {
-        dst++;
-    }
-    dlen = dst - odst;
-    n = dsize - dlen;
+size_t strlcat(char *dst, const char *src, size_t dsize) {
+  const char *odst = dst;
+  const char *osrc = src;
+  size_t n = dsize;
+  size_t dlen;
+
+  /* Find the end of dst and adjust bytes left but don't go past end. */
+  while (n-- != 0 && *dst != '\0') {
+    dst++;
+  }
+  dlen = dst - odst;
+  n = dsize - dlen;
 
-    if (n-- == 0) {
-        return dlen + strlen(src);
-    }
-    while (*src != '\0') {
-        if (n != 0) {
-            *dst++ = *src;
-            n--;
-        }
-        src++;
+  if (n-- == 0) {
+    return dlen + strlen(src);
+  }
+  while (*src != '\0') {
+    if (n != 0) {
+      *dst++ = *src;
+      n--;
     }
-    *dst = '\0';
+    src++;
+  }
+  *dst = '\0';
 
-    return dlen + src - osrc;	/* count does not include NUL */
+  return dlen + src - osrc; /* count does not include NUL */
 }
 
 /* ~ 64 * (sizeof(struct ld_info) + _XOPEN_PATH_MAX + _XOPEN_NAME_MAX) */
-#  define DLFCN_LDINFO_SIZE 86976
+#define DLFCN_LDINFO_SIZE 86976
 typedef struct Dl_info {
-    const char *dli_fname;
+  const char *dli_fname;
 } Dl_info;
 /*
  * This dladdr()-implementation will also find the ptrgl (Pointer Glue) virtual
  * address of a function, which is just located in the DATA segment instead of
  * the TEXT segment.
  */
-static int dladdr(const void *ptr, Dl_info *dl)
-{
-    uintptr_t addr = (uintptr_t)ptr;
-    struct ld_info *ldinfos;
-    struct ld_info *next_ldi;
-    struct ld_info *this_ldi;
-
-    if ((ldinfos = (struct ld_info *)malloc(DLFCN_LDINFO_SIZE)) == NULL) {
-        dl->dli_fname = NULL;
-        return 0;
-    }
+static int dladdr(const void *ptr, Dl_info *dl) {
+  uintptr_t addr = (uintptr_t)ptr;
+  struct ld_info *ldinfos;
+  struct ld_info *next_ldi;
+  struct ld_info *this_ldi;
+
+  if ((ldinfos = (struct ld_info *)malloc(DLFCN_LDINFO_SIZE)) == NULL) {
+    dl->dli_fname = NULL;
+    return 0;
+  }
 
-    if ((loadquery(L_GETINFO, (void *)ldinfos, DLFCN_LDINFO_SIZE)) < 0) {
-        /*-
-         * Error handling is done through errno and dlerror() reading errno:
-         *  ENOMEM (ldinfos buffer is too small),
-         *  EINVAL (invalid flags),
-         *  EFAULT (invalid ldinfos ptr)
-         */
-        free((void *)ldinfos);
-        dl->dli_fname = NULL;
-        return 0;
-    }
-    next_ldi = ldinfos;
-
-    do {
-        this_ldi = next_ldi;
-        if (((addr >= (uintptr_t)this_ldi->ldinfo_textorg)
-             && (addr < ((uintptr_t)this_ldi->ldinfo_textorg +
-                         this_ldi->ldinfo_textsize)))
-            || ((addr >= (uintptr_t)this_ldi->ldinfo_dataorg)
-                && (addr < ((uintptr_t)this_ldi->ldinfo_dataorg +
-                            this_ldi->ldinfo_datasize)))) {
-            char *buffer = NULL;
-            char *member = NULL;
-            size_t buffer_sz;
-            size_t member_len;
-
-            buffer_sz = strlen(this_ldi->ldinfo_filename) + 1;
-            member = this_ldi->ldinfo_filename + buffer_sz;
-            if ((member_len = strlen(member)) > 0) {
-                buffer_sz += 1 + member_len + 1;
-            }
-            if ((buffer = (char *)malloc(buffer_sz)) != NULL) {
-                strlcpy(buffer, this_ldi->ldinfo_filename, buffer_sz);
-                if (member_len > 0) {
-                    /*
-                     * Need to respect a possible member name and not just
-                     * returning the path name in this case. See docs:
-                     * sys/ldr.h, loadquery() and dlopen()/RTLD_MEMBER.
-                     */
-                    strlcat(buffer, "(", buffer_sz);
-                    strlcat(buffer, member, buffer_sz);
-                    strlcat(buffer, ")", buffer_sz);
-                }
-                dl->dli_fname = buffer;
-            }
-            break;
-        } else {
-            next_ldi = (struct ld_info *)((uintptr_t)this_ldi +
-                                          this_ldi->ldinfo_next);
-        }
-    } while (this_ldi->ldinfo_next);
+  if ((loadquery(L_GETINFO, (void *)ldinfos, DLFCN_LDINFO_SIZE)) < 0) {
+    /*-
+     * Error handling is done through errno and dlerror() reading errno:
+     *  ENOMEM (ldinfos buffer is too small),
+     *  EINVAL (invalid flags),
+     *  EFAULT (invalid ldinfos ptr)
+     */
     free((void *)ldinfos);
-    return dl->dli_fname != NULL;
+    dl->dli_fname = NULL;
+    return 0;
+  }
+  next_ldi = ldinfos;
+
+  do {
+    this_ldi = next_ldi;
+    if (((addr >= (uintptr_t)this_ldi->ldinfo_textorg) &&
+         (addr <
+          ((uintptr_t)this_ldi->ldinfo_textorg + this_ldi->ldinfo_textsize))) ||
+        ((addr >= (uintptr_t)this_ldi->ldinfo_dataorg) &&
+         (addr <
+          ((uintptr_t)this_ldi->ldinfo_dataorg + this_ldi->ldinfo_datasize)))) {
+      char *buffer = NULL;
+      char *member = NULL;
+      size_t buffer_sz;
+      size_t member_len;
+
+      buffer_sz = strlen(this_ldi->ldinfo_filename) + 1;
+      member = this_ldi->ldinfo_filename + buffer_sz;
+      if ((member_len = strlen(member)) > 0) {
+        buffer_sz += 1 + member_len + 1;
+      }
+      if ((buffer = (char *)malloc(buffer_sz)) != NULL) {
+        strlcpy(buffer, this_ldi->ldinfo_filename, buffer_sz);
+        if (member_len > 0) {
+          /*
+           * Need to respect a possible member name and not just
+           * returning the path name in this case. See docs:
+           * sys/ldr.h, loadquery() and dlopen()/RTLD_MEMBER.
+           */
+          strlcat(buffer, "(", buffer_sz);
+          strlcat(buffer, member, buffer_sz);
+          strlcat(buffer, ")", buffer_sz);
+        }
+        dl->dli_fname = buffer;
+      }
+      break;
+    } else {
+      next_ldi =
+          (struct ld_info *)((uintptr_t)this_ldi + this_ldi->ldinfo_next);
+    }
+  } while (this_ldi->ldinfo_next);
+  free((void *)ldinfos);
+  return dl->dli_fname != NULL;
 }
 
 #endif
@@ -526,7 +524,8 @@ FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) {
   FileSpec module_filespec;
 #if !defined(__ANDROID__)
 #ifdef __AIX__
-  if (host_addr == reinterpret_cast<void *>(HostInfoBase::ComputeSharedLibraryDirectory)) {
+  if (host_addr ==
+      reinterpret_cast<void *>(HostInfoBase::ComputeSharedLibraryDirectory)) {
     // FIXME: AIX dladdr return "lldb" for this case
     if (p_xargv[0]) {
       module_filespec.SetFile(p_xargv[0], FileSpec::Style::native);
diff --git a/lldb/source/Host/posix/MainLoopPosix.cpp b/lldb/source/Host/posix/MainLoopPosix.cpp
index d1eba52791..4235af23f8 100644
--- a/lldb/source/Host/posix/MainLoopPosix.cpp
+++ b/lldb/source/Host/posix/MainLoopPosix.cpp
@@ -326,7 +326,7 @@ MainLoopPosix::RegisterSignal(int signo, const Callback &callback,
   // receive it. If using pselect/ppoll, we need to block it, and later unblock
   // it as a part of the system call.
 #if defined(__AIX__)
-  //FIXME: where is signal unblocked?
+  // FIXME: where is signal unblocked?
   ret = pthread_sigmask(SIG_UNBLOCK, &new_action.sa_mask, &old_set);
 #else
   ret = pthread_sigmask(HAVE_SYS_EVENT_H ? SIG_UNBLOCK : SIG_BLOCK,
diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
index d752a8ded9..714f87abeb 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
@@ -24,8 +24,7 @@ public:
                           llvm::ArrayRef<lldb::addr_t> args) const override;
 
   bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
-                          lldb::addr_t functionAddress,
-                          lldb::addr_t tocAddress,
+                          lldb::addr_t functionAddress, lldb::addr_t tocAddress,
                           lldb::addr_t returnAddress,
                           llvm::ArrayRef<lldb::addr_t> args) const override;
 
diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
index 6266397413..254a9601b5 100644
--- a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
@@ -23,7 +23,7 @@
 #endif
 
 /*#include "llvm/ADT/Triple.h"
-*/
+ */
 
 using namespace lldb;
 using namespace lldb_private;
@@ -48,7 +48,7 @@ llvm::StringRef DynamicLoaderAIXDYLD::GetPluginDescriptionStatic() {
 }
 
 DynamicLoader *DynamicLoaderAIXDYLD::CreateInstance(Process *process,
-                                                        bool force) {
+                                                    bool force) {
   bool should_create = force;
   if (!should_create) {
     const llvm::Triple &triple_ref =
@@ -64,14 +64,14 @@ DynamicLoader *DynamicLoaderAIXDYLD::CreateInstance(Process *process,
 }
 
 void DynamicLoaderAIXDYLD::OnLoadModule(lldb::ModuleSP module_sp,
-                                            const ModuleSpec module_spec,
-                                            lldb::addr_t module_addr) {
+                                        const ModuleSpec module_spec,
+                                        lldb::addr_t module_addr) {
 
   // Resolve the module unless we already have one.
   if (!module_sp) {
     Status error;
-    module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, 
-                                             true /* notify */, &error);
+    module_sp = m_process->GetTarget().GetOrCreateModule(
+        module_spec, true /* notify */, &error);
     if (error.Fail())
       return;
   }
@@ -119,17 +119,17 @@ lldb::addr_t DynamicLoaderAIXDYLD::GetLoadAddress(ModuleSP executable) {
   }
 
   //// Hack to try set breakpoint
-  //Breakpoint *dyld_break = m_process->GetTarget().CreateBreakpoint(0x100000638, true, false).get();
-  //dyld_break->SetCallback(DynamicLoaderAIXDYLD::NotifyBreakpointHit, this, true);
-  //dyld_break->SetBreakpointKind("hack-debug");
+  // Breakpoint *dyld_break =
+  // m_process->GetTarget().CreateBreakpoint(0x100000638, true, false).get();
+  // dyld_break->SetCallback(DynamicLoaderAIXDYLD::NotifyBreakpointHit, this,
+  // true); dyld_break->SetBreakpointKind("hack-debug");
 
   return LLDB_INVALID_ADDRESS;
 }
 
 bool DynamicLoaderAIXDYLD::NotifyBreakpointHit(
     void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
-    lldb::user_id_t break_loc_id) {
-}
+    lldb::user_id_t break_loc_id) {}
 
 void DynamicLoaderAIXDYLD::DidAttach() {
   Log *log = GetLog(LLDBLog::DynamicLoader);
@@ -184,9 +184,12 @@ void DynamicLoaderAIXDYLD::DidAttach() {
       }
       FileSpec file(pathWithMember);
       ModuleSpec module_spec(file, m_process->GetTarget().GetArchitecture());
-      if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, true /* notify */)) {
-        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
-        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
+      if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(
+              module_spec, true /* notify */)) {
+        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+                                   (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
+        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+                                   (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
         // FIXME: .tdata, .bss
       }
     } else {
@@ -245,9 +248,12 @@ void DynamicLoaderAIXDYLD::DidLaunch() {
       }
       FileSpec file(pathWithMember);
       ModuleSpec module_spec(file, m_process->GetTarget().GetArchitecture());
-      if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, true /* notify */)) {
-        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
-        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
+      if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(
+              module_spec, true /* notify */)) {
+        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+                                   (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
+        UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+                                   (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
         // FIXME: .tdata, .bss
       }
     } else {
@@ -264,9 +270,8 @@ void DynamicLoaderAIXDYLD::DidLaunch() {
 
 Status DynamicLoaderAIXDYLD::CanLoadImage() { return Status(); }
 
-ThreadPlanSP
-DynamicLoaderAIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
-                                                       bool stop) {
-  //FIXME
+ThreadPlanSP DynamicLoaderAIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
+                                                                bool stop) {
+  // FIXME
   return ThreadPlanSP();
 }
diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
index ae4b7aca66..c3a3006ef0 100644
--- a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
+++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
@@ -41,7 +41,10 @@ public:
 
   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
 
-  static bool NotifyBreakpointHit(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+  static bool NotifyBreakpointHit(void *baton,
+                                  StoppointCallbackContext *context,
+                                  lldb::user_id_t break_id,
+                                  lldb::user_id_t break_loc_id);
 
 protected:
   lldb::addr_t GetLoadAddress(lldb::ModuleSP executable);
diff --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
index d14ae2daeb..c491d00671 100644
--- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
+++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
@@ -147,10 +147,9 @@ EmulateInstructionPPC64::GetOpcodeForInstruction(uint32_t opcode) {
        "addi RT, RA, SI"},
       {0xfc000003, 0xe8000000, &EmulateInstructionPPC64::EmulateLD,
        "ld RT, DS(RA)"},
-//      {0xffff0003, 0x40820000, &EmulateInstructionPPC64::EmulateBNE,
-//       "bne TARGET"},
-      {0xfc000002, 0x48000000, &EmulateInstructionPPC64::EmulateB,
-       "b TARGET"},
+      //      {0xffff0003, 0x40820000, &EmulateInstructionPPC64::EmulateBNE,
+      //       "bne TARGET"},
+      {0xfc000002, 0x48000000, &EmulateInstructionPPC64::EmulateB, "b TARGET"},
       {0xfc000003, 0x48000002, &EmulateInstructionPPC64::EmulateBA,
        "ba TARGET"},
       {0xfc000003, 0x48000003, &EmulateInstructionPPC64::EmulateBLA,
@@ -412,7 +411,8 @@ bool EmulateInstructionPPC64::EmulateADDI(uint32_t opcode) {
   LLDB_LOG(log, "EmulateADDI: success!");
 
   // FIX the next-pc
-  uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+  uint64_t pc_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
   uint64_t next_pc = pc_value + 4;
   ctx.type = eContextAdjustPC;
   WriteRegisterUnsigned(ctx, eRegisterKindLLDB, gpr_pc_ppc64le, next_pc);
@@ -424,18 +424,25 @@ bool EmulateInstructionPPC64::EmulateBC(uint32_t opcode) {
   // FIXME:32bit M
   uint32_t M = 0;
   uint32_t target32 = Bits32(opcode, 15, 2) << 2;
-  uint64_t target = (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
+  uint64_t target =
+      (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
   uint32_t BO = Bits32(opcode, 25, 21);
   bool success;
-  uint64_t ctr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+  uint64_t ctr_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
   if ((~BO) & (1U << 2))
     ctr_value = ctr_value - 1;
-  bool ctr_ok = (bool)(BO & (1U << 2)) | ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
-  uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+  bool ctr_ok = (bool)(BO & (1U << 2)) |
+                ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
+  uint64_t cr_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
   uint32_t BI = Bits32(opcode, 20, 16);
-  bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+  bool cond_ok =
+      (bool)(BO & (1U << 4)) |
+      (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
 
-  uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+  uint64_t pc_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
   uint64_t next_pc = pc_value + 4;
   if (ctr_ok & cond_ok)
     next_pc = pc_value + target;
@@ -452,18 +459,25 @@ bool EmulateInstructionPPC64::EmulateBCA(uint32_t opcode) {
   // FIXME:32bit M
   uint32_t M = 0;
   uint32_t target32 = Bits32(opcode, 15, 2) << 2;
-  uint64_t target = (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
+  uint64_t target =
+      (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
   uint32_t BO = Bits32(opcode, 25, 21);
   bool success;
-  uint64_t ctr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+  uint64_t ctr_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
   if ((~BO) & (1U << 2))
     ctr_value = ctr_value - 1;
-  bool ctr_ok = (bool)(BO & (1U << 2)) | ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
-  uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+  bool ctr_ok = (bool)(BO & (1U << 2)) |
+                ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
+  uint64_t cr_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
   uint32_t BI = Bits32(opcode, 20, 16);
-  bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+  bool cond_ok =
+      (bool)(BO & (1U << 4)) |
+      (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
 
-  uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+  uint64_t pc_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
   uint64_t next_pc = pc_value + 4;
   if (ctr_ok & cond_ok)
     next_pc = target;
@@ -481,18 +495,25 @@ bool EmulateInstructionPPC64::EmulateBCLR(uint32_t opcode) {
   uint32_t M = 0;
   uint32_t BO = Bits32(opcode, 25, 21);
   bool success;
-  uint64_t ctr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+  uint64_t ctr_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
   if ((~BO) & (1U << 2))
     ctr_value = ctr_value - 1;
-  bool ctr_ok = (bool)(BO & (1U << 2)) | ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
-  uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+  bool ctr_ok = (bool)(BO & (1U << 2)) |
+                ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
+  uint64_t cr_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
   uint32_t BI = Bits32(opcode, 20, 16);
-  bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+  bool cond_ok =
+      (bool)(BO & (1U << 4)) |
+      (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
 
-  uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+  uint64_t pc_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
   uint64_t next_pc = pc_value + 4;
   if (ctr_ok & cond_ok) {
-    next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
+    next_pc =
+        ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
     next_pc &= ~((1UL << 2) - 1);
   }
 
@@ -509,19 +530,27 @@ bool EmulateInstructionPPC64::EmulateBCCTR(uint32_t opcode) {
   uint32_t M = 0;
   uint32_t BO = Bits32(opcode, 25, 21);
   bool success;
-  uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+  uint64_t cr_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
   uint32_t BI = Bits32(opcode, 20, 16);
-  bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+  bool cond_ok =
+      (bool)(BO & (1U << 4)) |
+      (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
 
   Log *log = GetLog(LLDBLog::Unwind);
-  uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+  uint64_t pc_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
   uint64_t next_pc = pc_value + 4;
   if (cond_ok) {
-    next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+    next_pc =
+        ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
     next_pc &= ~((1UL << 2) - 1);
     if (next_pc < 0x4000000) {
-      LLDB_LOGF(log, "EmulateBCCTR: next address %lx out of range, emulate by goto LR!");
-      next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
+      LLDB_LOGF(
+          log,
+          "EmulateBCCTR: next address %lx out of range, emulate by goto LR!");
+      next_pc =
+          ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
     }
   }
 
@@ -541,10 +570,12 @@ bool EmulateInstructionPPC64::EmulateBCTAR(uint32_t opcode) {
 
 bool EmulateInstructionPPC64::EmulateB(uint32_t opcode) {
   uint32_t target32 = Bits32(opcode, 25, 2) << 2;
-  uint64_t target = (uint64_t)target32 + ((target32 & 0x2000000) ? 0xfffffffffc000000UL : 0);
+  uint64_t target =
+      (uint64_t)target32 + ((target32 & 0x2000000) ? 0xfffffffffc000000UL : 0);
 
   bool success;
-  uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+  uint64_t pc_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
   uint64_t next_pc = pc_value + target;
 
   Context ctx;
@@ -559,7 +590,8 @@ bool EmulateInstructionPPC64::EmulateBA(uint32_t opcode) {
   Log *log = GetLog(LLDBLog::Unwind);
 
   bool success;
-  uint64_t next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
+  uint64_t next_pc =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
 
   Context ctx;
   ctx.type = eContextAdjustPC;
@@ -572,7 +604,8 @@ bool EmulateInstructionPPC64::EmulateBLA(uint32_t opcode) {
   Log *log = GetLog(LLDBLog::Unwind);
 
   bool success;
-  uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+  uint64_t pc_value =
+      ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
   uint64_t next_pc = pc_value + 4;
 
   Context ctx;
diff --git a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
index 050ad73f1d..07bf50a619 100644
--- a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
@@ -35,9 +35,9 @@ typedef struct ar_hdr {
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/Timer.h"
 
-#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Support/Chrono.h"
+#include "llvm/Support/MemoryBuffer.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -148,11 +148,15 @@ size_t ObjectContainerBigArchive::Archive::ParseObjects() {
   DataExtractor &data = m_data;
   std::string str;
   lldb::offset_t offset = 0;
-  str.assign((const char *)data.GetData(&offset, (sizeof(llvm::object::BigArchiveMagic) - 1)),
+  str.assign((const char *)data.GetData(
+                 &offset, (sizeof(llvm::object::BigArchiveMagic) - 1)),
              (sizeof(llvm::object::BigArchiveMagic) - 1));
   if (str == llvm::object::BigArchiveMagic) {
     llvm::Error err = llvm::Error::success();
-    llvm::object::BigArchive bigAr(llvm::MemoryBufferRef(toStringRef(m_data.GetData()), llvm::StringRef("")), err);
+    llvm::object::BigArchive bigAr(
+        llvm::MemoryBufferRef(toStringRef(m_data.GetData()),
+                              llvm::StringRef("")),
+        err);
     if (err)
       return 0;
 
@@ -168,10 +172,12 @@ size_t ObjectContainerBigArchive::Archive::ParseObjects() {
       if (!childNameOrErr)
         continue;
       obj.ar_name.SetCString(childNameOrErr->str().c_str());
-      llvm::Expected<llvm::sys::TimePoint<std::chrono::seconds>> lastModifiedOrErr = child.getLastModified();
+      llvm::Expected<llvm::sys::TimePoint<std::chrono::seconds>>
+          lastModifiedOrErr = child.getLastModified();
       if (!lastModifiedOrErr)
         continue;
-      obj.modification_time = (uint32_t)llvm::sys::toTimeT(*(lastModifiedOrErr));
+      obj.modification_time =
+          (uint32_t)llvm::sys::toTimeT(*(lastModifiedOrErr));
       llvm::Expected<unsigned> getUIDOrErr = child.getUID();
       if (!getUIDOrErr)
         continue;
@@ -180,7 +186,8 @@ size_t ObjectContainerBigArchive::Archive::ParseObjects() {
       if (!getGIDOrErr)
         continue;
       obj.gid = (uint16_t)*getGIDOrErr;
-      llvm::Expected<llvm::sys::fs::perms> getAccessModeOrErr = child.getAccessMode();
+      llvm::Expected<llvm::sys::fs::perms> getAccessModeOrErr =
+          child.getAccessMode();
       if (!getAccessModeOrErr)
         continue;
       obj.mode = (uint16_t)*getAccessModeOrErr;
@@ -388,8 +395,10 @@ ObjectContainer *ObjectContainerBigArchive::CreateInstance(
 
 bool ObjectContainerBigArchive::MagicBytesMatch(const DataExtractor &data) {
   uint32_t offset = 0;
-  const char *armag = (const char *)data.PeekData(offset, (sizeof(llvm::object::BigArchiveMagic) - 1));
-  if (armag && ::strncmp(armag, llvm::object::BigArchiveMagic, (sizeof(llvm::object::BigArchiveMagic) - 1)) == 0)
+  const char *armag = (const char *)data.PeekData(
+      offset, (sizeof(llvm::object::BigArchiveMagic) - 1));
+  if (armag && ::strncmp(armag, llvm::object::BigArchiveMagic,
+                         (sizeof(llvm::object::BigArchiveMagic) - 1)) == 0)
     return true;
   return false;
 }
@@ -464,7 +473,8 @@ size_t ObjectContainerBigArchive::GetModuleSpecifications(
     return 0;
 
   const size_t initial_count = specs.GetSize();
-  llvm::sys::TimePoint<> file_mod_time = FileSystem::Instance().GetModificationTime(file);
+  llvm::sys::TimePoint<> file_mod_time =
+      FileSystem::Instance().GetModificationTime(file);
   Archive::shared_ptr archive_sp(
       Archive::FindCachedArchive(file, ArchSpec(), file_mod_time, file_offset));
   bool set_archive_arch = false;
diff --git a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
index ad9b814048..b89472babf 100644
--- a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
+++ b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
@@ -101,8 +101,8 @@ protected:
 
     /// Length of the object data.
     lldb::offset_t file_size = 0;
-  
-	void Dump(lldb_private::Stream *s) const;
+
+    void Dump(lldb_private::Stream *s) const;
   };
 
   class Archive {
@@ -165,8 +165,8 @@ protected:
     std::vector<Object> m_objects;
     ObjectNameToIndexMap m_object_name_to_index_map;
     lldb_private::DataExtractor m_data; ///< The data for this object container
-                                        ///so we don't lose data if the .a files
-                                        ///gets modified
+                                        /// so we don't lose data if the .a
+                                        /// files gets modified
   };
 
   void SetArchive(Archive::shared_ptr &archive_sp);
diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
index 75cc54e4f0..c9aec799aa 100644
--- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
+++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
@@ -116,7 +116,7 @@ size_t ObjectFilePDB::GetModuleSpecifications(
   ModuleSpec module_spec(file);
   llvm::BumpPtrAllocator allocator;
   std::unique_ptr<PDBFile> pdb_file = loadPDBFile(file.GetPath(), allocator);
-  if (!pdb_file){
+  if (!pdb_file) {
 #if !defined(__AIX__)
     return initial_count;
 #else
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 519ce2ca4a..5aa9499726 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -253,7 +253,7 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
     lldb::offset_t data_offset, lldb::offset_t file_offset,
     lldb::offset_t length, lldb_private::ModuleSpecList &specs) {
   const size_t initial_count = specs.GetSize();
-  if (!data_sp || !ObjectFilePECOFF::MagicBytesMatch(data_sp)){
+  if (!data_sp || !ObjectFilePECOFF::MagicBytesMatch(data_sp)) {
 #if !defined(__AIX__)
     return initial_count;
 #else
@@ -280,7 +280,7 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
   }
 
   auto *COFFObj = llvm::dyn_cast<llvm::object::COFFObjectFile>(binary->get());
-  if (!COFFObj){
+  if (!COFFObj) {
 #if !defined(__AIX__)
     return initial_count;
 #else
diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
index a4d9ea295b..c6e7299420 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
@@ -1,4 +1,5 @@
-//===-- ObjectFileXCOFF.cpp -------------------------------------------------===//
+//===-- ObjectFileXCOFF.cpp
+//-------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -10,10 +11,9 @@
 
 #include <algorithm>
 #include <cassert>
-#include <unordered_map>
 #include <string.h>
+#include <unordered_map>
 
-#include "lldb/Utility/FileSpecList.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
@@ -23,11 +23,12 @@
 #include "lldb/Host/LZMA.h"
 #include "lldb/Symbol/DWARFCallFrameInfo.h"
 #include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/FileSpecList.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/RangeMap.h"
@@ -39,11 +40,11 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/Object/Decompressor.h"
+#include "llvm/Object/XCOFFObjectFile.h"
 #include "llvm/Support/CRC.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Object/XCOFFObjectFile.h"
 
 using namespace llvm;
 using namespace lldb;
@@ -69,11 +70,11 @@ void ObjectFileXCOFF::Terminate() {
 bool UGLY_FLAG_FOR_AIX __attribute__((weak)) = false;
 
 ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp,
-                                          DataBufferSP data_sp,
-                                          lldb::offset_t data_offset,
-                                          const lldb_private::FileSpec *file,
-                                          lldb::offset_t file_offset,
-                                          lldb::offset_t length) {
+                                            DataBufferSP data_sp,
+                                            lldb::offset_t data_offset,
+                                            const lldb_private::FileSpec *file,
+                                            lldb::offset_t file_offset,
+                                            lldb::offset_t length) {
   if (!data_sp) {
     data_sp = MapFileData(*file, length, file_offset);
     if (!data_sp)
@@ -101,7 +102,7 @@ ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp,
     return nullptr;
 
   if (!objfile_up->ParseHeader())
-    //FIXME objfile leak
+    // FIXME objfile leak
     return nullptr;
 
   UGLY_FLAG_FOR_AIX = true;
@@ -114,9 +115,10 @@ bool ObjectFileXCOFF::CreateBinary() {
 
   Log *log = GetLog(LLDBLog::Object);
 
-  auto binary = llvm::object::XCOFFObjectFile::createObjectFile(llvm::MemoryBufferRef(
-      toStringRef(m_data.GetData()), m_file.GetFilename().GetStringRef()),
-    file_magic::xcoff_object_64);
+  auto binary = llvm::object::XCOFFObjectFile::createObjectFile(
+      llvm::MemoryBufferRef(toStringRef(m_data.GetData()),
+                            m_file.GetFilename().GetStringRef()),
+      file_magic::xcoff_object_64);
   if (!binary) {
     LLDB_LOG_ERROR(log, binary.takeError(),
                    "Failed to create binary for file ({1}): {0}", m_file);
@@ -148,9 +150,12 @@ size_t ObjectFileXCOFF::GetModuleSpecifications(
   const size_t initial_count = specs.GetSize();
 
   if (ObjectFileXCOFF::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize())) {
-    ArchSpec arch_spec = ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
+    ArchSpec arch_spec =
+        ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
     ModuleSpec spec(file, arch_spec);
-    spec.GetArchitecture().SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE, llvm::Triple::AIX);
+    spec.GetArchitecture().SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64,
+                                           LLDB_INVALID_CPUTYPE,
+                                           llvm::Triple::AIX);
     specs.Append(spec);
   }
   return specs.GetSize() - initial_count;
@@ -158,10 +163,10 @@ size_t ObjectFileXCOFF::GetModuleSpecifications(
 
 static uint32_t XCOFFHeaderSizeFromMagic(uint32_t magic) {
   switch (magic) {
-  /* TODO: 32bit not supported yet
-  case XCOFF::XCOFF32:
-    return sizeof(struct llvm::object::XCOFFFileHeader32);
-  */
+    /* TODO: 32bit not supported yet
+    case XCOFF::XCOFF32:
+      return sizeof(struct llvm::object::XCOFFFileHeader32);
+    */
 
   case XCOFF::XCOFF64:
     return sizeof(struct llvm::object::XCOFFFileHeader64);
@@ -174,9 +179,9 @@ static uint32_t XCOFFHeaderSizeFromMagic(uint32_t magic) {
 }
 
 bool ObjectFileXCOFF::MagicBytesMatch(DataBufferSP &data_sp,
-                                    lldb::addr_t data_offset,
-                                    lldb::addr_t data_length) {
-  lldb_private::DataExtractor data; 
+                                      lldb::addr_t data_offset,
+                                      lldb::addr_t data_length) {
+  lldb_private::DataExtractor data;
   data.SetData(data_sp, data_offset, data_length);
   lldb::offset_t offset = 0;
   uint16_t magic = data.GetU16(&offset);
@@ -205,7 +210,7 @@ bool ObjectFileXCOFF::ParseHeader() {
 bool ObjectFileXCOFF::ParseXCOFFHeader(lldb_private::DataExtractor &data,
                                        lldb::offset_t *offset_ptr,
                                        xcoff_header_t &xcoff_header) {
-  //FIXME: data.ValidOffsetForDataOfSize
+  // FIXME: data.ValidOffsetForDataOfSize
   xcoff_header.magic = data.GetU16(offset_ptr);
   xcoff_header.nsects = data.GetU16(offset_ptr);
   xcoff_header.modtime = data.GetU32(offset_ptr);
@@ -216,10 +221,10 @@ bool ObjectFileXCOFF::ParseXCOFFHeader(lldb_private::DataExtractor &data,
   return true;
 }
 
-bool ObjectFileXCOFF::ParseXCOFFOptionalHeader(lldb_private::DataExtractor &data,
-                                               lldb::offset_t *offset_ptr) {
+bool ObjectFileXCOFF::ParseXCOFFOptionalHeader(
+    lldb_private::DataExtractor &data, lldb::offset_t *offset_ptr) {
   lldb::offset_t init_offset = *offset_ptr;
-  //FIXME: data.ValidOffsetForDataOfSize
+  // FIXME: data.ValidOffsetForDataOfSize
   m_xcoff_aux_header.AuxMagic = data.GetU16(offset_ptr);
   m_xcoff_aux_header.Version = data.GetU16(offset_ptr);
   m_xcoff_aux_header.ReservedForDebugger = data.GetU32(offset_ptr);
@@ -256,18 +261,18 @@ bool ObjectFileXCOFF::ParseXCOFFOptionalHeader(lldb_private::DataExtractor &data
   return true;
 }
 
-bool ObjectFileXCOFF::ParseSectionHeaders(
-    uint32_t section_header_data_offset) {
+bool ObjectFileXCOFF::ParseSectionHeaders(uint32_t section_header_data_offset) {
   const uint32_t nsects = m_xcoff_header.nsects;
   m_sect_headers.clear();
 
   if (nsects > 0) {
-    const size_t section_header_byte_size = nsects * m_binary->getSectionHeaderSize();
+    const size_t section_header_byte_size =
+        nsects * m_binary->getSectionHeaderSize();
     lldb_private::DataExtractor section_header_data =
         ReadImageData(section_header_data_offset, section_header_byte_size);
 
     lldb::offset_t offset = 0;
-    //FIXME: section_header_data.ValidOffsetForDataOfSize
+    // FIXME: section_header_data.ValidOffsetForDataOfSize
     m_sect_headers.resize(nsects);
 
     for (uint32_t idx = 0; idx < nsects; ++idx) {
@@ -293,7 +298,8 @@ bool ObjectFileXCOFF::ParseSectionHeaders(
   return !m_sect_headers.empty();
 }
 
-lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset, size_t size) {
+lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset,
+                                                           size_t size) {
   if (!size)
     return {};
 
@@ -306,9 +312,8 @@ lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset, size
   if (process_sp) {
     auto data_up = std::make_unique<DataBufferHeap>(size, 0);
     Status readmem_error;
-    size_t bytes_read =
-        process_sp->ReadMemory(offset, data_up->GetBytes(),
-                               data_up->GetByteSize(), readmem_error);
+    size_t bytes_read = process_sp->ReadMemory(
+        offset, data_up->GetBytes(), data_up->GetByteSize(), readmem_error);
     if (bytes_read == size) {
       DataBufferSP buffer_sp(data_up.release());
       data.SetData(buffer_sp, 0, buffer_sp->GetByteSize());
@@ -318,7 +323,7 @@ lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset, size
 }
 
 bool ObjectFileXCOFF::SetLoadAddress(Target &target, lldb::addr_t value,
-                                   bool value_is_offset) {
+                                     bool value_is_offset) {
   bool changed = false;
   ModuleSP module_sp = GetModule();
   if (module_sp) {
@@ -340,8 +345,9 @@ bool ObjectFileXCOFF::SetLoadAddress(Target &target, lldb::addr_t value,
             use_offset = true;
 
           if (target.GetSectionLoadList().SetSectionLoadAddress(
-                  section_sp, (use_offset ?
-                  (section_sp->GetFileOffset() + value) : (section_sp->GetFileAddress() + value))))
+                  section_sp,
+                  (use_offset ? (section_sp->GetFileOffset() + value)
+                              : (section_sp->GetFileAddress() + value))))
             ++num_loaded_sections;
         }
       }
@@ -352,7 +358,7 @@ bool ObjectFileXCOFF::SetLoadAddress(Target &target, lldb::addr_t value,
 }
 
 bool ObjectFileXCOFF::SetLoadAddressByType(Target &target, lldb::addr_t value,
-                                   bool value_is_offset, int type_id) {
+                                           bool value_is_offset, int type_id) {
   bool changed = false;
   ModuleSP module_sp = GetModule();
   if (module_sp) {
@@ -366,13 +372,15 @@ bool ObjectFileXCOFF::SetLoadAddressByType(Target &target, lldb::addr_t value,
         // Iterate through the object file sections to find all of the sections
         // that have SHF_ALLOC in their flag bits.
         SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
-        if (type_id == 1 && section_sp && strcmp(section_sp->GetName().AsCString(), ".text") == 0) {
+        if (type_id == 1 && section_sp &&
+            strcmp(section_sp->GetName().AsCString(), ".text") == 0) {
           if (!section_sp->IsThreadSpecific()) {
             if (target.GetSectionLoadList().SetSectionLoadAddress(
                     section_sp, section_sp->GetFileOffset() + value))
               ++num_loaded_sections;
           }
-        } else if (type_id == 2 && section_sp && strcmp(section_sp->GetName().AsCString(), ".data") == 0) {
+        } else if (type_id == 2 && section_sp &&
+                   strcmp(section_sp->GetName().AsCString(), ".data") == 0) {
           if (!section_sp->IsThreadSpecific()) {
             if (target.GetSectionLoadList().SetSectionLoadAddress(
                     section_sp, section_sp->GetFileAddress() + value))
@@ -386,13 +394,9 @@ bool ObjectFileXCOFF::SetLoadAddressByType(Target &target, lldb::addr_t value,
   return changed;
 }
 
-ByteOrder ObjectFileXCOFF::GetByteOrder() const {
-  return eByteOrderBig;
-}
+ByteOrder ObjectFileXCOFF::GetByteOrder() const { return eByteOrderBig; }
 
-bool ObjectFileXCOFF::IsExecutable() const {
-  return true;
-}
+bool ObjectFileXCOFF::IsExecutable() const { return true; }
 
 uint32_t ObjectFileXCOFF::GetAddressByteSize() const {
   if (m_xcoff_header.magic == XCOFF::XCOFF64)
@@ -406,7 +410,8 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t file_addr) {
   return AddressClass::eUnknown;
 }
 
-lldb::SymbolType ObjectFileXCOFF::MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+lldb::SymbolType
+ObjectFileXCOFF::MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
   if (sym_type == llvm::object::SymbolRef::ST_Function)
     return lldb::eSymbolTypeCode;
   else if (sym_type == llvm::object::SymbolRef::ST_Data)
@@ -433,7 +438,8 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
       const uint32_t symbol_offset = offset;
       symbol.value = symtab_data.GetU64(&offset);
       symbol.offset = symtab_data.GetU32(&offset);
-      Expected<StringRef> symbol_name_or_err = m_binary->getStringTableEntry(symbol.offset);
+      Expected<StringRef> symbol_name_or_err =
+          m_binary->getStringTableEntry(symbol.offset);
       if (!symbol_name_or_err) {
         consumeError(symbol_name_or_err.takeError());
         return;
@@ -445,7 +451,8 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
       symbol.storage = symtab_data.GetU8(&offset);
       symbol.naux = symtab_data.GetU8(&offset);
       // Allow C_HIDEXT TOC symbol, and check others.
-      if (symbol.storage == XCOFF::C_HIDEXT && strcmp(symbol_name.c_str(), "TOC") != 0) {
+      if (symbol.storage == XCOFF::C_HIDEXT &&
+          strcmp(symbol_name.c_str(), "TOC") != 0) {
         if (symbol.naux == 0)
           continue;
         if (symbol.naux > 1) {
@@ -467,7 +474,8 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
         symbol_aux.pad = symtab_data.GetU8(&offset);
         symbol_aux.aux_type = symtab_data.GetU8(&offset);
         offset -= symbol.naux * symbol_size;
-        if (symbol_aux.storage_mapping_class != XCOFF::XMC_PR || symbol_aux.aux_type != XCOFF::AUX_CSECT) {
+        if (symbol_aux.storage_mapping_class != XCOFF::XMC_PR ||
+            symbol_aux.aux_type != XCOFF::AUX_CSECT) {
           i += symbol.naux;
           offset += symbol.naux * symbol_size;
           continue;
@@ -475,13 +483,17 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
       }
       // Remove the dot prefix for demangle
       if (symbol_name_str.size() > 1 && symbol_name_str.data()[0] == '.') {
-        symbols[sidx].GetMangled().SetValue(ConstString(symbol_name.c_str() + 1));
+        symbols[sidx].GetMangled().SetValue(
+            ConstString(symbol_name.c_str() + 1));
       } else {
         symbols[sidx].GetMangled().SetValue(ConstString(symbol_name.c_str()));
       }
       if ((int16_t)symbol.sect >= 1) {
-        Address symbol_addr(sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1)),
-                            (symbol.value - sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1))->GetFileAddress()));
+        Address symbol_addr(
+            sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1)),
+            (symbol.value -
+             sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1))
+                 ->GetFileAddress()));
         symbols[sidx].GetAddressRef() = symbol_addr;
 
         Expected<llvm::object::SymbolRef::Type> sym_type_or_err = SI->getType();
@@ -502,9 +514,7 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
   }
 }
 
-bool ObjectFileXCOFF::IsStripped() {
-  return false;
-}
+bool ObjectFileXCOFF::IsStripped() { return false; }
 
 void ObjectFileXCOFF::CreateSections(SectionList &unified_section_list) {
   if (m_sections_up)
@@ -528,12 +538,14 @@ void ObjectFileXCOFF::CreateSections(SectionList &unified_section_list) {
           const_sect_name, // Name of this section
           section_type,
           m_sect_headers[idx].vmaddr, // File VM address == addresses as
-                                          // they are found in the object file
-          m_sect_headers[idx].size,     // VM size in bytes of this section
-          m_sect_headers[idx].offset, // Offset to the data for this section in the file
-          m_sect_headers[idx].size, // Size in bytes of this section as found in the file
-          0, // FIXME: alignment
-          m_sect_headers[idx].flags));      // Flags for this section
+                                      // they are found in the object file
+          m_sect_headers[idx].size,   // VM size in bytes of this section
+          m_sect_headers[idx]
+              .offset, // Offset to the data for this section in the file
+          m_sect_headers[idx]
+              .size, // Size in bytes of this section as found in the file
+          0,         // FIXME: alignment
+          m_sect_headers[idx].flags)); // Flags for this section
 
       // FIXME
       uint32_t permissions = 0;
@@ -558,7 +570,10 @@ llvm::StringRef ObjectFileXCOFF::GetSectionName(const section_header_t &sect) {
     if (!to_integer(hdr_name, stroff, 10))
       return "";
     lldb::offset_t string_file_offset =
-        m_xcoff_header.symoff + (m_xcoff_header.nsyms * static_cast<lldb::offset_t>(XCOFF::SymbolTableEntrySize)) + stroff;
+        m_xcoff_header.symoff +
+        (m_xcoff_header.nsyms *
+         static_cast<lldb::offset_t>(XCOFF::SymbolTableEntrySize)) +
+        stroff;
     if (const char *name = m_data.GetCStr(&string_file_offset))
       return name;
     return "";
@@ -567,7 +582,7 @@ llvm::StringRef ObjectFileXCOFF::GetSectionName(const section_header_t &sect) {
 }
 
 SectionType ObjectFileXCOFF::GetSectionType(llvm::StringRef sect_name,
-                                             const section_header_t &sect) {
+                                            const section_header_t &sect) {
   if (sect.flags & XCOFF::STYP_TEXT)
     return eSectionTypeCode;
   if (sect.flags & XCOFF::STYP_DATA)
@@ -576,11 +591,11 @@ SectionType ObjectFileXCOFF::GetSectionType(llvm::StringRef sect_name,
     return eSectionTypeZeroFill;
   if (sect.flags & XCOFF::STYP_DWARF) {
     SectionType section_type =
-      llvm::StringSwitch<SectionType>(sect_name)
-      .Case(".dwinfo", eSectionTypeDWARFDebugInfo)
-      .Case(".dwline", eSectionTypeDWARFDebugLine)
-      .Case(".dwabrev", eSectionTypeDWARFDebugAbbrev)
-      .Default(eSectionTypeInvalid);
+        llvm::StringSwitch<SectionType>(sect_name)
+            .Case(".dwinfo", eSectionTypeDWARFDebugInfo)
+            .Case(".dwline", eSectionTypeDWARFDebugLine)
+            .Case(".dwabrev", eSectionTypeDWARFDebugAbbrev)
+            .Default(eSectionTypeInvalid);
 
     if (section_type != eSectionTypeInvalid)
       return section_type;
@@ -588,21 +603,17 @@ SectionType ObjectFileXCOFF::GetSectionType(llvm::StringRef sect_name,
   return eSectionTypeOther;
 }
 
-void ObjectFileXCOFF::Dump(Stream *s) {
-}
+void ObjectFileXCOFF::Dump(Stream *s) {}
 
 ArchSpec ObjectFileXCOFF::GetArchitecture() {
-  ArchSpec arch_spec = ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
+  ArchSpec arch_spec =
+      ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
   return arch_spec;
 }
 
-UUID ObjectFileXCOFF::GetUUID() {
-  return UUID();
-}
+UUID ObjectFileXCOFF::GetUUID() { return UUID(); }
 
-std::optional<FileSpec> ObjectFileXCOFF::GetDebugLink() {
-  return std::nullopt;
-}
+std::optional<FileSpec> ObjectFileXCOFF::GetDebugLink() { return std::nullopt; }
 
 uint32_t ObjectFileXCOFF::ParseDependentModules() {
   ModuleSP module_sp(GetModule());
@@ -703,10 +714,10 @@ lldb_private::Address ObjectFileXCOFF::GetEntryPointAddress() {
 
   SectionList *section_list = GetSectionList();
   addr_t vm_addr = m_xcoff_aux_header.EntryPointAddr;
-  SectionSP section_sp(
-      section_list->FindSectionContainingFileAddress(vm_addr));
+  SectionSP section_sp(section_list->FindSectionContainingFileAddress(vm_addr));
   if (section_sp) {
-    lldb::offset_t offset_ptr = section_sp->GetFileOffset() + (vm_addr - section_sp->GetFileAddress());
+    lldb::offset_t offset_ptr =
+        section_sp->GetFileOffset() + (vm_addr - section_sp->GetFileAddress());
     vm_addr = m_data.GetU64(&offset_ptr);
   }
 
@@ -731,18 +742,14 @@ ObjectFile::Type ObjectFileXCOFF::CalculateType() {
   return eTypeUnknown;
 }
 
-ObjectFile::Strata ObjectFileXCOFF::CalculateStrata() {
-  return eStrataUnknown;
-}
+ObjectFile::Strata ObjectFileXCOFF::CalculateStrata() { return eStrataUnknown; }
 
-llvm::StringRef
-ObjectFileXCOFF::StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const {
+llvm::StringRef ObjectFileXCOFF::StripLinkerSymbolAnnotations(
+    llvm::StringRef symbol_name) const {
   return llvm::StringRef();
 }
 
-void ObjectFileXCOFF::RelocateSection(lldb_private::Section *section)
-{
-}
+void ObjectFileXCOFF::RelocateSection(lldb_private::Section *section) {}
 
 std::vector<ObjectFile::LoadableData>
 ObjectFileXCOFF::GetLoadableData(Target &target) {
@@ -752,29 +759,31 @@ ObjectFileXCOFF::GetLoadableData(Target &target) {
 
 lldb::WritableDataBufferSP
 ObjectFileXCOFF::MapFileDataWritable(const FileSpec &file, uint64_t Size,
-                                   uint64_t Offset) {
+                                     uint64_t Offset) {
   return FileSystem::Instance().CreateWritableDataBuffer(file.GetPath(), Size,
                                                          Offset);
 }
 
 ObjectFileXCOFF::ObjectFileXCOFF(const lldb::ModuleSP &module_sp,
-                             DataBufferSP data_sp, lldb::offset_t data_offset,
-                             const FileSpec *file, lldb::offset_t file_offset,
-                             lldb::offset_t length)
+                                 DataBufferSP data_sp,
+                                 lldb::offset_t data_offset,
+                                 const FileSpec *file,
+                                 lldb::offset_t file_offset,
+                                 lldb::offset_t length)
     : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-      m_xcoff_header(), m_sect_headers(), m_deps_filespec(), m_deps_base_members(),
-      m_entry_point_address() {
+      m_xcoff_header(), m_sect_headers(), m_deps_filespec(),
+      m_deps_base_members(), m_entry_point_address() {
   ::memset(&m_xcoff_header, 0, sizeof(m_xcoff_header));
   if (file)
     m_file = *file;
 }
 
 ObjectFileXCOFF::ObjectFileXCOFF(const lldb::ModuleSP &module_sp,
-                             DataBufferSP header_data_sp,
-                             const lldb::ProcessSP &process_sp,
-                             addr_t header_addr)
+                                 DataBufferSP header_data_sp,
+                                 const lldb::ProcessSP &process_sp,
+                                 addr_t header_addr)
     : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-      m_xcoff_header(), m_sect_headers(), m_deps_filespec(), m_deps_base_members(),
-      m_entry_point_address() {
+      m_xcoff_header(), m_sect_headers(), m_deps_filespec(),
+      m_deps_base_members(), m_entry_point_address() {
   ::memset(&m_xcoff_header, 0, sizeof(m_xcoff_header));
 }
diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
index 5a12d16886..2cb73394a0 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
@@ -1,4 +1,5 @@
-//===-- ObjectFileXCOFF.h --------------------------------------- -*- C++ -*-===//
+//===-- ObjectFileXCOFF.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.
@@ -76,7 +77,7 @@ public:
                       bool value_is_offset) override;
 
   bool SetLoadAddressByType(lldb_private::Target &target, lldb::addr_t value,
-                              bool value_is_offset, int type_id) override;
+                            bool value_is_offset, int type_id) override;
 
   lldb::ByteOrder GetByteOrder() const override;
 
@@ -123,15 +124,15 @@ public:
   lldb_private::DataExtractor ReadImageData(uint32_t offset, size_t size);
 
   ObjectFileXCOFF(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
-                lldb::offset_t data_offset, const lldb_private::FileSpec *file,
-                lldb::offset_t offset, lldb::offset_t length);
+                  lldb::offset_t data_offset,
+                  const lldb_private::FileSpec *file, lldb::offset_t offset,
+                  lldb::offset_t length);
 
   ObjectFileXCOFF(const lldb::ModuleSP &module_sp,
-                lldb::DataBufferSP header_data_sp,
-                const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
+                  lldb::DataBufferSP header_data_sp,
+                  const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
 
 protected:
-
   typedef struct xcoff_header {
     uint16_t magic;
     uint16_t nsects;
@@ -209,8 +210,8 @@ protected:
   } xcoff_sym_csect_aux_entry_t;
 
   static bool ParseXCOFFHeader(lldb_private::DataExtractor &data,
-                              lldb::offset_t *offset_ptr,
-                              xcoff_header_t &xcoff_header);
+                               lldb::offset_t *offset_ptr,
+                               xcoff_header_t &xcoff_header);
   bool ParseXCOFFOptionalHeader(lldb_private::DataExtractor &data,
                                 lldb::offset_t *offset_ptr);
   bool ParseSectionHeaders(uint32_t offset);
diff --git a/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp b/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp
index b6b08b73be..85e8866cee 100644
--- a/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp
+++ b/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp
@@ -43,7 +43,6 @@ LLDB_PLUGIN_DEFINE(PlatformAIX)
 
 static uint32_t g_initialize_count = 0;
 
-
 PlatformSP PlatformAIX::CreateInstance(bool force, const ArchSpec *arch) {
   Log *log = GetLog(LLDBLog::Platform);
   LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
@@ -283,17 +282,17 @@ static lldb::UnwindPlanSP GetAArch64TrapHanlderUnwindPlan(ConstString name) {
 
 lldb::UnwindPlanSP
 PlatformAIX::GetTrapHandlerUnwindPlan(const llvm::Triple &triple,
-                                        ConstString name) {
+                                      ConstString name) {
   if (triple.isAArch64())
     return GetAArch64TrapHanlderUnwindPlan(name);
 
   return {};
 }
 
-MmapArgList PlatformAIX::GetMmapArgumentList(const ArchSpec &arch,
-                                               addr_t addr, addr_t length,
-                                               unsigned prot, unsigned flags,
-                                               addr_t fd, addr_t offset) {
+MmapArgList PlatformAIX::GetMmapArgumentList(const ArchSpec &arch, addr_t addr,
+                                             addr_t length, unsigned prot,
+                                             unsigned flags, addr_t fd,
+                                             addr_t offset) {
 #if defined(__AIX__)
   unsigned flags_platform = MAP_VARIABLE | MAP_PRIVATE | MAP_ANONYMOUS;
 #else
@@ -349,13 +348,14 @@ CompilerType PlatformAIX::GetSiginfoType(const llvm::Triple &triple) {
       nullptr, OptionalClangModuleID(), lldb::eAccessPublic, "",
       llvm::to_underlying(clang::TagTypeKind::Union), lldb::eLanguageTypeC);
   ast->StartTagDeclarationDefinition(sigfault_bounds_type);
-  ast->AddFieldToRecordType(sigfault_bounds_type, "_addr_bnd",
+  ast->AddFieldToRecordType(
+      sigfault_bounds_type, "_addr_bnd",
       ast->CreateStructForIdentifier(ConstString(),
                                      {
                                          {"_lower", voidp_type},
                                          {"_upper", voidp_type},
                                      }),
-                            lldb::eAccessPublic, 0);
+      lldb::eAccessPublic, 0);
   ast->AddFieldToRecordType(sigfault_bounds_type, "_pkey", uint_type,
                             lldb::eAccessPublic, 0);
   ast->CompleteTagDeclarationDefinition(sigfault_bounds_type);
diff --git a/lldb/source/Plugins/Platform/AIX/PlatformAIX.h b/lldb/source/Plugins/Platform/AIX/PlatformAIX.h
index 3ae8089a48..fe183e6bce 100644
--- a/lldb/source/Plugins/Platform/AIX/PlatformAIX.h
+++ b/lldb/source/Plugins/Platform/AIX/PlatformAIX.h
@@ -68,7 +68,7 @@ private:
   std::unique_ptr<TypeSystemClang> m_type_system_up;
 };
 
-} // namespace platform_AIX
+} // namespace platform_aix
 } // namespace lldb_private
 
 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_AIX_PLATFORMAIX_H
diff --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
index fc84763857..8277a83cdb 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
@@ -22,18 +22,18 @@
 
 #include "NativeThreadAIX.h"
 #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-//#include "Plugins/Process/Utility/LinuxProcMaps.h"
-//#include "Procfs.h"
+// #include "Plugins/Process/Utility/LinuxProcMaps.h"
+// #include "Procfs.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostProcess.h"
 #include "lldb/Host/ProcessLaunchInfo.h"
 #include "lldb/Host/PseudoTerminal.h"
 #include "lldb/Host/ThreadLauncher.h"
-#include "lldb/Host/common/NativeRegisterContext.h"
 #include "lldb/Host/aix/Ptrace.h"
-//#include "lldb/Host/linux/Host.h"
-//#include "lldb/Host/linux/Uio.h"
+#include "lldb/Host/common/NativeRegisterContext.h"
+// #include "lldb/Host/linux/Host.h"
+// #include "lldb/Host/linux/Uio.h"
 #include "lldb/Host/posix/ProcessLauncherPosixFork.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/Process.h"
@@ -50,15 +50,15 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Threading.h"
 
-#include <sys/reg.h>
-#include <sys/ptrace.h>
 #include <sys/ldr.h>
+#include <sys/ptrace.h>
+#include <sys/reg.h>
 #include <sys/socket.h>
-//#include <sys/syscall.h>
+// #include <sys/syscall.h>
+#include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/user.h>
 #include <sys/wait.h>
-#include <sys/mman.h>
 
 #ifdef __aarch64__
 #include <asm/hwcap.h>
@@ -196,7 +196,8 @@ static void PtraceDisplayBytes(int &req, void *data, size_t data_size) {
     LLDB_LOGV(log, "PTRACE_SETREGSET {0}", buf.GetData());
     break;
   }
-  default: {}
+  default: {
+  }
   }
 }
 
@@ -276,7 +277,7 @@ NativeProcessAIX::Manager::Manager(MainLoop &mainloop)
 
 llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
 NativeProcessAIX::Manager::Launch(ProcessLaunchInfo &launch_info,
-                                    NativeDelegate &native_delegate) {
+                                  NativeDelegate &native_delegate) {
   Log *log = GetLog(POSIXLog::Process);
 
   MaybeLogLaunchInfo(launch_info);
@@ -306,17 +307,17 @@ NativeProcessAIX::Manager::Launch(ProcessLaunchInfo &launch_info,
 
   ProcessInstanceInfo Info;
   if (!Host::GetProcessInfo(pid, Info)) {
-      return llvm::make_error<StringError>("Cannot get process architectrue",
-                                            llvm::inconvertibleErrorCode());
-  } 
+    return llvm::make_error<StringError>("Cannot get process architectrue",
+                                         llvm::inconvertibleErrorCode());
+  }
   /*llvm::Expected<ArchSpec> arch_or =
       NativeRegisterContextAIX::DetermineArchitecture(pid);
   if (!arch_or)
     return arch_or.takeError();*/
 
- // Set the architecture to the exe architecture.
-  LLDB_LOG(log, "pid = {0}, detected architecture {1}", pid, 
-          Info.GetArchitecture().GetArchitectureName());
+  // 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,
@@ -325,15 +326,15 @@ NativeProcessAIX::Manager::Launch(ProcessLaunchInfo &launch_info,
 
 llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
 NativeProcessAIX::Manager::Attach(
-    lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate) { 
+    lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate) {
   Log *log = GetLog(POSIXLog::Process);
   LLDB_LOG(log, "pid = {0:x}", pid);
 
   ProcessInstanceInfo Info;
   if (!Host::GetProcessInfo(pid, Info)) {
-      return llvm::make_error<StringError>("Cannot get process architectrue",
-                                            llvm::inconvertibleErrorCode());
-  } 
+    return llvm::make_error<StringError>("Cannot get process architectrue",
+                                         llvm::inconvertibleErrorCode());
+  }
   auto tids_or = NativeProcessAIX::Attach(pid);
   if (!tids_or)
     return tids_or.takeError();
@@ -345,8 +346,8 @@ NativeProcessAIX::Manager::Attach(
     return arch_or.takeError();
 #endif
 
-  return std::unique_ptr<NativeProcessAIX>(
-      new NativeProcessAIX(pid, -1, native_delegate, Info.GetArchitecture(), *this, *tids_or));
+  return std::unique_ptr<NativeProcessAIX>(new NativeProcessAIX(
+      pid, -1, native_delegate, Info.GetArchitecture(), *this, *tids_or));
 }
 
 lldb::addr_t NativeProcessAIX::GetSharedLibraryInfoAddress() {
@@ -437,8 +438,8 @@ void NativeProcessAIX::Manager::CollectThread(::pid_t tid) {
            "received clone event for tid {0}. tid not tracked yet, "
            "waiting for it to appear...",
            tid);
-  ::pid_t wait_pid =
-      llvm::sys::RetryAfterSignal(-1, ::waitpid, tid, &status, P_ALL/*__WALL*/);
+  ::pid_t wait_pid = llvm::sys::RetryAfterSignal(-1, ::waitpid, tid, &status,
+                                                 P_ALL /*__WALL*/);
 
   // It's theoretically possible to get other events if the entire process was
   // SIGKILLed before we got a chance to check this. In that case, we'll just
@@ -452,9 +453,9 @@ void NativeProcessAIX::Manager::CollectThread(::pid_t tid) {
 // Public Instance Methods
 
 NativeProcessAIX::NativeProcessAIX(::pid_t pid, int terminal_fd,
-                                       NativeDelegate &delegate,
-                                       const ArchSpec &arch, Manager &manager,
-                                       llvm::ArrayRef<::pid_t> tids)
+                                   NativeDelegate &delegate,
+                                   const ArchSpec &arch, Manager &manager,
+                                   llvm::ArrayRef<::pid_t> tids)
     : NativeProcessProtocol(pid, terminal_fd, delegate), m_manager(manager),
       m_arch(arch) {
   manager.AddProcess(*this);
@@ -481,8 +482,7 @@ llvm::Expected<std::vector<::pid_t>> NativeProcessAIX::Attach(::pid_t pid) {
     return status.ToError();
   }
 
-  int wpid =
-      llvm::sys::RetryAfterSignal(-1, ::waitpid, pid, nullptr, WNOHANG);
+  int wpid = llvm::sys::RetryAfterSignal(-1, ::waitpid, pid, nullptr, WNOHANG);
   if (wpid <= 0) {
     return llvm::errorCodeToError(
         std::error_code(errno, std::generic_category()));
@@ -495,8 +495,7 @@ llvm::Expected<std::vector<::pid_t>> NativeProcessAIX::Attach(::pid_t pid) {
   return std::move(tids);
 }
 
-bool NativeProcessAIX::TryHandleWaitStatus(lldb::pid_t pid,
-                                             WaitStatus status) {
+bool NativeProcessAIX::TryHandleWaitStatus(lldb::pid_t pid, WaitStatus status) {
   if (pid == GetID() &&
       (status.type == WaitStatus::Exit || status.type == WaitStatus::Signal)) {
     // The process exited.  We're done monitoring.  Report to delegate.
@@ -512,7 +511,7 @@ bool NativeProcessAIX::TryHandleWaitStatus(lldb::pid_t pid,
 
 // Handles all waitpid events from the inferior process.
 void NativeProcessAIX::MonitorCallback(NativeThreadAIX &thread,
-                                         WaitStatus status) {
+                                       WaitStatus status) {
   Log *log = GetLog(LLDBLog::Process);
 
   // Certain activities differ based on whether the pid is the tid of the main
@@ -548,9 +547,8 @@ void NativeProcessAIX::MonitorCallback(NativeThreadAIX &thread,
   }
 }
 
-
 void NativeProcessAIX::MonitorSIGTRAP(const WaitStatus status,
-                                        NativeThreadAIX &thread) {
+                                      NativeThreadAIX &thread) {
   Log *log = GetLog(POSIXLog::Process);
   const bool is_main_thread = (thread.GetID() == GetID());
 
@@ -601,7 +599,7 @@ void NativeProcessAIX::MonitorBreakpoint(NativeThreadAIX &thread) {
 }
 
 void NativeProcessAIX::MonitorWatchpoint(NativeThreadAIX &thread,
-                                           uint32_t wp_index) {
+                                         uint32_t wp_index) {
   Log *log = GetLog(LLDBLog::Process | LLDBLog::Watchpoints);
   LLDB_LOG(log, "received watchpoint event, pid = {0}, wp_index = {1}",
            thread.GetID(), wp_index);
@@ -616,7 +614,7 @@ void NativeProcessAIX::MonitorWatchpoint(NativeThreadAIX &thread,
 }
 
 void NativeProcessAIX::MonitorSignal(const WaitStatus status,
-                                       NativeThreadAIX &thread) {
+                                     NativeThreadAIX &thread) {
   int8_t signo = GetSignalInfo(status);
 #if 0
   const bool is_from_llgs = info.si_pid == getpid();
@@ -694,8 +692,8 @@ void NativeProcessAIX::MonitorSignal(const WaitStatus status,
   // Check if debugger should stop at this signal or just ignore it and resume
   // the inferior.
   if (m_signals_to_ignore.contains(signo) || signo == SIGCHLD) {
-     ResumeThread(thread, thread.GetState(), signo);
-     return;
+    ResumeThread(thread, thread.GetState(), signo);
+    return;
   }
 
   // This thread is stopped.
@@ -707,12 +705,12 @@ void NativeProcessAIX::MonitorSignal(const WaitStatus status,
 }
 
 bool NativeProcessAIX::MonitorClone(NativeThreadAIX &parent,
-                                      lldb::pid_t child_pid, int event) {
+                                    lldb::pid_t child_pid, int event) {
   Log *log = GetLog(POSIXLog::Process);
   LLDB_LOG(log, "parent_tid={0}, child_pid={1}, event={2}", parent.GetID(),
            child_pid, event);
 
- // WaitForCloneNotification(child_pid);
+  // WaitForCloneNotification(child_pid);
 
   switch (event) {
 #if 0
@@ -764,9 +762,7 @@ bool NativeProcessAIX::MonitorClone(NativeThreadAIX &parent,
   return true;
 }
 
-bool NativeProcessAIX::SupportHardwareSingleStepping() const {
-  return false;
-}
+bool NativeProcessAIX::SupportHardwareSingleStepping() const { return false; }
 
 Status NativeProcessAIX::Resume(const ResumeActionList &resume_actions) {
   Log *log = GetLog(POSIXLog::Process);
@@ -815,10 +811,10 @@ Status NativeProcessAIX::Resume(const ResumeActionList &resume_actions) {
       Status error = ResumeThread(static_cast<NativeThreadAIX &>(*thread),
                                   action->state, signo);
       if (error.Fail())
-        return Status::FromErrorStringWithFormat("NativeProcessAIX::%s: failed to resume thread "
-                      "for pid %" PRIu64 ", tid %" PRIu64 ", error = %s",
-                      __FUNCTION__, GetID(), thread->GetID(),
-                      error.AsCString());
+        return Status::FromErrorStringWithFormat(
+            "NativeProcessAIX::%s: failed to resume thread "
+            "for pid %" PRIu64 ", tid %" PRIu64 ", error = %s",
+            __FUNCTION__, GetID(), thread->GetID(), error.AsCString());
 
       break;
     }
@@ -828,10 +824,11 @@ Status NativeProcessAIX::Resume(const ResumeActionList &resume_actions) {
       break;
 
     default:
-      return Status::FromErrorStringWithFormat("NativeProcessAIX::%s (): unexpected state %s specified "
-                    "for pid %" PRIu64 ", tid %" PRIu64,
-                    __FUNCTION__, StateAsCString(action->state), GetID(),
-                    thread->GetID());
+      return Status::FromErrorStringWithFormat(
+          "NativeProcessAIX::%s (): unexpected state %s specified "
+          "for pid %" PRIu64 ", tid %" PRIu64,
+          __FUNCTION__, StateAsCString(action->state), GetID(),
+          thread->GetID());
     }
   }
 
@@ -861,8 +858,8 @@ Status NativeProcessAIX::Detach() {
   for (const auto &thread : m_threads) {
     Status e = Detach(thread->GetID());
     if (e.Fail())
-      error =
-          e.Clone(); // Save the error, but still attempt to detach from other threads.
+      error = e.Clone(); // Save the error, but still attempt to detach from
+                         // other threads.
   }
 
   return error;
@@ -961,7 +958,7 @@ Status NativeProcessAIX::Kill() {
 }
 
 Status NativeProcessAIX::GetMemoryRegionInfo(lldb::addr_t load_addr,
-                                               MemoryRegionInfo &range_info) {
+                                             MemoryRegionInfo &range_info) {
   // FIXME review that the final memory region returned extends to the end of
   // the virtual address space,
   // with no perms if it is not mapped.
@@ -1107,7 +1104,7 @@ NativeProcessAIX::Syscall(llvm::ArrayRef<uint64_t> args) {
   PopulateMemoryRegionCache();
   auto region_it = llvm::find_if(m_mem_region_cache, [](const auto &pair) {
     return pair.first.GetExecutable() == MemoryRegionInfo::eYes &&
-        pair.first.GetShared() != MemoryRegionInfo::eYes;
+           pair.first.GetShared() != MemoryRegionInfo::eYes;
   });
   if (region_it == m_mem_region_cache.end())
     return llvm::createStringError(llvm::inconvertibleErrorCode(),
@@ -1164,10 +1161,10 @@ NativeProcessAIX::Syscall(llvm::ArrayRef<uint64_t> args) {
           PtraceWrapper(req, thread.GetID(), nullptr, nullptr).ToError())
     return std::move(Err);
 
-  //FIXME
+  // FIXME
   int status;
   ::pid_t wait_pid = llvm::sys::RetryAfterSignal(-1, ::waitpid, thread.GetID(),
-                                                 &status, P_ALL/*__WALL*/);
+                                                 &status, P_ALL /*__WALL*/);
   if (wait_pid == -1) {
     return llvm::errorCodeToError(
         std::error_code(errno, std::generic_category()));
@@ -1187,8 +1184,8 @@ NativeProcessAIX::Syscall(llvm::ArrayRef<uint64_t> args) {
   return result;
 }
 
-llvm::Expected<addr_t>
-NativeProcessAIX::AllocateMemory(size_t size, uint32_t permissions) {
+llvm::Expected<addr_t> NativeProcessAIX::AllocateMemory(size_t size,
+                                                        uint32_t permissions) {
 
   std::optional<NativeRegisterContextAIX::MmapData> mmap_data =
       GetCurrentThread()->GetRegisterContext().GetMmapData();
@@ -1235,8 +1232,8 @@ llvm::Error NativeProcessAIX::DeallocateMemory(lldb::addr_t addr) {
 }
 
 Status NativeProcessAIX::ReadMemoryTags(int32_t type, lldb::addr_t addr,
-                                          size_t len,
-                                          std::vector<uint8_t> &tags) {
+                                        size_t len,
+                                        std::vector<uint8_t> &tags) {
   llvm::Expected<NativeRegisterContextAIX::MemoryTaggingDetails> details =
       GetCurrentThread()->GetRegisterContext().GetMemoryTaggingDetails(type);
   if (!details)
@@ -1290,8 +1287,8 @@ Status NativeProcessAIX::ReadMemoryTags(int32_t type, lldb::addr_t addr,
 }
 
 Status NativeProcessAIX::WriteMemoryTags(int32_t type, lldb::addr_t addr,
-                                           size_t len,
-                                           const std::vector<uint8_t> &tags) {
+                                         size_t len,
+                                         const std::vector<uint8_t> &tags) {
   llvm::Expected<NativeRegisterContextAIX::MemoryTaggingDetails> details =
       GetCurrentThread()->GetRegisterContext().GetMemoryTaggingDetails(type);
   if (!details)
@@ -1367,7 +1364,7 @@ size_t NativeProcessAIX::UpdateThreads() {
 }
 
 Status NativeProcessAIX::SetBreakpoint(lldb::addr_t addr, uint32_t size,
-                                         bool hardware) {
+                                       bool hardware) {
   if (hardware)
     return SetHardwareBreakpoint(addr, size);
   else
@@ -1405,7 +1402,7 @@ NativeProcessAIX::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
 }
 
 Status NativeProcessAIX::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
-                                      size_t &bytes_read) {
+                                    size_t &bytes_read) {
   unsigned char *dst = static_cast<unsigned char *>(buf);
   size_t remainder;
   long data;
@@ -1415,7 +1412,8 @@ Status NativeProcessAIX::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
 
   for (bytes_read = 0; bytes_read < size; bytes_read += remainder) {
     Status error = NativeProcessAIX::PtraceWrapper(
-        PT_READ_BLOCK, GetCurrentThreadID(), (void *)addr, nullptr, sizeof(data), &data);
+        PT_READ_BLOCK, GetCurrentThreadID(), (void *)addr, nullptr,
+        sizeof(data), &data);
     if (error.Fail())
       return error;
 
@@ -1433,7 +1431,7 @@ Status NativeProcessAIX::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
 }
 
 Status NativeProcessAIX::WriteMemory(lldb::addr_t addr, const void *buf,
-                                       size_t size, size_t &bytes_written) {
+                                     size_t size, size_t &bytes_written) {
   const unsigned char *src = static_cast<const unsigned char *>(buf);
   size_t remainder;
   Status error;
@@ -1441,8 +1439,9 @@ Status NativeProcessAIX::WriteMemory(lldb::addr_t addr, const void *buf,
   Log *log = GetLog(POSIXLog::Memory);
   LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size);
 
-  error = NativeProcessAIX::PtraceWrapper(
-    PT_WRITE_BLOCK, GetCurrentThreadID(), (void *)addr, nullptr, (int)size, (long *)buf);
+  error = NativeProcessAIX::PtraceWrapper(PT_WRITE_BLOCK, GetCurrentThreadID(),
+                                          (void *)addr, nullptr, (int)size,
+                                          (long *)buf);
   if (error.Fail())
     return error;
 
@@ -1455,9 +1454,9 @@ int8_t NativeProcessAIX::GetSignalInfo(WaitStatus wstatus) const {
 }
 
 Status NativeProcessAIX::GetEventMessage(lldb::tid_t tid,
-                                           unsigned long *message) {
-  //FIXME
-  return PtraceWrapper(PT_CLEAR/*PTRACE_GETEVENTMSG*/, tid, nullptr, message);
+                                         unsigned long *message) {
+  // FIXME
+  return PtraceWrapper(PT_CLEAR /*PTRACE_GETEVENTMSG*/, tid, nullptr, message);
 }
 
 Status NativeProcessAIX::Detach(lldb::tid_t tid) {
@@ -1495,11 +1494,9 @@ void NativeProcessAIX::StopTrackingThread(NativeThreadAIX &thread) {
   SignalIfAllThreadsStopped();
 }
 
-void NativeProcessAIX::NotifyTracersProcessDidStop() {
-}
+void NativeProcessAIX::NotifyTracersProcessDidStop() {}
 
-void NativeProcessAIX::NotifyTracersProcessWillResume() { 
-}
+void NativeProcessAIX::NotifyTracersProcessWillResume() {}
 
 Status NativeProcessAIX::NotifyTracersOfNewThread(lldb::tid_t tid) {
   Log *log = GetLog(POSIXLog::Thread);
@@ -1514,7 +1511,7 @@ Status NativeProcessAIX::NotifyTracersOfThreadDestroyed(lldb::tid_t tid) {
 }
 
 NativeThreadAIX &NativeProcessAIX::AddThread(lldb::tid_t thread_id,
-                                                 bool resume) {
+                                             bool resume) {
   Log *log = GetLog(POSIXLog::Thread);
   LLDB_LOG(log, "pid {0} adding thread with tid {1}", GetID(), thread_id);
 
@@ -1526,8 +1523,7 @@ NativeThreadAIX &NativeProcessAIX::AddThread(lldb::tid_t thread_id,
     SetCurrentThreadID(thread_id);
 
   m_threads.push_back(std::make_unique<NativeThreadAIX>(*this, thread_id));
-  NativeThreadAIX &thread =
-      static_cast<NativeThreadAIX &>(*m_threads.back());
+  NativeThreadAIX &thread = static_cast<NativeThreadAIX &>(*m_threads.back());
 
   Status tracing_error = NotifyTracersOfNewThread(thread.GetID());
   if (tracing_error.Fail()) {
@@ -1542,7 +1538,7 @@ NativeThreadAIX &NativeProcessAIX::AddThread(lldb::tid_t thread_id,
 }
 
 Status NativeProcessAIX::GetLoadedModuleFileSpec(const char *module_path,
-                                                   FileSpec &file_spec) {
+                                                 FileSpec &file_spec) {
   Status error = PopulateMemoryRegionCache();
   if (error.Fail())
     return error;
@@ -1557,12 +1553,13 @@ Status NativeProcessAIX::GetLoadedModuleFileSpec(const char *module_path,
       return Status();
     }
   }
-  return Status::FromErrorStringWithFormat("Module file (%s) not found in /proc/%" PRIu64 "/maps file!",
-                module_file_spec.GetFilename().AsCString(), GetID());
+  return Status::FromErrorStringWithFormat(
+      "Module file (%s) not found in /proc/%" PRIu64 "/maps file!",
+      module_file_spec.GetFilename().AsCString(), GetID());
 }
 
 Status NativeProcessAIX::GetFileLoadAddress(const llvm::StringRef &file_name,
-                                              lldb::addr_t &load_addr) {
+                                            lldb::addr_t &load_addr) {
   load_addr = LLDB_INVALID_ADDRESS;
 
   NativeThreadAIX &thread = *GetCurrentThread();
@@ -1570,7 +1567,8 @@ Status NativeProcessAIX::GetFileLoadAddress(const llvm::StringRef &file_name,
 
   // FIXME: buffer size
   struct ld_xinfo info[64];
-  if (ptrace64(PT_LDXINFO, reg_ctx.GetThread().GetID(), (long long)&(info[0]), sizeof(info), nullptr) == 0) {
+  if (ptrace64(PT_LDXINFO, reg_ctx.GetThread().GetID(), (long long)&(info[0]),
+               sizeof(info), nullptr) == 0) {
     load_addr = (unsigned long)info[0].ldinfo_textorg;
     return Status();
   }
@@ -1588,7 +1586,7 @@ NativeThreadAIX *NativeProcessAIX::GetCurrentThread() {
 }
 
 Status NativeProcessAIX::ResumeThread(NativeThreadAIX &thread,
-                                        lldb::StateType state, int signo) {
+                                      lldb::StateType state, int signo) {
   Log *const log = GetLog(POSIXLog::Thread);
   LLDB_LOG(log, "tid: {0}", thread.GetID());
 
@@ -1722,8 +1720,8 @@ static void GetVSRegister(lldb::tid_t tid, long long addr, void *buf) {
 // Wrapper for ptrace to catch errors and log calls. Note that ptrace sets
 // errno on error because -1 can be a valid result (i.e. for PTRACE_PEEK*)
 Status NativeProcessAIX::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
-                                         void *data, size_t data_size,
-                                         long *result) {
+                                       void *data, size_t data_size,
+                                       long *result) {
   Status error;
   long int ret;
 
@@ -1743,7 +1741,8 @@ Status NativeProcessAIX::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
   if (dirproc) {
     struct dirent *direntry = nullptr;
     while ((direntry = readdir(dirproc)) != nullptr) {
-      if (strcmp(direntry->d_name, ".") == 0 || strcmp(direntry->d_name, "..") == 0) {
+      if (strcmp(direntry->d_name, ".") == 0 ||
+          strcmp(direntry->d_name, "..") == 0) {
         continue;
       }
       tid = atoi(direntry->d_name);
@@ -1787,7 +1786,7 @@ Status NativeProcessAIX::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
     GetRegister(pid, GPR31, &(((GPR *)data)->r31));
     GetRegister(pid, IAR, &(((GPR *)data)->pc));
     GetRegister(pid, MSR, &(((GPR *)data)->msr));
-    //FIXME: origr3/softe/trap on AIX?
+    // FIXME: origr3/softe/trap on AIX?
     GetRegister(pid, CTR, &(((GPR *)data)->ctr));
     GetRegister(pid, LR, &(((GPR *)data)->lr));
     GetRegister(pid, XER, &(((GPR *)data)->xer));
@@ -1827,7 +1826,7 @@ Status NativeProcessAIX::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
     SetRegister(pid, GPR31, &(((GPR *)data)->r31));
     SetRegister(pid, IAR, &(((GPR *)data)->pc));
     SetRegister(pid, MSR, &(((GPR *)data)->msr));
-    //FIXME: origr3/softe/trap on AIX?
+    // FIXME: origr3/softe/trap on AIX?
     SetRegister(pid, CTR, &(((GPR *)data)->ctr));
     SetRegister(pid, LR, &(((GPR *)data)->lr));
     SetRegister(pid, XER, &(((GPR *)data)->xer));
@@ -2044,7 +2043,7 @@ Expected<json::Value> NativeProcessAIX::TraceGetState(StringRef type) {
   return NativeProcessProtocol::TraceGetState(type);
 }
 
-Expected<std::vector<uint8_t>> NativeProcessAIX::TraceGetBinaryData(
-    const TraceGetBinaryDataRequest &request) {
+Expected<std::vector<uint8_t>>
+NativeProcessAIX::TraceGetBinaryData(const TraceGetBinaryDataRequest &request) {
   return NativeProcessProtocol::TraceGetBinaryData(request);
 }
diff --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
index bdb6f7c500..5185abe1eb 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
@@ -14,16 +14,16 @@
 
 #include "lldb/Host/Debug.h"
 #include "lldb/Host/HostThread.h"
+#include "lldb/Host/aix/Support.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/lldb-types.h"
-#include "llvm/ADT/SmallPtrSet.h" 
-#include "lldb/Host/aix/Support.h"
+#include "llvm/ADT/SmallPtrSet.h"
 
 #include "NativeThreadAIX.h"
-#include "lldb/Host/common/NativeProcessProtocol.h"
 #include "Plugins/Process/Utility/NativeProcessSoftwareSingleStep.h"
+#include "lldb/Host/common/NativeProcessProtocol.h"
 
 namespace lldb_private {
 class Status;
@@ -38,24 +38,22 @@ namespace process_aix {
 ///
 /// Changes in the inferior process state are broadcasted.
 class NativeProcessAIX : public NativeProcessProtocol,
-                           private NativeProcessSoftwareSingleStep {
+                         private NativeProcessSoftwareSingleStep {
 public:
   class Manager : public NativeProcessProtocol::Manager {
   public:
-	Manager(MainLoop &mainloop);
+    Manager(MainLoop &mainloop);
 
     llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
     Launch(ProcessLaunchInfo &launch_info,
-            NativeDelegate &native_delegate) override;
+           NativeDelegate &native_delegate) override;
 
     llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
     Attach(lldb::pid_t pid, NativeDelegate &native_delegate) override;
 
     Extension GetSupportedExtensions() const override;
 
-    void AddProcess(NativeProcessAIX &process) {
-      m_processes.insert(&process);
-    }
+    void AddProcess(NativeProcessAIX &process) { m_processes.insert(&process); }
 
     void RemoveProcess(NativeProcessAIX &process) {
       m_processes.erase(&process);
@@ -72,7 +70,7 @@ public:
     // Threads (events) which haven't been claimed by any process.
     llvm::DenseSet<::pid_t> m_unowned_threads;
 
-	void SigchldHandler();
+    void SigchldHandler();
   };
 
   // NativeProcessProtocol Interface
@@ -189,8 +187,8 @@ private:
 
   // Private Instance Methods
   NativeProcessAIX(::pid_t pid, int terminal_fd, NativeDelegate &delegate,
-                     const ArchSpec &arch, Manager &manager,
-                     llvm::ArrayRef<::pid_t> tids);
+                   const ArchSpec &arch, Manager &manager,
+                   llvm::ArrayRef<::pid_t> tids);
 
   // Returns a list of process threads that we have attached to.
   static llvm::Expected<std::vector<::pid_t>> Attach(::pid_t pid);
@@ -273,8 +271,7 @@ private:
   Status PopulateMemoryRegionCache();
 
   // Handle a clone()-like event.
-  bool MonitorClone(NativeThreadAIX &parent, lldb::pid_t child_pid,
-                    int event);
+  bool MonitorClone(NativeThreadAIX &parent, lldb::pid_t child_pid, int event);
 };
 
 } // namespace process_aix
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
index 071e55543c..1364e83581 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
@@ -24,10 +24,11 @@ lldb::ByteOrder NativeRegisterContextAIX::GetByteOrder() const {
 }
 
 Status NativeRegisterContextAIX::ReadRegisterRaw(uint32_t reg_index,
-                                                   RegisterValue &reg_value) {
+                                                 RegisterValue &reg_value) {
   const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(reg_index);
   if (!reg_info)
-    return Status::FromErrorStringWithFormat("register %" PRIu32 " not found", reg_index);
+    return Status::FromErrorStringWithFormat("register %" PRIu32 " not found",
+                                             reg_index);
 
   return DoReadRegisterValue(GetPtraceOffset(reg_index), reg_info->name,
                              reg_info->byte_size, reg_value);
@@ -35,7 +36,7 @@ Status NativeRegisterContextAIX::ReadRegisterRaw(uint32_t reg_index,
 
 Status
 NativeRegisterContextAIX::WriteRegisterRaw(uint32_t reg_index,
-                                             const RegisterValue &reg_value) {
+                                           const RegisterValue &reg_value) {
   uint32_t reg_to_write = reg_index;
   RegisterValue value_to_write = reg_value;
 
@@ -82,54 +83,53 @@ NativeRegisterContextAIX::WriteRegisterRaw(uint32_t reg_index,
   assert(register_to_write_info_p &&
          "register to write does not have valid RegisterInfo");
   if (!register_to_write_info_p)
-    return Status::FromErrorStringWithFormat("NativeRegisterContextAIX::%s failed to get RegisterInfo "
-                  "for write register index %" PRIu32,
-                  __FUNCTION__, reg_to_write);
+    return Status::FromErrorStringWithFormat(
+        "NativeRegisterContextAIX::%s failed to get RegisterInfo "
+        "for write register index %" PRIu32,
+        __FUNCTION__, reg_to_write);
 
   return DoWriteRegisterValue(GetPtraceOffset(reg_index), reg_info->name,
                               reg_value);
 }
 
 Status NativeRegisterContextAIX::ReadGPR() {
-  return NativeProcessAIX::PtraceWrapper(
-      PTRACE_GETREGS, m_thread.GetID(), nullptr, GetGPRBuffer(), GetGPRSize());
+  return NativeProcessAIX::PtraceWrapper(PTRACE_GETREGS, m_thread.GetID(),
+                                         nullptr, GetGPRBuffer(), GetGPRSize());
 }
 
 Status NativeRegisterContextAIX::WriteGPR() {
-  return NativeProcessAIX::PtraceWrapper(
-      PTRACE_SETREGS, m_thread.GetID(), nullptr, GetGPRBuffer(), GetGPRSize());
+  return NativeProcessAIX::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(),
+                                         nullptr, GetGPRBuffer(), GetGPRSize());
 }
 
 Status NativeRegisterContextAIX::ReadFPR() {
   return NativeProcessAIX::PtraceWrapper(PTRACE_GETFPREGS, m_thread.GetID(),
-                                           nullptr, GetFPRBuffer(),
-                                           GetFPRSize());
+                                         nullptr, GetFPRBuffer(), GetFPRSize());
 }
 
 Status NativeRegisterContextAIX::WriteFPR() {
   return NativeProcessAIX::PtraceWrapper(PTRACE_SETFPREGS, m_thread.GetID(),
-                                           nullptr, GetFPRBuffer(),
-                                           GetFPRSize());
+                                         nullptr, GetFPRBuffer(), GetFPRSize());
 }
 
 Status NativeRegisterContextAIX::ReadRegisterSet(void *buf, size_t buf_size,
-                                                   unsigned int regset) {
+                                                 unsigned int regset) {
   return NativeProcessAIX::PtraceWrapper(PTRACE_GETREGSET, m_thread.GetID(),
-                                           static_cast<void *>(&regset), buf,
-                                           buf_size);
+                                         static_cast<void *>(&regset), buf,
+                                         buf_size);
 }
 
 Status NativeRegisterContextAIX::WriteRegisterSet(void *buf, size_t buf_size,
-                                                    unsigned int regset) {
+                                                  unsigned int regset) {
   return NativeProcessAIX::PtraceWrapper(PTRACE_SETREGSET, m_thread.GetID(),
-                                           static_cast<void *>(&regset), buf,
-                                           buf_size);
+                                         static_cast<void *>(&regset), buf,
+                                         buf_size);
 }
 
 Status NativeRegisterContextAIX::DoReadRegisterValue(uint32_t offset,
-                                                       const char *reg_name,
-                                                       uint32_t size,
-                                                       RegisterValue &value) {
+                                                     const char *reg_name,
+                                                     uint32_t size,
+                                                     RegisterValue &value) {
   Log *log = GetLog(POSIXLog::Registers);
 
   long data;
@@ -152,6 +152,6 @@ Status NativeRegisterContextAIX::DoWriteRegisterValue(
   void *buf = reinterpret_cast<void *>(value.GetAsUInt64());
   LLDB_LOG(log, "{0}: {1}", reg_name, buf);
 
-  return NativeProcessAIX::PtraceWrapper(
-      PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
+  return NativeProcessAIX::PtraceWrapper(PTRACE_POKEUSER, m_thread.GetID(),
+                                         reinterpret_cast<void *>(offset), buf);
 }
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
index 9c2a326856..df755824a2 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
@@ -28,10 +28,10 @@ public:
   // variant should be compiled into the final executable.
   static std::unique_ptr<NativeRegisterContextAIX>
   CreateHostNativeRegisterContextAIX(const ArchSpec &target_arch,
-                                       NativeThreadAIX &native_thread);
+                                     NativeThreadAIX &native_thread);
 
   // Invalidates cached values in register context data structures
-  virtual void InvalidateAllRegisters(){}
+  virtual void InvalidateAllRegisters() {}
 
   struct SyscallData {
     /// The syscall instruction. If the architecture uses software
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp
index 0132b52dec..104ac7301a 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp
@@ -13,12 +13,12 @@
 
 #include "NativeRegisterContextAIX_ppc64.h"
 
+#include "lldb/Host/aix/Ptrace.h"
 #include "lldb/Host/common/NativeProcessProtocol.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/Status.h"
-#include "lldb/Host/aix/Ptrace.h"
 
 #include "Plugins/Process/AIX/NativeProcessAIX.h"
 #include "Plugins/Process/Linux/Procfs.h"
@@ -27,10 +27,10 @@
 
 // System includes - They have to be included after framework includes because
 // they define some macros which collide with variable names in other modules
-#include <sys/socket.h>
-#include <sys/reg.h>
-#include <sys/ptrace.h>
 #include <sys/ldr.h>
+#include <sys/ptrace.h>
+#include <sys/reg.h>
+#include <sys/socket.h>
 
 #define REG_CONTEXT_SIZE                                                       \
   (GetGPRSize() + GetFPRSize() + sizeof(m_vmx_ppc64le) + sizeof(m_vsx_ppc64le))
@@ -39,63 +39,63 @@ using namespace lldb_private;
 using namespace lldb_private::process_aix;
 
 static const uint32_t g_gpr_regnums_ppc64le[] = {
-    gpr_r0_ppc64le,   gpr_r1_ppc64le,  gpr_r2_ppc64le,     gpr_r3_ppc64le,
-    gpr_r4_ppc64le,   gpr_r5_ppc64le,  gpr_r6_ppc64le,     gpr_r7_ppc64le,
-    gpr_r8_ppc64le,   gpr_r9_ppc64le,  gpr_r10_ppc64le,    gpr_r11_ppc64le,
-    gpr_r12_ppc64le,  gpr_r13_ppc64le, gpr_r14_ppc64le,    gpr_r15_ppc64le,
-    gpr_r16_ppc64le,  gpr_r17_ppc64le, gpr_r18_ppc64le,    gpr_r19_ppc64le,
-    gpr_r20_ppc64le,  gpr_r21_ppc64le, gpr_r22_ppc64le,    gpr_r23_ppc64le,
-    gpr_r24_ppc64le,  gpr_r25_ppc64le, gpr_r26_ppc64le,    gpr_r27_ppc64le,
-    gpr_r28_ppc64le,  gpr_r29_ppc64le, gpr_r30_ppc64le,    gpr_r31_ppc64le,
-    gpr_pc_ppc64le,   gpr_msr_ppc64le, gpr_origr3_ppc64le, gpr_ctr_ppc64le,
-    gpr_lr_ppc64le,   gpr_xer_ppc64le, gpr_cr_ppc64le,     gpr_softe_ppc64le,
+    gpr_r0_ppc64le,     gpr_r1_ppc64le,  gpr_r2_ppc64le,     gpr_r3_ppc64le,
+    gpr_r4_ppc64le,     gpr_r5_ppc64le,  gpr_r6_ppc64le,     gpr_r7_ppc64le,
+    gpr_r8_ppc64le,     gpr_r9_ppc64le,  gpr_r10_ppc64le,    gpr_r11_ppc64le,
+    gpr_r12_ppc64le,    gpr_r13_ppc64le, gpr_r14_ppc64le,    gpr_r15_ppc64le,
+    gpr_r16_ppc64le,    gpr_r17_ppc64le, gpr_r18_ppc64le,    gpr_r19_ppc64le,
+    gpr_r20_ppc64le,    gpr_r21_ppc64le, gpr_r22_ppc64le,    gpr_r23_ppc64le,
+    gpr_r24_ppc64le,    gpr_r25_ppc64le, gpr_r26_ppc64le,    gpr_r27_ppc64le,
+    gpr_r28_ppc64le,    gpr_r29_ppc64le, gpr_r30_ppc64le,    gpr_r31_ppc64le,
+    gpr_pc_ppc64le,     gpr_msr_ppc64le, gpr_origr3_ppc64le, gpr_ctr_ppc64le,
+    gpr_lr_ppc64le,     gpr_xer_ppc64le, gpr_cr_ppc64le,     gpr_softe_ppc64le,
     gpr_trap_ppc64le,
     LLDB_INVALID_REGNUM // register sets need to end with this flag
 };
 
 static const uint32_t g_fpr_regnums_ppc64le[] = {
-    fpr_f0_ppc64le,    fpr_f1_ppc64le,  fpr_f2_ppc64le,  fpr_f3_ppc64le,
-    fpr_f4_ppc64le,    fpr_f5_ppc64le,  fpr_f6_ppc64le,  fpr_f7_ppc64le,
-    fpr_f8_ppc64le,    fpr_f9_ppc64le,  fpr_f10_ppc64le, fpr_f11_ppc64le,
-    fpr_f12_ppc64le,   fpr_f13_ppc64le, fpr_f14_ppc64le, fpr_f15_ppc64le,
-    fpr_f16_ppc64le,   fpr_f17_ppc64le, fpr_f18_ppc64le, fpr_f19_ppc64le,
-    fpr_f20_ppc64le,   fpr_f21_ppc64le, fpr_f22_ppc64le, fpr_f23_ppc64le,
-    fpr_f24_ppc64le,   fpr_f25_ppc64le, fpr_f26_ppc64le, fpr_f27_ppc64le,
-    fpr_f28_ppc64le,   fpr_f29_ppc64le, fpr_f30_ppc64le, fpr_f31_ppc64le,
+    fpr_f0_ppc64le,     fpr_f1_ppc64le,  fpr_f2_ppc64le,  fpr_f3_ppc64le,
+    fpr_f4_ppc64le,     fpr_f5_ppc64le,  fpr_f6_ppc64le,  fpr_f7_ppc64le,
+    fpr_f8_ppc64le,     fpr_f9_ppc64le,  fpr_f10_ppc64le, fpr_f11_ppc64le,
+    fpr_f12_ppc64le,    fpr_f13_ppc64le, fpr_f14_ppc64le, fpr_f15_ppc64le,
+    fpr_f16_ppc64le,    fpr_f17_ppc64le, fpr_f18_ppc64le, fpr_f19_ppc64le,
+    fpr_f20_ppc64le,    fpr_f21_ppc64le, fpr_f22_ppc64le, fpr_f23_ppc64le,
+    fpr_f24_ppc64le,    fpr_f25_ppc64le, fpr_f26_ppc64le, fpr_f27_ppc64le,
+    fpr_f28_ppc64le,    fpr_f29_ppc64le, fpr_f30_ppc64le, fpr_f31_ppc64le,
     fpr_fpscr_ppc64le,
     LLDB_INVALID_REGNUM // register sets need to end with this flag
 };
 
 static const uint32_t g_vmx_regnums_ppc64le[] = {
-    vmx_vr0_ppc64le,  vmx_vr1_ppc64le,    vmx_vr2_ppc64le,  vmx_vr3_ppc64le,
-    vmx_vr4_ppc64le,  vmx_vr5_ppc64le,    vmx_vr6_ppc64le,  vmx_vr7_ppc64le,
-    vmx_vr8_ppc64le,  vmx_vr9_ppc64le,    vmx_vr10_ppc64le, vmx_vr11_ppc64le,
-    vmx_vr12_ppc64le, vmx_vr13_ppc64le,   vmx_vr14_ppc64le, vmx_vr15_ppc64le,
-    vmx_vr16_ppc64le, vmx_vr17_ppc64le,   vmx_vr18_ppc64le, vmx_vr19_ppc64le,
-    vmx_vr20_ppc64le, vmx_vr21_ppc64le,   vmx_vr22_ppc64le, vmx_vr23_ppc64le,
-    vmx_vr24_ppc64le, vmx_vr25_ppc64le,   vmx_vr26_ppc64le, vmx_vr27_ppc64le,
-    vmx_vr28_ppc64le, vmx_vr29_ppc64le,   vmx_vr30_ppc64le, vmx_vr31_ppc64le,
-    vmx_vscr_ppc64le, vmx_vrsave_ppc64le,
+    vmx_vr0_ppc64le,    vmx_vr1_ppc64le,    vmx_vr2_ppc64le,  vmx_vr3_ppc64le,
+    vmx_vr4_ppc64le,    vmx_vr5_ppc64le,    vmx_vr6_ppc64le,  vmx_vr7_ppc64le,
+    vmx_vr8_ppc64le,    vmx_vr9_ppc64le,    vmx_vr10_ppc64le, vmx_vr11_ppc64le,
+    vmx_vr12_ppc64le,   vmx_vr13_ppc64le,   vmx_vr14_ppc64le, vmx_vr15_ppc64le,
+    vmx_vr16_ppc64le,   vmx_vr17_ppc64le,   vmx_vr18_ppc64le, vmx_vr19_ppc64le,
+    vmx_vr20_ppc64le,   vmx_vr21_ppc64le,   vmx_vr22_ppc64le, vmx_vr23_ppc64le,
+    vmx_vr24_ppc64le,   vmx_vr25_ppc64le,   vmx_vr26_ppc64le, vmx_vr27_ppc64le,
+    vmx_vr28_ppc64le,   vmx_vr29_ppc64le,   vmx_vr30_ppc64le, vmx_vr31_ppc64le,
+    vmx_vscr_ppc64le,   vmx_vrsave_ppc64le,
     LLDB_INVALID_REGNUM // register sets need to end with this flag
 };
 
 static const uint32_t g_vsx_regnums_ppc64le[] = {
-    vsx_vs0_ppc64le,  vsx_vs1_ppc64le,  vsx_vs2_ppc64le,  vsx_vs3_ppc64le,
-    vsx_vs4_ppc64le,  vsx_vs5_ppc64le,  vsx_vs6_ppc64le,  vsx_vs7_ppc64le,
-    vsx_vs8_ppc64le,  vsx_vs9_ppc64le,  vsx_vs10_ppc64le, vsx_vs11_ppc64le,
-    vsx_vs12_ppc64le, vsx_vs13_ppc64le, vsx_vs14_ppc64le, vsx_vs15_ppc64le,
-    vsx_vs16_ppc64le, vsx_vs17_ppc64le, vsx_vs18_ppc64le, vsx_vs19_ppc64le,
-    vsx_vs20_ppc64le, vsx_vs21_ppc64le, vsx_vs22_ppc64le, vsx_vs23_ppc64le,
-    vsx_vs24_ppc64le, vsx_vs25_ppc64le, vsx_vs26_ppc64le, vsx_vs27_ppc64le,
-    vsx_vs28_ppc64le, vsx_vs29_ppc64le, vsx_vs30_ppc64le, vsx_vs31_ppc64le,
-    vsx_vs32_ppc64le, vsx_vs33_ppc64le, vsx_vs34_ppc64le, vsx_vs35_ppc64le,
-    vsx_vs36_ppc64le, vsx_vs37_ppc64le, vsx_vs38_ppc64le, vsx_vs39_ppc64le,
-    vsx_vs40_ppc64le, vsx_vs41_ppc64le, vsx_vs42_ppc64le, vsx_vs43_ppc64le,
-    vsx_vs44_ppc64le, vsx_vs45_ppc64le, vsx_vs46_ppc64le, vsx_vs47_ppc64le,
-    vsx_vs48_ppc64le, vsx_vs49_ppc64le, vsx_vs50_ppc64le, vsx_vs51_ppc64le,
-    vsx_vs52_ppc64le, vsx_vs53_ppc64le, vsx_vs54_ppc64le, vsx_vs55_ppc64le,
-    vsx_vs56_ppc64le, vsx_vs57_ppc64le, vsx_vs58_ppc64le, vsx_vs59_ppc64le,
-    vsx_vs60_ppc64le, vsx_vs61_ppc64le, vsx_vs62_ppc64le, vsx_vs63_ppc64le,
+    vsx_vs0_ppc64le,    vsx_vs1_ppc64le,  vsx_vs2_ppc64le,  vsx_vs3_ppc64le,
+    vsx_vs4_ppc64le,    vsx_vs5_ppc64le,  vsx_vs6_ppc64le,  vsx_vs7_ppc64le,
+    vsx_vs8_ppc64le,    vsx_vs9_ppc64le,  vsx_vs10_ppc64le, vsx_vs11_ppc64le,
+    vsx_vs12_ppc64le,   vsx_vs13_ppc64le, vsx_vs14_ppc64le, vsx_vs15_ppc64le,
+    vsx_vs16_ppc64le,   vsx_vs17_ppc64le, vsx_vs18_ppc64le, vsx_vs19_ppc64le,
+    vsx_vs20_ppc64le,   vsx_vs21_ppc64le, vsx_vs22_ppc64le, vsx_vs23_ppc64le,
+    vsx_vs24_ppc64le,   vsx_vs25_ppc64le, vsx_vs26_ppc64le, vsx_vs27_ppc64le,
+    vsx_vs28_ppc64le,   vsx_vs29_ppc64le, vsx_vs30_ppc64le, vsx_vs31_ppc64le,
+    vsx_vs32_ppc64le,   vsx_vs33_ppc64le, vsx_vs34_ppc64le, vsx_vs35_ppc64le,
+    vsx_vs36_ppc64le,   vsx_vs37_ppc64le, vsx_vs38_ppc64le, vsx_vs39_ppc64le,
+    vsx_vs40_ppc64le,   vsx_vs41_ppc64le, vsx_vs42_ppc64le, vsx_vs43_ppc64le,
+    vsx_vs44_ppc64le,   vsx_vs45_ppc64le, vsx_vs46_ppc64le, vsx_vs47_ppc64le,
+    vsx_vs48_ppc64le,   vsx_vs49_ppc64le, vsx_vs50_ppc64le, vsx_vs51_ppc64le,
+    vsx_vs52_ppc64le,   vsx_vs53_ppc64le, vsx_vs54_ppc64le, vsx_vs55_ppc64le,
+    vsx_vs56_ppc64le,   vsx_vs57_ppc64le, vsx_vs58_ppc64le, vsx_vs59_ppc64le,
+    vsx_vs60_ppc64le,   vsx_vs61_ppc64le, vsx_vs62_ppc64le, vsx_vs63_ppc64le,
     LLDB_INVALID_REGNUM // register sets need to end with this flag
 };
 
@@ -119,7 +119,7 @@ NativeRegisterContextAIX::CreateHostNativeRegisterContextAIX(
   switch (target_arch.GetMachine()) {
   case llvm::Triple::ppc64:
     return std::make_unique<NativeRegisterContextAIX_ppc64>(target_arch,
-                                                                 native_thread);
+                                                            native_thread);
   default:
     llvm_unreachable("have no register context for architecture");
   }
@@ -160,8 +160,9 @@ uint32_t NativeRegisterContextAIX_ppc64::GetUserRegisterCount() const {
   return count;
 }
 
-Status NativeRegisterContextAIX_ppc64::ReadRegister(
-    const RegisterInfo *reg_info, RegisterValue &reg_value) {
+Status
+NativeRegisterContextAIX_ppc64::ReadRegister(const RegisterInfo *reg_info,
+                                             RegisterValue &reg_value) {
   Status error;
 
   if (!reg_info) {
@@ -232,7 +233,7 @@ Status NativeRegisterContextAIX_ppc64::ReadRegister(
     if (error.Fail())
       return error;
 
-    uint8_t *src = (uint8_t *) &m_gpr_ppc64le + reg_info->byte_offset;
+    uint8_t *src = (uint8_t *)&m_gpr_ppc64le + reg_info->byte_offset;
     reg_value.SetFromMemoryData(*reg_info, src, reg_info->byte_size,
                                 eByteOrderLittle, error);
   } else {
@@ -243,17 +244,18 @@ Status NativeRegisterContextAIX_ppc64::ReadRegister(
   return error;
 }
 
-Status NativeRegisterContextAIX_ppc64::WriteRegister(
-    const RegisterInfo *reg_info, const RegisterValue &reg_value) {
+Status
+NativeRegisterContextAIX_ppc64::WriteRegister(const RegisterInfo *reg_info,
+                                              const RegisterValue &reg_value) {
   Status error;
   if (!reg_info)
     return Status("reg_info NULL");
 
   const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB];
   if (reg_index == LLDB_INVALID_REGNUM)
-    return Status::FromErrorStringWithFormat("no lldb regnum for %s", reg_info && reg_info->name
-                                               ? reg_info->name
-                                               : "<unknown register>");
+    return Status::FromErrorStringWithFormat(
+        "no lldb regnum for %s",
+        reg_info && reg_info->name ? reg_info->name : "<unknown register>");
 
   if (IsGPR(reg_index)) {
     error = ReadGPR();
@@ -389,7 +391,7 @@ Status NativeRegisterContextAIX_ppc64::WriteAllRegisterValues(
   Status error;
 
   if (!data_sp) {
-    error = Status::FromErrorStringWithFormat( 
+    error = Status::FromErrorStringWithFormat(
         "NativeRegisterContextAIX_ppc64::%s invalid data_sp provided",
         __FUNCTION__);
     return error;
@@ -405,10 +407,11 @@ Status NativeRegisterContextAIX_ppc64::WriteAllRegisterValues(
 
   const uint8_t *src = data_sp->GetBytes();
   if (src == nullptr) {
-    error = Status::FromErrorStringWithFormat("NativeRegisterContextAIX_ppc64::%s "
-                                   "DataBuffer::GetBytes() returned a null "
-                                   "pointer",
-                                   __FUNCTION__);
+    error = Status::FromErrorStringWithFormat(
+        "NativeRegisterContextAIX_ppc64::%s "
+        "DataBuffer::GetBytes() returned a null "
+        "pointer",
+        __FUNCTION__);
     return error;
   }
 
@@ -467,30 +470,30 @@ uint32_t NativeRegisterContextAIX_ppc64::CalculateVsxOffset(
 
 Status NativeRegisterContextAIX_ppc64::ReadVMX() {
   return NativeProcessAIX::PtraceWrapper(PTRACE_GETVRREGS, m_thread.GetID(),
-                                           nullptr, &m_vmx_ppc64le,
-                                           sizeof(m_vmx_ppc64le));
+                                         nullptr, &m_vmx_ppc64le,
+                                         sizeof(m_vmx_ppc64le));
 }
 
 Status NativeRegisterContextAIX_ppc64::WriteVMX() {
-  //FIXME
-  int regset = 0/*NT_PPC_VMX*/;
-  return NativeProcessAIX::PtraceWrapper(PT_CLEAR/*PTRACE_SETVRREGS*/, m_thread.GetID(),
-                                           &regset, &m_vmx_ppc64le,
-                                           sizeof(m_vmx_ppc64le));
+  // FIXME
+  int regset = 0 /*NT_PPC_VMX*/;
+  return NativeProcessAIX::PtraceWrapper(PT_CLEAR /*PTRACE_SETVRREGS*/,
+                                         m_thread.GetID(), &regset,
+                                         &m_vmx_ppc64le, sizeof(m_vmx_ppc64le));
 }
 
 Status NativeRegisterContextAIX_ppc64::ReadVSX() {
   return NativeProcessAIX::PtraceWrapper(PTRACE_GETVSRREGS, m_thread.GetID(),
-                                           nullptr, &m_vsx_ppc64le,
-                                           sizeof(m_vsx_ppc64le));
+                                         nullptr, &m_vsx_ppc64le,
+                                         sizeof(m_vsx_ppc64le));
 }
 
 Status NativeRegisterContextAIX_ppc64::WriteVSX() {
-  //FIXME
-  int regset = 0/*NT_PPC_VSX*/;
-  return NativeProcessAIX::PtraceWrapper(PT_CLEAR/*PTRACE_SETVSRREGS*/, m_thread.GetID(),
-                                           &regset, &m_vsx_ppc64le,
-                                           sizeof(m_vsx_ppc64le));
+  // FIXME
+  int regset = 0 /*NT_PPC_VSX*/;
+  return NativeProcessAIX::PtraceWrapper(PT_CLEAR /*PTRACE_SETVSRREGS*/,
+                                         m_thread.GetID(), &regset,
+                                         &m_vsx_ppc64le, sizeof(m_vsx_ppc64le));
 }
 
 bool NativeRegisterContextAIX_ppc64::IsVMX(unsigned reg) {
@@ -534,8 +537,8 @@ uint32_t NativeRegisterContextAIX_ppc64::SetHardwareWatchpoint(
   // watchpoint flag to match ppc64le write-read bit configuration.
   switch (watch_flags) {
   case eWatchpointKindWrite:
-    //FIXME
-    //rw_mode = 0/*PPC_BREAKPOINT_TRIGGER_WRITE*/;
+    // FIXME
+    // rw_mode = 0/*PPC_BREAKPOINT_TRIGGER_WRITE*/;
     watch_flags = 2;
     break;
   // Watchpoint read not supported
@@ -583,7 +586,7 @@ uint32_t NativeRegisterContextAIX_ppc64::SetHardwareWatchpoint(
   m_hwp_regs[wp_index].real_addr = real_addr;
   m_hwp_regs[wp_index].address = addr;
   m_hwp_regs[wp_index].control = control_value;
-  //m_hwp_regs[wp_index].mode = rw_mode;
+  // m_hwp_regs[wp_index].mode = rw_mode;
 
   // PTRACE call to set corresponding watchpoint register.
   error = WriteHardwareDebugRegs();
@@ -624,9 +627,9 @@ bool NativeRegisterContextAIX_ppc64::ClearHardwareWatchpoint(
   m_hwp_regs[wp_index].mode = 0;
 
   // Ptrace call to update hardware debug registers
-  //FIXME
-  error = NativeProcessAIX::PtraceWrapper(PT_CLEAR/*PPC_PTRACE_DELHWDEBUG*/,
-                                            m_thread.GetID(), 0, tempSlot);
+  // FIXME
+  error = NativeProcessAIX::PtraceWrapper(PT_CLEAR /*PPC_PTRACE_DELHWDEBUG*/,
+                                          m_thread.GetID(), 0, tempSlot);
 
   if (error.Fail()) {
     m_hwp_regs[wp_index].control = tempControl;
@@ -639,8 +642,7 @@ bool NativeRegisterContextAIX_ppc64::ClearHardwareWatchpoint(
   return true;
 }
 
-uint32_t
-NativeRegisterContextAIX_ppc64::GetWatchpointSize(uint32_t wp_index) {
+uint32_t NativeRegisterContextAIX_ppc64::GetWatchpointSize(uint32_t wp_index) {
   Log *log = GetLog(POSIXLog::Watchpoints);
   LLDB_LOG(log, "wp_index: {0}", wp_index);
 
@@ -652,16 +654,16 @@ NativeRegisterContextAIX_ppc64::GetWatchpointSize(uint32_t wp_index) {
   return 0;
 }
 
-bool NativeRegisterContextAIX_ppc64::WatchpointIsEnabled(
-    uint32_t wp_index) {
+bool NativeRegisterContextAIX_ppc64::WatchpointIsEnabled(uint32_t wp_index) {
   Log *log = GetLog(POSIXLog::Watchpoints);
   LLDB_LOG(log, "wp_index: {0}", wp_index);
 
   return !!((m_hwp_regs[wp_index].control & 0x1) == 0x1);
 }
 
-Status NativeRegisterContextAIX_ppc64::GetWatchpointHitIndex(
-    uint32_t &wp_index, lldb::addr_t trap_addr) {
+Status
+NativeRegisterContextAIX_ppc64::GetWatchpointHitIndex(uint32_t &wp_index,
+                                                      lldb::addr_t trap_addr) {
   Log *log = GetLog(POSIXLog::Watchpoints);
   LLDB_LOG(log, "wp_index: {0}, trap_addr: {1:x}", wp_index, trap_addr);
 
@@ -731,7 +733,9 @@ Status NativeRegisterContextAIX_ppc64::WriteHardwareDebugRegs() {
     if ((m_hwp_regs[i].control & 1) == 0)
       continue;
 
-    error = NativeProcessAIX::PtraceWrapper(PT_WATCH, m_thread.GetID(), (void *)m_hwp_regs[i].address, nullptr, 8, &ret);
+    error = NativeProcessAIX::PtraceWrapper(PT_WATCH, m_thread.GetID(),
+                                            (void *)m_hwp_regs[i].address,
+                                            nullptr, 8, &ret);
 
     if (error.Fail())
       return error;
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h
index a29f786f23..74641710d8 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h
@@ -29,7 +29,7 @@ class NativeProcessAIX;
 class NativeRegisterContextAIX_ppc64 : public NativeRegisterContextAIX {
 public:
   NativeRegisterContextAIX_ppc64(const ArchSpec &target_arch,
-                                     NativeThreadProtocol &native_thread);
+                                 NativeThreadProtocol &native_thread);
 
   uint32_t GetRegisterSetCount() const override;
 
diff --git a/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
index bb14b6ab4a..d1581ec6b7 100644
--- a/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
@@ -25,9 +25,9 @@
 
 #include "Plugins/Process/POSIX/CrashReason.h"
 
-#include <sys/types.h>
-#include <sys/ptrace.h>
 #include <signal.h>
+#include <sys/ptrace.h>
+#include <sys/types.h>
 
 #if 0
 #include <sys/syscall.h>
@@ -89,10 +89,9 @@ void LogThreadStopInfo(Log &log, const ThreadStopInfo &stop_info,
                static_cast<uint32_t>(stop_info.reason));
   }
 }
-}
+} // namespace
 
-NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process,
-                                     lldb::tid_t tid)
+NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
     : NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
       m_stop_info(),
       m_reg_context_up(
@@ -112,7 +111,7 @@ std::string NativeThreadAIX::GetName() {
 lldb::StateType NativeThreadAIX::GetState() { return m_state; }
 
 bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
-                                      std::string &description) {
+                                    std::string &description) {
   Log *log = GetLog(LLDBLog::Thread);
 
   description.clear();
@@ -151,7 +150,7 @@ bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
 }
 
 Status NativeThreadAIX::SetWatchpoint(lldb::addr_t addr, size_t size,
-                                        uint32_t watch_flags, bool hardware) {
+                                      uint32_t watch_flags, bool hardware) {
   if (!hardware)
     return Status("not implemented");
   if (m_state == eStateLaunching)
@@ -178,8 +177,7 @@ Status NativeThreadAIX::RemoveWatchpoint(lldb::addr_t addr) {
   return Status("Clearing hardware watchpoint failed.");
 }
 
-Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr,
-                                                size_t size) {
+Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) {
   if (m_state == eStateLaunching)
     return Status();
 
@@ -249,7 +247,7 @@ Status NativeThreadAIX::Resume(uint32_t signo) {
     data = signo;
 
   return NativeProcessAIX::PtraceWrapper(PT_CONTINUE, GetID(), nullptr,
-                                           reinterpret_cast<void *>(data));
+                                         reinterpret_cast<void *>(data));
 }
 
 Status NativeThreadAIX::SingleStep(uint32_t signo) {
@@ -400,7 +398,7 @@ void NativeThreadAIX::SetStoppedByWatchpoint(uint32_t wp_index) {
    * find the base address of the load/store instruction and append it in the
    * stop-info
    * packet.
-  */
+   */
   ostr << " " << m_reg_context_up->GetWatchpointHitAddress(wp_index);
 
   m_stop_description = ostr.str();
@@ -448,8 +446,7 @@ void NativeThreadAIX::SetStoppedWithNoReason() {
   m_stop_info.signo = 0;
 }
 
-void NativeThreadAIX::SetStoppedByProcessorTrace(
-    llvm::StringRef description) {
+void NativeThreadAIX::SetStoppedByProcessorTrace(llvm::StringRef description) {
   SetStopped();
 
   m_stop_info.reason = StopReason::eStopReasonProcessorTrace;
@@ -482,8 +479,7 @@ Status NativeThreadAIX::RequestStop() {
   errno = 0;
   if (::kill(pid, SIGSTOP) != 0) {
     err = Status::FromErrno();
-    LLDB_LOGF(log,
-              "NativeThreadAIX::%s kill(%" PRIu64 ", SIGSTOP) failed: %s",
+    LLDB_LOGF(log, "NativeThreadAIX::%s kill(%" PRIu64 ", SIGSTOP) failed: %s",
               __FUNCTION__, pid, err.AsCString());
   }
   return err;
diff --git a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
index db271357d7..9760e30b71 100644
--- a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -65,7 +65,7 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
         if (toc_list.GetContextAtIndex(i, tocSC)) {
           if (tocSC.module_sp == sc.module_sp) {
             if (tocSC.GetAddressRange(eSymbolContextSymbol, 0, false,
-                                   toc_range)) {
+                                      toc_range)) {
               break;
             }
           }
@@ -123,10 +123,9 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
             process->GetTarget().GetPlatform()->GetMmapArgumentList(
                 arch, addr, length, prot_arg, flags, fd, offset);
 #if defined(__AIX__)
-        lldb::ThreadPlanSP call_plan_sp(
-            new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(),
-                                       toc_range.GetBaseAddress(),
-                                       void_ptr_type, args, options));
+        lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallFunction(
+            *thread, mmap_range.GetBaseAddress(), toc_range.GetBaseAddress(),
+            void_ptr_type, args, options));
 #else
         lldb::ThreadPlanSP call_plan_sp(
             new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(),
diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
index d9b41d5951..8f8b6a159b 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
@@ -23,7 +23,7 @@
 static const lldb_private::RegisterInfo *
 GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
   switch (target_arch.GetMachine()) {
-  //HH
+  // HH
   case llvm::Triple::ppc64:
   case llvm::Triple::ppc64le:
     return g_register_infos_ppc64le;
@@ -36,7 +36,7 @@ GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
 static uint32_t
 GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch) {
   switch (target_arch.GetMachine()) {
-  //HitchHike
+  // HitchHike
   case llvm::Triple::ppc64:
   case llvm::Triple::ppc64le:
     return static_cast<uint32_t>(sizeof(g_register_infos_ppc64le) /
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 923b3077f5..9b79834d75 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1716,8 +1716,7 @@ Status GDBRemoteCommunicationClient::GetMemoryRegionInfo(
 }
 
 #if defined(__AIX__)
-Status GDBRemoteCommunicationClient::GetLDXINFO(struct ld_xinfo *info_ptr)
-{
+Status GDBRemoteCommunicationClient::GetLDXINFO(struct ld_xinfo *info_ptr) {
   Status error;
 
   char packet[64];
@@ -1725,12 +1724,12 @@ Status GDBRemoteCommunicationClient::GetLDXINFO(struct ld_xinfo *info_ptr)
   assert(packet_len < (int)sizeof(packet));
   UNUSED_IF_ASSERT_DISABLED(packet_len);
   StringExtractorGDBRemote response;
-  if (SendPacketAndWaitForResponse(packet, response) ==
-          PacketResult::Success &&
+  if (SendPacketAndWaitForResponse(packet, response) == PacketResult::Success &&
       response.GetResponseType() == StringExtractorGDBRemote::eResponse) {
-    llvm::MutableArrayRef<uint8_t> infoData((uint8_t *)info_ptr, sizeof(struct ld_xinfo)*64);
+    llvm::MutableArrayRef<uint8_t> infoData((uint8_t *)info_ptr,
+                                            sizeof(struct ld_xinfo) * 64);
     size_t got_bytes = response.GetHexBytesAvail(infoData);
-    if (got_bytes != sizeof(struct ld_xinfo)*64) {
+    if (got_bytes != sizeof(struct ld_xinfo) * 64) {
       error.FromErrorString("qLDXINFO ret bad size");
       return error;
     }
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 4f1ef0898b..7061dba88d 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -196,8 +196,9 @@ void GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers() {
                                 &GDBRemoteCommunicationServerLLGS::Handle_Z);
   RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_z,
                                 &GDBRemoteCommunicationServerLLGS::Handle_z);
-  RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_qLDXINFO,
-                                &GDBRemoteCommunicationServerLLGS::Handle_qLDXINFO);
+  RegisterMemberFunctionHandler(
+      StringExtractorGDBRemote::eServerPacketType_qLDXINFO,
+      &GDBRemoteCommunicationServerLLGS::Handle_qLDXINFO);
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_QPassSignals,
       &GDBRemoteCommunicationServerLLGS::Handle_QPassSignals);
@@ -3003,7 +3004,8 @@ GDBRemoteCommunicationServerLLGS::Handle_z(StringExtractorGDBRemote &packet) {
 }
 
 GDBRemoteCommunication::PacketResult
-GDBRemoteCommunicationServerLLGS::Handle_qLDXINFO(StringExtractorGDBRemote &packet) {
+GDBRemoteCommunicationServerLLGS::Handle_qLDXINFO(
+    StringExtractorGDBRemote &packet) {
   if (!m_current_process ||
       (m_current_process->GetID() == LLDB_INVALID_PROCESS_ID)) {
     Log *log = GetLog(LLDBLog::Process);
@@ -3014,7 +3016,8 @@ GDBRemoteCommunicationServerLLGS::Handle_qLDXINFO(StringExtractorGDBRemote &pack
 #if defined(__AIX__)
   // FIXME: buffer size
   struct ld_xinfo info[64];
-  if (ptrace64(PT_LDXINFO, m_current_process->GetID(), (long long)&(info[0]), sizeof(info), nullptr) != 0) {
+  if (ptrace64(PT_LDXINFO, m_current_process->GetID(), (long long)&(info[0]),
+               sizeof(info), nullptr) != 0) {
     return SendErrorResponse(0xff);
   }
   StreamGDBRemote response;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 6af66699c3..5888d44de3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -932,7 +932,7 @@ const DWARFDebugAranges &DWARFUnit::GetFunctionAranges() {
 }
 
 /* AIX-NOTE - TODO: Removed conflicting code due to merge conflicts
- * Refer Patches: 27,28,29,30,35 and 76 
+ * Refer Patches: 27,28,29,30,35 and 76
  * and modify the code accordingly. */
 
 bool UGLY_FLAG_FOR_AIX __attribute__((weak)) = false;
@@ -1016,7 +1016,7 @@ uint32_t DWARFUnit::GetHeaderByteSize() const {
   switch (m_header.getUnitType()) {
   case llvm::dwarf::DW_UT_compile:
     if (UGLY_FLAG_FOR_AIX)
-      return 11 + 4/*GetDWARFSizeOfOffset*/;
+      return 11 + 4 /*GetDWARFSizeOfOffset*/;
     else
       return GetVersion() < 5 ? 11 : 12;
   case llvm::dwarf::DW_UT_partial:
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp
index 57f42ea56c..2de4f10e4c 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1525,7 +1525,8 @@ RegisterContextUnwind::SavedLocationForRegister(
           UnwindLLDB::RegisterLocation::eRegisterInLiveRegisterContext;
       new_regloc.location.register_number = regnum.GetAsKind(eRegisterKindLLDB);
 #ifdef __AIX__
-      if (UGLY_HACK_NULL_TOPFRAME && new_regloc.location.register_number == 0x20) {
+      if (UGLY_HACK_NULL_TOPFRAME &&
+          new_regloc.location.register_number == 0x20) {
         new_regloc.location.register_number = 0x24;
       }
 #endif
@@ -2398,12 +2399,11 @@ bool RegisterContextUnwind::ReadLR(addr_t &lr) {
     // through a NULL pointer -- we want to be able to unwind past that frame
     // to help find the bug.
 
-    ProcessSP process_sp (m_thread.GetProcess());
-    if (process_sp)
-    {
-        ABI *abi = process_sp->GetABI().get();
-        if (abi)
-            lr = abi->FixCodeAddress(lr);
+    ProcessSP process_sp(m_thread.GetProcess());
+    if (process_sp) {
+      ABI *abi = process_sp->GetABI().get();
+      if (abi)
+        lr = abi->FixCodeAddress(lr);
     }
 
     return !(m_all_registers_available == false &&
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index 0926579ea2..3730e04e43 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -129,8 +129,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction(
 
 ThreadPlanCallFunction::ThreadPlanCallFunction(
     Thread &thread, const Address &function, const Address &toc,
-    const CompilerType &return_type,
-    llvm::ArrayRef<addr_t> args, const EvaluateExpressionOptions &options)
+    const CompilerType &return_type, llvm::ArrayRef<addr_t> args,
+    const EvaluateExpressionOptions &options)
     : ThreadPlan(ThreadPlan::eKindCallFunction, "Call function plan", thread,
                  eVoteNoOpinion, eVoteNoOpinion),
       m_valid(false), m_stop_other_threads(options.GetStopOthers()),
diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index ac91183a27..85bb85044e 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -14,7 +14,6 @@
 #include "lldb/lldb-defines.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/BinaryFormat/COFF.h"
-#include "llvm/BinaryFormat/XCOFF.h"
 #include "llvm/BinaryFormat/ELF.h"
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/BinaryFormat/XCOFF.h"
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index f7eaf56738..ca350a569a 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -639,7 +639,8 @@ void sigwinch_handler(int signo) {
 }
 
 void sigint_handler(int signo) {
-#if defined(_WIN32) || defined(__AIX__) // Restore handler as it is not persistent on Windows
+#if defined(_WIN32) ||                                                         \
+    defined(__AIX__) // Restore handler as it is not persistent on Windows
   signal(SIGINT, sigint_handler);
 #endif
   static std::atomic_flag g_interrupt_sent = ATOMIC_FLAG_INIT;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 9c96df1bbd..3a52563393 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -274,11 +274,10 @@ Error DWARFUnitHeader::extract(DWARFContext &Context,
         FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
   } else {
     if (UGLY_FLAG_FOR_AIX) {
-        AbbrOffset = debug_info.getRelocatedValue(
-            8, offset_ptr, nullptr, &Err);
+      AbbrOffset = debug_info.getRelocatedValue(8, offset_ptr, nullptr, &Err);
     } else {
-        AbbrOffset = debug_info.getRelocatedValue(
-            FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
+      AbbrOffset = debug_info.getRelocatedValue(
+          FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
     }
     FormParams.AddrSize = debug_info.getU8(offset_ptr, &Err);
     // Fake a unit type based on the section type.  This isn't perfect,

dmpolukhin pushed a commit to dmpolukhin/llvm-project that referenced this pull request Sep 2, 2024
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. llvm#101657 

The complete changes for porting are present in this draft PR:
llvm#102601 

The changes in this PR are intended to update the Architecture entry for
LLDB with XCOFF,PPC.

1. Added new ArchitectureType `eArchTypeXCOFF`
2. Added a new `ArchDefinitionEntry g_xcoff_arch_entries[]`
3. Added a new case for `XCOFF in ArchSpec::SetArchitecture(..)`
4. Updated `ArchDefinition *g_arch_definitions[]`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen clang Clang issues not falling into any other category debuginfo lldb llvm:binary-utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants