-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Extending LLDB to work on AIX #102601
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
base: main
Are you sure you want to change the base?
Extending LLDB to work on AIX #102601
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be 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 If you have received no comments on your PR for a week, you can request a review 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. |
@llvm/pr-subscribers-lldb @llvm/pr-subscribers-clang-codegen Author: None (Dhruv-Srivastava-IBM) ChangesWe have Implemented the necessary code changes required to run LLDB on AIX. This PR is for discussion as asked in #101657 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:
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]
|
@llvm/pr-subscribers-clang Author: None (Dhruv-Srivastava-IBM) ChangesWe have Implemented the necessary code changes required to run LLDB on AIX. This PR is for discussion as asked in #101657 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:
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]
|
There was a problem hiding this 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.
lldb/NOTICE.TXT
Outdated
This product contains small piece of code to support AIX, taken from netbsd. | ||
|
||
* LICENSE: | ||
* lldb/source/Host/common/LICENSE.aix-netbsd.txt (OpenSSL License) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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.
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
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[]`
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[]`
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- lldb/include/lldb/Host/aix/Host.h lldb/include/lldb/Host/aix/Ptrace.h lldb/include/lldb/Host/aix/Support.h 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/AIXCore/ObjectFileAIXCore.cpp lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.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-core/AIXCore.cpp lldb/source/Plugins/Process/aix-core/AIXCore.h lldb/source/Plugins/Process/aix-core/ProcessAIXCore.cpp lldb/source/Plugins/Process/aix-core/ProcessAIXCore.h lldb/source/Plugins/Process/aix-core/RegisterContextCoreAIX_ppc64.cpp lldb/source/Plugins/Process/aix-core/RegisterContextCoreAIX_ppc64.h lldb/source/Plugins/Process/aix-core/ThreadAIXCore.cpp lldb/source/Plugins/Process/aix-core/ThreadAIXCore.h clang/lib/CodeGen/CGObjCMac.cpp clang/test/SemaCXX/class-layout.cpp lldb/include/lldb/Core/Module.h lldb/include/lldb/Core/ModuleSpec.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/Target.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/ModuleList.cpp lldb/source/Core/Section.cpp lldb/source/Host/aix/Host.cpp lldb/source/Host/common/GetOptInc.cpp lldb/source/Host/common/Host.cpp lldb/source/Host/common/XML.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/ObjectFile/Minidump/ObjectFileMinidump.cpp lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp lldb/source/Plugins/Process/AIX/NativeProcessAIX.h lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp lldb/source/Plugins/Process/AIX/NativeThreadAIX.h 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/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 be7c23ec6..b0b081e16 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) {
@@ -122,7 +123,7 @@ public:
ConstString &GetObjectName() { return m_object_name; }
ConstString GetObjectName() const { return m_object_name; }
-
+
void SetObjectName(ConstString objName) { m_object_name = objName; }
uint64_t GetObjectOffset() const { return m_object_offset; }
diff --git a/lldb/include/lldb/Host/XML.h b/lldb/include/lldb/Host/XML.h
index 483589f1a..921edbe0a 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/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
index 88928f181..72737fd9b 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 2de770c42..aac38f206 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -407,7 +407,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 32d74eac2..d65841580 100644
--- a/lldb/include/lldb/Target/DynamicLoader.h
+++ b/lldb/include/lldb/Target/DynamicLoader.h
@@ -372,10 +372,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/Target.h b/lldb/include/lldb/Target/Target.h
index fbed369ce..f8ca49035 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -538,7 +538,6 @@ public:
eBroadcastBitSymbolsChanged = (1 << 5),
};
-
// These two functions fill out the Broadcaster interface:
static llvm::StringRef GetStaticBroadcasterClass();
@@ -1677,9 +1676,8 @@ public:
TargetStats &GetStatistics() { return m_stats; }
public:
- SectionLoadList &GetSectionLoadListPublic() {
- return GetSectionLoadList();
- }
+ SectionLoadList &GetSectionLoadListPublic() { return GetSectionLoadList(); }
+
protected:
/// Construct with optional file and arch.
///
diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index 7880db159..4925093c1 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 a2aaa2065..4f54445df 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -118,13 +118,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 6edd517e4..3a18aa674 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -180,7 +180,7 @@ 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 e19e4541a..15604cc22 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1495,10 +1495,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/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index bf9b081a4..0dca5d542 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -261,13 +261,13 @@ void ModuleList::ReplaceEquivalent(
equivalent_module_spec.GetPlatformFileSpec() =
module_sp->GetPlatformFileSpec();
#ifdef _AIX
- // To remove the exact equivalent module, the object name must be
- // specified. When the equivalent_module_spec object is created, its
- // object name is initially set to NULL. This is because the module_sp's
- // GetPath() returns a path in the format (/usr/ccs/libc.a), which does
- // not include the object name. As a result, MatchesModuleSpec may return
- // true even though the object name is NULL and doesn't match any loaded
- // module. To fix this, set the object name of the equivalent_module_spec
+ // To remove the exact equivalent module, the object name must be
+ // specified. When the equivalent_module_spec object is created, its
+ // object name is initially set to NULL. This is because the module_sp's
+ // GetPath() returns a path in the format (/usr/ccs/libc.a), which does
+ // not include the object name. As a result, MatchesModuleSpec may return
+ // true even though the object name is NULL and doesn't match any loaded
+ // module. To fix this, set the object name of the equivalent_module_spec
// to be the same as the object name of the module_sp. */
equivalent_module_spec.SetObjectName(module_sp->GetObjectName());
#endif
diff --git a/lldb/source/Host/aix/Host.cpp b/lldb/source/Host/aix/Host.cpp
index 35da1089c..daa0b5ed2 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/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 744416336..3ff3052ff 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -357,9 +357,10 @@ FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) {
// TODO: As the current AIX LLDB is static, we don't need dladdr which is
// only for shared library, Below is the hack to find the module name
// for static LLDB
- // FIXME: If LLDB is later built as shared library, we have to find the way simillar to dladdr
- // since AIX does not support the dladdr API.
- if (host_addr == reinterpret_cast<void *>(HostInfoBase::ComputeSharedLibraryDirectory)) {
+ // FIXME: If LLDB is later built as shared library, we have to find the way
+ // simillar to dladdr since AIX does not support the dladdr API.
+ 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/Plugins/ABI/PowerPC/ABISysV_ppc64.h b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
index 1afdd6cb0..e70aae301 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
@@ -25,8 +25,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 12f24c049..890c65364 100644
--- a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
@@ -20,15 +20,15 @@
#include "lldb/Utility/Log.h"
#include "llvm/Support/FileSystem.h"
#if defined(_AIX)
-#include <sys/ldr.h>
+#include <fstream>
+#include <iostream>
#include <procinfo.h>
+#include <sys/ldr.h>
#include <sys/procfs.h>
-#include <iostream>
-#include <fstream>
#endif
/*#include "llvm/ADT/Triple.h"
-*/
+ */
using namespace lldb;
using namespace lldb_private;
@@ -53,7 +53,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 =
@@ -69,14 +69,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;
}
@@ -124,21 +124,19 @@ 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::ResolveExecutableModule(
- lldb::ModuleSP &module_sp) {
+void DynamicLoaderAIXDYLD::ResolveExecutableModule(lldb::ModuleSP &module_sp) {
Log *log = GetLog(LLDBLog::DynamicLoader);
if (m_process == nullptr)
@@ -165,41 +163,41 @@ void DynamicLoaderAIXDYLD::ResolveExecutableModule(
std::string proc_file = "/proc/" + std::to_string(pid) + "/psinfo";
std::string cwd_link = "/proc/" + std::to_string(pid) + "/cwd";
std::ifstream file(proc_file, std::ios::binary);
- if(!file.is_open())
- LLDB_LOGF(log, "Error: Unable to access process info ");
+ if (!file.is_open())
+ LLDB_LOGF(log, "Error: Unable to access process info ");
- file.read(reinterpret_cast<char*>(&psinfo), sizeof(psinfo_t));
- if(!file)
- LLDB_LOGF(log, "Process info error: Failed to read ");
+ file.read(reinterpret_cast<char *>(&psinfo), sizeof(psinfo_t));
+ if (!file)
+ LLDB_LOGF(log, "Process info error: Failed to read ");
std::string relative_path(psinfo.pr_fname);
- LLDB_LOGF(log, "Relative path %s",relative_path.c_str());
+ LLDB_LOGF(log, "Relative path %s", relative_path.c_str());
- if(readlink(cwd_link.c_str(), cwd, sizeof(cwd)) != -1){
- std::filesystem::path full_path = std::filesystem::path(cwd)/relative_path;
- if(realpath(full_path.c_str(), resolved_path)) {
+ if (readlink(cwd_link.c_str(), cwd, sizeof(cwd)) != -1) {
+ std::filesystem::path full_path =
+ std::filesystem::path(cwd) / relative_path;
+ if (realpath(full_path.c_str(), resolved_path)) {
LLDB_LOGF(log, "Resolved Path using process info : %s", resolved_path);
path_resolved = true;
- }
- else
+ } else
LLDB_LOGF(log, "Realpath error: Unable to resolve. ");
}
-
+
executable_name = resolved_path;
- if(path_resolved == false) {
- std::string command_line(psinfo.pr_psargs);
- LLDB_LOGF(log, "Command line: %s",command_line.c_str());
- if (!command_line.empty()) {
- size_t space1 = command_line.find(' ');
- executable_name = command_line.substr(0, space1);
- LLDB_LOGF(log, "Resolved path using command line arg %s",executable_name.c_str());
- }
+ if (path_resolved == false) {
+ std::string command_line(psinfo.pr_psargs);
+ LLDB_LOGF(log, "Command line: %s", command_line.c_str());
+ if (!command_line.empty()) {
+ size_t space1 = command_line.find(' ');
+ executable_name = command_line.substr(0, space1);
+ LLDB_LOGF(log, "Resolved path using command line arg %s",
+ executable_name.c_str());
+ }
}
- LLDB_LOGF(log, "Executable Name %s",executable_name.c_str());
- process_info.SetExecutableFile(lldb_private::FileSpec(executable_name),
- true);
-
+ LLDB_LOGF(log, "Executable Name %s", executable_name.c_str());
+ process_info.SetExecutableFile(lldb_private::FileSpec(executable_name), true);
+
LLDB_LOGF(
log, "DynamicLoaderPOSIXDYLD::%s - got executable by pid %" PRIu64 ": %s",
__FUNCTION__, m_process->GetID(),
@@ -233,60 +231,64 @@ bool DynamicLoaderAIXDYLD::IsCoreFile() const {
}
void DynamicLoaderAIXDYLD::FillCoreLoaderData(lldb_private::DataExtractor &data,
- uint64_t loader_offset, uint64_t loader_size ) {
-
- Log *log = GetLog(LLDBLog::DynamicLoader);
- LLDB_LOGF(log, "DynamicLoaderAIXDYLD::%s()", __FUNCTION__);
- static char *buffer = (char *)malloc(loader_size);
- if (buffer == NULL) {
- LLDB_LOG(log, "Buffer allocation failed error: {0}", std::strerror(errno));
- return;
+ uint64_t loader_offset,
+ uint64_t loader_size) {
+
+ Log *log = GetLog(LLDBLog::DynamicLoader);
+ LLDB_LOGF(log, "DynamicLoaderAIXDYLD::%s()", __FUNCTION__);
+ static char *buffer = (char *)malloc(loader_size);
+ if (buffer == NULL) {
+ LLDB_LOG(log, "Buffer allocation failed error: {0}", std::strerror(errno));
+ return;
+ }
+ struct ld_info ldinfo[64] = {};
+ struct ld_info *ptr;
+ int i = 0;
+
+ ByteOrder byteorder = data.GetByteOrder();
+ data.ExtractBytes(loader_offset, loader_size, eByteOrderBig, buffer);
+ ldinfo[0].ldinfo_next = 1;
+
+ while (ldinfo[i++].ldinfo_next != 0) {
+
+ ptr = (struct ld_info *)buffer;
+ ldinfo[i].ldinfo_next = ptr->ldinfo_next;
+ ldinfo[i].ldinfo_flags = ptr->ldinfo_flags;
+ ldinfo[i].ldinfo_core = ptr->ldinfo_core;
+ ldinfo[i].ldinfo_textorg = ptr->ldinfo_textorg;
+ ldinfo[i].ldinfo_textsize = ptr->ldinfo_textsize;
+ ldinfo[i].ldinfo_dataorg = ptr->ldinfo_dataorg;
+ ldinfo[i].ldinfo_datasize = ptr->ldinfo_datasize;
+
+ char *filename = &ptr->ldinfo_filename[0];
+ char *membername = filename + (strlen(filename) + 1);
+ strcpy(ldinfo[i].ldinfo_filename, filename);
+
+ buffer += ptr->ldinfo_next;
+ struct ld_info *ptr2 = &(ldinfo[i]);
+ char *pathName = ptr2->ldinfo_filename;
+ char pathWithMember[PATH_MAX] = {0};
+ if (strlen(membername) > 0) {
+ sprintf(pathWithMember, "%s(%s)", pathName, membername);
+ } else {
+ sprintf(pathWithMember, "%s", pathName);
}
- struct ld_info ldinfo[64] = {};
- struct ld_info *ptr;
- int i = 0;
-
- ByteOrder byteorder = data.GetByteOrder();
- data.ExtractBytes(loader_offset, loader_size, eByteOrderBig, buffer);
- ldinfo[0].ldinfo_next = 1;
-
- while (ldinfo[i++].ldinfo_next != 0) {
-
- ptr = (struct ld_info *)buffer;
- ldinfo[i].ldinfo_next = ptr->ldinfo_next;
- ldinfo[i].ldinfo_flags = ptr->ldinfo_flags;
- ldinfo[i].ldinfo_core = ptr->ldinfo_core;
- ldinfo[i].ldinfo_textorg = ptr->ldinfo_textorg;
- ldinfo[i].ldinfo_textsize = ptr->ldinfo_textsize;
- ldinfo[i].ldinfo_dataorg = ptr->ldinfo_dataorg;
- ldinfo[i].ldinfo_datasize = ptr->ldinfo_datasize;
-
- char *filename = &ptr->ldinfo_filename[0];
- char *membername = filename + (strlen(filename) + 1);
- strcpy(ldinfo[i].ldinfo_filename, filename);
-
- buffer += ptr->ldinfo_next;
- struct ld_info *ptr2 = &(ldinfo[i]);
- char *pathName = ptr2->ldinfo_filename;
- char pathWithMember[PATH_MAX] = {0};
- if (strlen(membername) > 0) {
- sprintf(pathWithMember, "%s(%s)", pathName, membername);
- } else {
- sprintf(pathWithMember, "%s", pathName);
- }
-
- FileSpec file(pathWithMember);
- ModuleSpec module_spec(file, m_process->GetTarget().GetArchitecture());
- LLDB_LOGF(log, "Module :%s", pathWithMember);
- if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, true /* notify */)) {
- UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr2->ldinfo_textorg, false, 1);
- UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr2->ldinfo_dataorg, false, 2);
- // FIXME: .tdata, .bss
- }
- if (ptr2->ldinfo_next == 0) {
- ptr2 = nullptr;
- }
+
+ FileSpec file(pathWithMember);
+ ModuleSpec module_spec(file, m_process->GetTarget().GetArchitecture());
+ LLDB_LOGF(log, "Module :%s", pathWithMember);
+ if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(
+ module_spec, true /* notify */)) {
+ UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+ (lldb::addr_t)ptr2->ldinfo_textorg, false, 1);
+ UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+ (lldb::addr_t)ptr2->ldinfo_dataorg, false, 2);
+ // FIXME: .tdata, .bss
}
+ if (ptr2->ldinfo_next == 0) {
+ ptr2 = nullptr;
+ }
+ }
}
void DynamicLoaderAIXDYLD::DidAttach() {
@@ -344,9 +346,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 {
@@ -405,9 +410,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 {
@@ -422,12 +430,10 @@ void DynamicLoaderAIXDYLD::DidLaunch() {
#endif
}
-Status DynamicLoaderAIXDYLD::CanLoadImage() {
- return Status(); }
+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 097f8d048..d841832ef 100644
--- a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
+++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
@@ -34,7 +34,7 @@ public:
void OnUnloadModule(lldb::addr_t module_addr);
void FillCoreLoaderData(lldb_private::DataExtractor &data,
- uint64_t loader_offset, uint64_t loader_size);
+ uint64_t loader_offset, uint64_t loader_size);
void DidAttach() override;
void DidLaunch() override;
@@ -44,7 +44,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 5fc6521ef..45ed90ca7 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 38756a0dd..5fb261770 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 ad9b81404..b89472bab 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/AIXCore/ObjectFileAIXCore.cpp b/lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.cpp
index 0ba105686..d4c4fa847 100644
--- a/lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.cpp
+++ b/lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.cpp
@@ -1,4 +1,5 @@
-//===-- ObjectFileAIXCore.cpp -------------------------------------------------===//
+//===-- ObjectFileAIXCore.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,13 +23,14 @@
#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/Stream.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/XCOFF.h"
-#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Object/XCOFFObjectFile.h"
+#include "llvm/Support/MemoryBuffer.h"
using namespace llvm;
using namespace lldb;
@@ -37,7 +38,7 @@ using namespace lldb_private;
LLDB_PLUGIN_DEFINE(ObjectFileAIXCore)
-enum CoreVersion : uint64_t {AIXCORE32 = 0xFEEDDB1, AIXCORE64 = 0xFEEDDB2};
+enum CoreVersion : uint64_t { AIXCORE32 = 0xFEEDDB1, AIXCORE64 = 0xFEEDDB2 };
bool m_is_core = false;
@@ -52,49 +53,45 @@ void ObjectFileAIXCore::Terminate() {
PluginManager::UnregisterPlugin(CreateInstance);
}
-ObjectFile *ObjectFileAIXCore::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) {
-
- if(m_is_core)
- {
-
- bool mapped_writable = false;
- if (!data_sp) {
- data_sp = MapFileDataWritable(*file, length, file_offset);
- if (!data_sp)
- return nullptr;
- data_offset = 0;
- mapped_writable = true;
- }
-
- assert(data_sp);
-
- // Update the data to contain the entire file if it doesn't already
- if (data_sp->GetByteSize() < length) {
- data_sp = MapFileDataWritable(*file, length, file_offset);
- if (!data_sp)
- return nullptr;
- data_offset = 0;
- mapped_writable = true;
- }
-
- // If we didn't map the data as writable take ownership of the buffer.
- if (!mapped_writable) {
- data_sp = std::make_shared<DataBufferHeap>(data_sp->GetBytes(),
- data_sp->GetByteSize());
- data_offset = 0;
- }
-
- std::unique_ptr<ObjectFileAIXCore> objfile_up(new ObjectFileAIXCore(
- module_sp, data_sp, data_offset, file, file_offset, length));
- ArchSpec spec = objfile_up->GetArchitecture();
- objfile_up->SetModulesArchitecture(spec);
- return objfile_up.release();
+ObjectFile *ObjectFileAIXCore::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) {
+ if (m_is_core) {
+
+ bool mapped_writable = false;
+ if (!data_sp) {
+ data_sp = MapFileDataWritable(*file, length, file_offset);
+ if (!data_sp)
+ return nullptr;
+ data_offset = 0;
+ mapped_writable = true;
+ }
+
+ assert(data_sp);
+
+ // Update the data to contain the entire file if it doesn't already
+ if (data_sp->GetByteSize() < length) {
+ data_sp = MapFileDataWritable(*file, length, file_offset);
+ if (!data_sp)
+ return nullptr;
+ data_offset = 0;
+ mapped_writable = true;
+ }
+
+ // If we didn't map the data as writable take ownership of the buffer.
+ if (!mapped_writable) {
+ data_sp = std::make_shared<DataBufferHeap>(data_sp->GetBytes(),
+ data_sp->GetByteSize());
+ data_offset = 0;
+ }
+
+ std::unique_ptr<ObjectFileAIXCore> objfile_up(new ObjectFileAIXCore(
+ module_sp, data_sp, data_offset, file, file_offset, length));
+ ArchSpec spec = objfile_up->GetArchitecture();
+ objfile_up->SetModulesArchitecture(spec);
+ return objfile_up.release();
}
}
@@ -112,9 +109,12 @@ size_t ObjectFileAIXCore::GetModuleSpecifications(
if (ObjectFileAIXCore::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize())) {
// Need new ArchType???
- 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;
@@ -122,26 +122,26 @@ size_t ObjectFileAIXCore::GetModuleSpecifications(
static bool AIXCoreHeaderCheckFromMagic(uint32_t magic) {
- Log *log = GetLog(LLDBLog::Modules);
- bool ret = false;
- switch (magic) {
- case AIXCORE32:
- LLDB_LOGF(log, "ObjectFileAIXCore: 32-bit not supported");
- break;
- case AIXCORE64:
- m_is_core = true;
- ret = true;
- break;
- default:
- break;
- }
- return ret;
+ Log *log = GetLog(LLDBLog::Modules);
+ bool ret = false;
+ switch (magic) {
+ case AIXCORE32:
+ LLDB_LOGF(log, "ObjectFileAIXCore: 32-bit not supported");
+ break;
+ case AIXCORE64:
+ m_is_core = true;
+ ret = true;
+ break;
+ default:
+ break;
+ }
+ return ret;
}
bool ObjectFileAIXCore::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;
offset += 4; // Skipping to the coredump version
@@ -149,28 +149,20 @@ bool ObjectFileAIXCore::MagicBytesMatch(DataBufferSP &data_sp,
return AIXCoreHeaderCheckFromMagic(magic);
}
-bool ObjectFileAIXCore::ParseHeader() {
+bool ObjectFileAIXCore::ParseHeader() { return false; }
- return false;
-}
+ByteOrder ObjectFileAIXCore::GetByteOrder() const { return eByteOrderBig; }
-ByteOrder ObjectFileAIXCore::GetByteOrder() const {
- return eByteOrderBig;
-}
+bool ObjectFileAIXCore::IsExecutable() const { return false; }
-bool ObjectFileAIXCore::IsExecutable() const {
- return false;
-}
-
-uint32_t ObjectFileAIXCore::GetAddressByteSize() const {
- return 8;
-}
+uint32_t ObjectFileAIXCore::GetAddressByteSize() const { return 8; }
AddressClass ObjectFileAIXCore::GetAddressClass(addr_t file_addr) {
return AddressClass::eUnknown;
}
-lldb::SymbolType ObjectFileAIXCore::MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+lldb::SymbolType
+ObjectFileAIXCore::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)
@@ -178,32 +170,26 @@ lldb::SymbolType ObjectFileAIXCore::MapSymbolType(llvm::object::SymbolRef::Type
return lldb::eSymbolTypeInvalid;
}
-void ObjectFileAIXCore::ParseSymtab(Symtab &lldb_symtab) {
-}
+void ObjectFileAIXCore::ParseSymtab(Symtab &lldb_symtab) {}
-bool ObjectFileAIXCore::IsStripped() {
- return false;
-}
+bool ObjectFileAIXCore::IsStripped() { return false; }
-void ObjectFileAIXCore::CreateSections(SectionList &unified_section_list) {
-}
+void ObjectFileAIXCore::CreateSections(SectionList &unified_section_list) {}
-void ObjectFileAIXCore::Dump(Stream *s) {
-}
+void ObjectFileAIXCore::Dump(Stream *s) {}
ArchSpec ObjectFileAIXCore::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 ObjectFileAIXCore::GetUUID() {
- return UUID();
-}
+UUID ObjectFileAIXCore::GetUUID() { return UUID(); }
uint32_t ObjectFileAIXCore::GetDependentModules(FileSpecList &files) {
-
- auto original_size = files.GetSize();
- return files.GetSize() - original_size;
+
+ auto original_size = files.GetSize();
+ return files.GetSize() - original_size;
}
Address ObjectFileAIXCore::GetImageInfoAddress(Target *target) {
@@ -213,9 +199,7 @@ Address ObjectFileAIXCore::GetImageInfoAddress(Target *target) {
lldb_private::Address ObjectFileAIXCore::GetBaseAddress() {
return lldb_private::Address();
}
-ObjectFile::Type ObjectFileAIXCore::CalculateType() {
- return eTypeCoreFile;
-}
+ObjectFile::Type ObjectFileAIXCore::CalculateType() { return eTypeCoreFile; }
ObjectFile::Strata ObjectFileAIXCore::CalculateStrata() {
return eStrataUnknown;
@@ -229,25 +213,24 @@ ObjectFileAIXCore::GetLoadableData(Target &target) {
lldb::WritableDataBufferSP
ObjectFileAIXCore::MapFileDataWritable(const FileSpec &file, uint64_t Size,
- uint64_t Offset) {
+ uint64_t Offset) {
return FileSystem::Instance().CreateWritableDataBuffer(file.GetPath(), Size,
Offset);
}
ObjectFileAIXCore::ObjectFileAIXCore(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)
- : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset)
- {
+ 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) {
if (file)
m_file = *file;
}
ObjectFileAIXCore::ObjectFileAIXCore(const lldb::ModuleSP &module_sp,
- DataBufferSP header_data_sp,
- const lldb::ProcessSP &process_sp,
- addr_t header_addr)
- : ObjectFile(module_sp, process_sp, header_addr, header_data_sp)
- {
-}
+ DataBufferSP header_data_sp,
+ const lldb::ProcessSP &process_sp,
+ addr_t header_addr)
+ : ObjectFile(module_sp, process_sp, header_addr, header_data_sp) {}
diff --git a/lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.h b/lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.h
index 5dbd78d91..df6db0852 100644
--- a/lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.h
+++ b/lldb/source/Plugins/ObjectFile/AIXCore/ObjectFileAIXCore.h
@@ -1,4 +1,5 @@
-//===-- ObjectFileAIXCore.h --------------------------------------- -*- C++ -*-===//
+//===-- ObjectFileAIXCore.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.
@@ -23,8 +24,8 @@
/// \class ObjectFileAIXCore
/// Generic AIX CORE object file reader.
///
-/// This class provides a generic AIX Core (32/64 bit) reader plugin implementing
-/// the ObjectFile protocol.
+/// This class provides a generic AIX Core (32/64 bit) reader plugin
+/// implementing the ObjectFile protocol.
class ObjectFileAIXCore : public lldb_private::ObjectFile {
public:
// Static Functions
@@ -64,7 +65,7 @@ public:
// ObjectFile Protocol.
bool ParseHeader() override;
-
+
lldb::ByteOrder GetByteOrder() const override;
bool IsExecutable() const override;
@@ -72,7 +73,7 @@ public:
uint32_t GetAddressByteSize() const override;
lldb_private::AddressClass GetAddressClass(lldb::addr_t file_addr) override;
-
+
void ParseSymtab(lldb_private::Symtab &symtab) override;
bool IsStripped() override;
@@ -86,7 +87,7 @@ public:
lldb_private::UUID GetUUID() override;
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
-
+
lldb_private::Address
GetImageInfoAddress(lldb_private::Target *target) override;
lldb_private::Address GetBaseAddress() override;
@@ -96,26 +97,25 @@ public:
ObjectFile::Strata CalculateStrata() override;
ObjectFileAIXCore(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);
ObjectFileAIXCore(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:
-
static bool ParseAIXCoreHeader(lldb_private::DataExtractor &data,
- lldb::offset_t *offset_ptr
- );
-
+ lldb::offset_t *offset_ptr);
+
std::vector<LoadableData>
GetLoadableData(lldb_private::Target &target) override;
static lldb::WritableDataBufferSP
MapFileDataWritable(const lldb_private::FileSpec &file, uint64_t Size,
uint64_t Offset);
-
};
#endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_AIXCORE_OBJECTFILEAIXCORE_H
diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
index d76d6adb1..354a72567 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 86e07607d..9fbbc3bce 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 2e19577f2..d0f320d78 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
@@ -17,8 +17,8 @@
#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"
@@ -33,8 +33,8 @@
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/XCOFF.h"
-#include "llvm/Object/XCOFFObjectFile.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"
@@ -98,7 +98,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;
@@ -206,7 +206,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);
@@ -217,10 +217,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);
@@ -257,18 +257,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) {
@@ -294,7 +294,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 {};
@@ -307,9 +308,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());
@@ -319,7 +319,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) {
@@ -341,8 +341,9 @@ bool ObjectFileXCOFF::SetLoadAddress(Target &target, lldb::addr_t value,
use_offset = true;
if (target.GetSectionLoadListPublic().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;
}
}
@@ -353,7 +354,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) {
@@ -367,13 +368,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.GetSectionLoadListPublic().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.GetSectionLoadListPublic().SetSectionLoadAddress(
section_sp, section_sp->GetFileAddress() + value))
@@ -387,7 +390,6 @@ bool ObjectFileXCOFF::SetLoadAddressByType(Target &target, lldb::addr_t value,
return changed;
}
-
ByteOrder ObjectFileXCOFF::GetByteOrder() const { return eByteOrderBig; }
bool ObjectFileXCOFF::IsExecutable() const { return true; }
@@ -404,7 +406,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)
@@ -431,7 +434,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;
@@ -443,7 +447,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) {
@@ -465,7 +470,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;
@@ -473,13 +479,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();
@@ -500,9 +510,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)
@@ -526,12 +534,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;
@@ -556,7 +566,10 @@ llvm::StringRef ObjectFileXCOFF::GetSectionName(const section_header_t §) {
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 "";
@@ -565,7 +578,7 @@ llvm::StringRef ObjectFileXCOFF::GetSectionName(const section_header_t §) {
}
SectionType ObjectFileXCOFF::GetSectionType(llvm::StringRef sect_name,
- const section_header_t §) {
+ const section_header_t §) {
if (sect.flags & XCOFF::STYP_TEXT)
return eSectionTypeCode;
if (sect.flags & XCOFF::STYP_DATA)
@@ -574,11 +587,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;
@@ -586,8 +599,7 @@ 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 =
@@ -597,9 +609,7 @@ ArchSpec ObjectFileXCOFF::GetArchitecture() {
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());
@@ -700,10 +710,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,14 +741,12 @@ ObjectFile::Type ObjectFileXCOFF::CalculateType() {
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) {
@@ -754,23 +762,25 @@ ObjectFileXCOFF::MapFileDataWritable(const FileSpec &file, uint64_t Size,
}
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 f827fca39..a01e90ae3 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
@@ -75,7 +75,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;
@@ -122,15 +122,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;
@@ -208,8 +208,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/Process/AIX/NativeProcessAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
index ace9e1192..58430df6f 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
@@ -13,27 +13,27 @@
#include <cstring>
#include <unistd.h>
+#include "NativeThreadAIX.h"
+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
#include <fstream>
#include <mutex>
#include <optional>
#include <sstream>
#include <string>
-#include <unordered_map>
#include <sys/procfs.h>
-#include "NativeThreadAIX.h"
-#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-//#include "Plugins/Process/Utility/LinuxProcMaps.h"
-//#include "Procfs.h"
+#include <unordered_map>
+// #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>
@@ -197,7 +197,8 @@ static void PtraceDisplayBytes(int &req, void *data, size_t data_size) {
LLDB_LOGV(log, "PTRACE_SETREGSET {0}", buf.GetData());
break;
}
- default: {}
+ default: {
+ }
}
}
@@ -277,7 +278,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);
@@ -307,17 +308,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,
@@ -326,15 +327,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();
@@ -346,8 +347,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() {
@@ -438,8 +439,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
@@ -453,9 +454,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);
@@ -482,8 +483,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()));
@@ -496,8 +496,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.
@@ -513,7 +512,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
@@ -549,9 +548,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());
@@ -602,7 +600,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);
@@ -617,7 +615,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();
@@ -695,8 +693,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.
@@ -708,12 +706,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
@@ -765,9 +763,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);
@@ -816,10 +812,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;
}
@@ -829,10 +825,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());
}
}
@@ -862,8 +859,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;
@@ -962,7 +959,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.
@@ -1025,46 +1022,48 @@ Status NativeProcessAIX::GetMemoryRegionInfo(lldb::addr_t load_addr,
// Parsing the AIX map file /proc/PID/map
// The map file contains an array of prmap structures
-// which has all the information like size, startaddress, object name, permissions
+// which has all the information like size, startaddress, object name,
+// permissions
bool ParseAIXMapRegions(const char *aix_map, AIXMapCallback const &callback) {
MemoryRegionInfo region;
struct prmap *prmapData = (struct prmap *)aix_map;
struct prmap *entry;
uint32_t perm_flag;
- for(entry = prmapData;!(entry->pr_size == 0 && entry->pr_vaddr == NULL); entry++) {
- const char *o_name = aix_map + entry->pr_pathoff;
- lldb::addr_t start_address = (lldb::addr_t )entry->pr_vaddr;
- lldb::addr_t end_address = start_address + entry->pr_size;
+ for (entry = prmapData; !(entry->pr_size == 0 && entry->pr_vaddr == NULL);
+ entry++) {
+ const char *o_name = aix_map + entry->pr_pathoff;
+ lldb::addr_t start_address = (lldb::addr_t)entry->pr_vaddr;
+ lldb::addr_t end_address = start_address + entry->pr_size;
region.GetRange().SetRangeBase(start_address);
region.GetRange().SetRangeEnd(end_address);
region.SetMapped(MemoryRegionInfo::OptionalBool::eYes);
perm_flag = entry->pr_mflags;
-
- if(perm_flag & MA_READ)
- region.SetReadable(MemoryRegionInfo::OptionalBool::eYes);
+
+ if (perm_flag & MA_READ)
+ region.SetReadable(MemoryRegionInfo::OptionalBool::eYes);
else
- region.SetReadable(MemoryRegionInfo::OptionalBool::eNo);
+ region.SetReadable(MemoryRegionInfo::OptionalBool::eNo);
- if(perm_flag & MA_WRITE)
- region.SetWritable(MemoryRegionInfo::OptionalBool::eYes);
- else
- region.SetWritable(MemoryRegionInfo::OptionalBool::eNo);
+ if (perm_flag & MA_WRITE)
+ region.SetWritable(MemoryRegionInfo::OptionalBool::eYes);
+ else
+ region.SetWritable(MemoryRegionInfo::OptionalBool::eNo);
- if(perm_flag & MA_EXEC)
- region.SetExecutable(MemoryRegionInfo::OptionalBool::eYes);
- else
- region.SetExecutable(MemoryRegionInfo::OptionalBool::eNo);
+ if (perm_flag & MA_EXEC)
+ region.SetExecutable(MemoryRegionInfo::OptionalBool::eYes);
+ else
+ region.SetExecutable(MemoryRegionInfo::OptionalBool::eNo);
- if((perm_flag & MA_SLIBTEXT) || (perm_flag & MA_SLIBDATA))
- region.SetShared(MemoryRegionInfo::OptionalBool::eYes);
- else if ((perm_flag & MA_PLIBTEXT) || (perm_flag & MA_PLIBDATA))
- region.SetShared(MemoryRegionInfo::OptionalBool::eNo);
- else
- region.SetShared(MemoryRegionInfo::OptionalBool::eDontKnow);
+ if ((perm_flag & MA_SLIBTEXT) || (perm_flag & MA_SLIBDATA))
+ region.SetShared(MemoryRegionInfo::OptionalBool::eYes);
+ else if ((perm_flag & MA_PLIBTEXT) || (perm_flag & MA_PLIBDATA))
+ region.SetShared(MemoryRegionInfo::OptionalBool::eNo);
+ else
+ region.SetShared(MemoryRegionInfo::OptionalBool::eDontKnow);
- if(o_name)
- region.SetName(o_name);
+ if (o_name)
+ region.SetName(o_name);
callback(region);
region.Clear();
@@ -1073,7 +1072,6 @@ bool ParseAIXMapRegions(const char *aix_map, AIXMapCallback const &callback) {
return true;
}
-
Status NativeProcessAIX::PopulateMemoryRegionCache() {
Log *log = GetLog(POSIXLog::Process);
// If our cache is empty, pull the latest. There should always be at least
@@ -1104,7 +1102,7 @@ Status NativeProcessAIX::PopulateMemoryRegionCache() {
if (BufferOrError) {
std::unique_ptr<llvm::MemoryBuffer> MapBuffer = std::move(*BufferOrError);
ParseAIXMapRegions(MapBuffer->getBufferStart(), callback);
- }
+ }
if (Result.Fail())
return Result;
@@ -1114,9 +1112,8 @@ Status NativeProcessAIX::PopulateMemoryRegionCache() {
// /proc/{pid}/maps is supported. Assume we don't support map entries via
// procfs.
m_supports_mem_region = LazyBool::eLazyBoolNo;
- LLDB_LOG(log,
- "failed to find any procfs maps entries, assuming no support "
- "for memory region metadata retrieval");
+ LLDB_LOG(log, "failed to find any procfs maps entries, assuming no support "
+ "for memory region metadata retrieval");
return Status("not supported");
}
@@ -1142,7 +1139,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(),
@@ -1199,10 +1196,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()));
@@ -1222,8 +1219,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();
@@ -1270,8 +1267,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)
@@ -1325,8 +1322,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)
@@ -1402,7 +1399,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
@@ -1440,7 +1437,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;
@@ -1450,7 +1447,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;
@@ -1468,7 +1466,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;
@@ -1476,8 +1474,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;
@@ -1490,9 +1489,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) {
@@ -1530,11 +1529,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);
@@ -1549,7 +1546,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);
@@ -1561,8 +1558,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()) {
@@ -1577,7 +1573,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;
@@ -1592,12 +1588,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();
@@ -1605,7 +1602,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();
}
@@ -1623,7 +1621,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());
@@ -1757,8 +1755,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;
@@ -1778,7 +1776,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);
@@ -1822,7 +1821,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));
@@ -1862,7 +1861,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));
@@ -2035,21 +2034,21 @@ Status NativeProcessAIX::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
} else if (req == PT_WRITE_BLOCK) {
ptrace64(req, pid, (long long)addr, (int)data_size, (int *)result);
} else if (req == PT_ATTACH) {
- // Block SIGCHLD signal during attach to the process,
+ // Block SIGCHLD signal during attach to the process,
// to prevent interruptions.
- // The ptrace operation may send SIGCHLD signals in certain cases
- // during the attach, which can interfere.
+ // The ptrace operation may send SIGCHLD signals in certain cases
+ // during the attach, which can interfere.
static sigset_t signal_set;
- sigemptyset (&signal_set);
- sigaddset (&signal_set, SIGCHLD);
- if(!pthread_sigmask( SIG_BLOCK, &signal_set, NULL))
- LLDB_LOG(log,"NativeProcessAIX::pthread_sigmask(SIG_BLOCK) Failed");
-
+ sigemptyset(&signal_set);
+ sigaddset(&signal_set, SIGCHLD);
+ if (!pthread_sigmask(SIG_BLOCK, &signal_set, NULL))
+ LLDB_LOG(log, "NativeProcessAIX::pthread_sigmask(SIG_BLOCK) Failed");
+
ptrace64(req, pid, 0, 0, nullptr);
-
- //Unblocking the SIGCHLD after attach work.
- if(!pthread_sigmask( SIG_UNBLOCK, &signal_set, NULL ))
- LLDB_LOG(log,"NativeProcessAIX::pthread_sigmask(SIG_UNBLOCK) Failed");
+
+ // Unblocking the SIGCHLD after attach work.
+ if (!pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL))
+ LLDB_LOG(log, "NativeProcessAIX::pthread_sigmask(SIG_UNBLOCK) Failed");
} else if (req == PT_WATCH) {
ptrace64(req, pid, (long long)addr, (int)data_size, nullptr);
} else if (req == PT_DETACH) {
@@ -2093,7 +2092,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 c90e21658..88800336f 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
@@ -14,17 +14,17 @@
#include "lldb/Host/Debug.h"
#include "lldb/Host/HostThread.h"
+#include "lldb/Host/linux/Support.h"
+#include "lldb/Host/posix/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/linux/Support.h"
-#include "lldb/Host/posix/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;
@@ -39,24 +39,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);
@@ -73,7 +71,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
@@ -190,8 +188,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);
@@ -274,8 +272,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 071e55543..1364e8358 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 ®_value) {
+ RegisterValue ®_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 ®_value) {
+ const RegisterValue ®_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 *>(®set), buf,
- buf_size);
+ static_cast<void *>(®set), 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 *>(®set), buf,
- buf_size);
+ static_cast<void *>(®set), 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 9c2a32685..df755824a 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 0132b52de..104ac7301 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 ®_value) {
+Status
+NativeRegisterContextAIX_ppc64::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue ®_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 ®_value) {
+Status
+NativeRegisterContextAIX_ppc64::WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue ®_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(),
- ®set, &m_vmx_ppc64le,
- sizeof(m_vmx_ppc64le));
+ // FIXME
+ int regset = 0 /*NT_PPC_VMX*/;
+ return NativeProcessAIX::PtraceWrapper(PT_CLEAR /*PTRACE_SETVRREGS*/,
+ m_thread.GetID(), ®set,
+ &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(),
- ®set, &m_vsx_ppc64le,
- sizeof(m_vsx_ppc64le));
+ // FIXME
+ int regset = 0 /*NT_PPC_VSX*/;
+ return NativeProcessAIX::PtraceWrapper(PT_CLEAR /*PTRACE_SETVSRREGS*/,
+ m_thread.GetID(), ®set,
+ &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 a29f786f2..74641710d 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 337caa7c7..9ecd95f20 100644
--- a/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
@@ -25,10 +25,10 @@
#include "Plugins/Process/POSIX/CrashReason.h"
#include <procinfo.h>
+#include <signal.h>
#include <sys/procfs.h>
-#include <sys/types.h>
#include <sys/ptrace.h>
-#include <signal.h>
+#include <sys/types.h>
#if 0
#include <sys/syscall.h>
@@ -90,10 +90,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(
@@ -117,7 +116,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();
@@ -156,7 +155,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)
@@ -183,8 +182,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();
@@ -254,7 +252,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) {
@@ -405,7 +403,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();
@@ -453,8 +451,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;
@@ -487,8 +484,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 8e74cce09..10b0dd5b8 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;
}
}
@@ -119,10 +119,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_addr,
- toc_range.GetBaseAddress(),
- void_ptr_type, args, options));
+ lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallFunction(
+ *thread, mmap_addr, toc_range.GetBaseAddress(), void_ptr_type, args,
+ options));
#else
lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallFunction(
*thread, mmap_addr, void_ptr_type, args, options));
diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
index d9b41d595..8f8b6a159 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/aix-core/AIXCore.cpp b/lldb/source/Plugins/Process/aix-core/AIXCore.cpp
index bc496b5af..a902b9a14 100644
--- a/lldb/source/Plugins/Process/aix-core/AIXCore.cpp
+++ b/lldb/source/Plugins/Process/aix-core/AIXCore.cpp
@@ -9,12 +9,12 @@
#include <cstring>
#include "lldb/Core/Section.h"
-#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/Stream.h"
#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/State.h"
+#include "lldb/Utility/Stream.h"
#include "AIXCore.h"
@@ -24,93 +24,90 @@ using namespace lldb_private;
AIXCore64Header::AIXCore64Header() { memset(this, 0, sizeof(AIXCore64Header)); }
-
bool AIXCore64Header::ParseRegisterContext(lldb_private::DataExtractor &data,
- lldb::offset_t *offset) {
- // The data is arranged in this order in this coredump file
- // so we have to fetch in this exact order. But need to change
- // the context structure order according to Infos_ppc64
- for(int i = 0; i < 32; i++)
- Fault.context.gpr[i] = data.GetU64(offset);
- Fault.context.msr = data.GetU64(offset);
- Fault.context.pc = data.GetU64(offset);
- Fault.context.lr = data.GetU64(offset);
- Fault.context.ctr = data.GetU64(offset);
- Fault.context.cr = data.GetU32(offset);
- Fault.context.xer = data.GetU32(offset);
- Fault.context.fpscr = data.GetU32(offset);
- Fault.context.fpscrx = data.GetU32(offset);
- Fault.context.except[0] = data.GetU64(offset);
- for(int i = 0; i < 32; i++)
- Fault.context.fpr[i] = data.GetU64(offset);
- Fault.context.fpeu = data.GetU8(offset);
- Fault.context.fpinfo = data.GetU8(offset);
- Fault.context.fpscr24_31 = data.GetU8(offset);
- Fault.context.pad[0] = data.GetU8(offset);
- Fault.context.excp_type = data.GetU32(offset);
-
- return true;
+ lldb::offset_t *offset) {
+ // The data is arranged in this order in this coredump file
+ // so we have to fetch in this exact order. But need to change
+ // the context structure order according to Infos_ppc64
+ for (int i = 0; i < 32; i++)
+ Fault.context.gpr[i] = data.GetU64(offset);
+ Fault.context.msr = data.GetU64(offset);
+ Fault.context.pc = data.GetU64(offset);
+ Fault.context.lr = data.GetU64(offset);
+ Fault.context.ctr = data.GetU64(offset);
+ Fault.context.cr = data.GetU32(offset);
+ Fault.context.xer = data.GetU32(offset);
+ Fault.context.fpscr = data.GetU32(offset);
+ Fault.context.fpscrx = data.GetU32(offset);
+ Fault.context.except[0] = data.GetU64(offset);
+ for (int i = 0; i < 32; i++)
+ Fault.context.fpr[i] = data.GetU64(offset);
+ Fault.context.fpeu = data.GetU8(offset);
+ Fault.context.fpinfo = data.GetU8(offset);
+ Fault.context.fpscr24_31 = data.GetU8(offset);
+ Fault.context.pad[0] = data.GetU8(offset);
+ Fault.context.excp_type = data.GetU32(offset);
+
+ return true;
}
bool AIXCore64Header::ParseThreadContext(lldb_private::DataExtractor &data,
- lldb::offset_t *offset) {
-
- lldb::offset_t offset_to_regctx = *offset;
- offset_to_regctx += sizeof(thrdentry64);
- Fault.thread.ti_tid = data.GetU64(offset);
- Fault.thread.ti_pid = data.GetU32(offset);
- int ret = ParseRegisterContext(data, &offset_to_regctx);
- return true;
+ lldb::offset_t *offset) {
+
+ lldb::offset_t offset_to_regctx = *offset;
+ offset_to_regctx += sizeof(thrdentry64);
+ Fault.thread.ti_tid = data.GetU64(offset);
+ Fault.thread.ti_pid = data.GetU32(offset);
+ int ret = ParseRegisterContext(data, &offset_to_regctx);
+ return true;
}
-
+
bool AIXCore64Header::ParseUserData(lldb_private::DataExtractor &data,
- lldb::offset_t *offset) {
- User.process.pi_pid = data.GetU32(offset);
- User.process.pi_ppid = data.GetU32(offset);
- User.process.pi_sid = data.GetU32(offset);
- User.process.pi_pgrp = data.GetU32(offset);
- User.process.pi_uid = data.GetU32(offset);
- User.process.pi_suid = data.GetU32(offset);
-
- *offset += 76;
-
- ByteOrder byteorder = data.GetByteOrder();
- size_t size = 33;
- data.ExtractBytes(*offset, size, byteorder, User.process.pi_comm);
- offset += size;
-
- return true;
+ lldb::offset_t *offset) {
+ User.process.pi_pid = data.GetU32(offset);
+ User.process.pi_ppid = data.GetU32(offset);
+ User.process.pi_sid = data.GetU32(offset);
+ User.process.pi_pgrp = data.GetU32(offset);
+ User.process.pi_uid = data.GetU32(offset);
+ User.process.pi_suid = data.GetU32(offset);
+
+ *offset += 76;
+
+ ByteOrder byteorder = data.GetByteOrder();
+ size_t size = 33;
+ data.ExtractBytes(*offset, size, byteorder, User.process.pi_comm);
+ offset += size;
+
+ return true;
}
bool AIXCore64Header::ParseCoreHeader(lldb_private::DataExtractor &data,
- lldb::offset_t *offset) {
-
- SignalNum = data.GetU8(offset);
- Flag = data.GetU8(offset);
- Entries = data.GetU16(offset);
- Version = data.GetU32(offset);
- FDInfo = data.GetU64(offset);
-
- LoaderOffset = data.GetU64(offset);
- LoaderSize = data.GetU64(offset);
- NumberOfThreads = data.GetU32(offset);
- Reserved0 = data.GetU32(offset);
- ThreadContextOffset = data.GetU64(offset);
- NumSegRegion = data.GetU64(offset);
- SegRegionOffset = data.GetU64(offset);
- StackOffset = data.GetU64(offset);
- StackBaseAddr = data.GetU64(offset);
- StackSize = data.GetU64(offset);
- DataRegionOffset = data.GetU64(offset);
- DataBaseAddr = data.GetU64(offset);
- DataSize = data.GetU64(offset);
-
- *offset += 104;
- lldb::offset_t offset_to_user = (*offset + sizeof(ThreadContext64));
- int ret = 0;
- ret = ParseThreadContext(data, offset);
- ret = ParseUserData(data, &offset_to_user);
-
- return ret;
-
+ lldb::offset_t *offset) {
+
+ SignalNum = data.GetU8(offset);
+ Flag = data.GetU8(offset);
+ Entries = data.GetU16(offset);
+ Version = data.GetU32(offset);
+ FDInfo = data.GetU64(offset);
+
+ LoaderOffset = data.GetU64(offset);
+ LoaderSize = data.GetU64(offset);
+ NumberOfThreads = data.GetU32(offset);
+ Reserved0 = data.GetU32(offset);
+ ThreadContextOffset = data.GetU64(offset);
+ NumSegRegion = data.GetU64(offset);
+ SegRegionOffset = data.GetU64(offset);
+ StackOffset = data.GetU64(offset);
+ StackBaseAddr = data.GetU64(offset);
+ StackSize = data.GetU64(offset);
+ DataRegionOffset = data.GetU64(offset);
+ DataBaseAddr = data.GetU64(offset);
+ DataSize = data.GetU64(offset);
+
+ *offset += 104;
+ lldb::offset_t offset_to_user = (*offset + sizeof(ThreadContext64));
+ int ret = 0;
+ ret = ParseThreadContext(data, offset);
+ ret = ParseUserData(data, &offset_to_user);
+
+ return ret;
}
-
diff --git a/lldb/source/Plugins/Process/aix-core/AIXCore.h b/lldb/source/Plugins/Process/aix-core/AIXCore.h
index 3d78d5e92..98a46772e 100644
--- a/lldb/source/Plugins/Process/aix-core/AIXCore.h
+++ b/lldb/source/Plugins/Process/aix-core/AIXCore.h
@@ -16,110 +16,106 @@
#include <cstring>
#include <type_traits>
-#include <sys/types.h>
#include <procinfo.h>
+#include <sys/types.h>
namespace AIXCORE {
struct RegContext {
- // The data is arranged in order as filled by AIXCore.cpp in this coredump file
- // so we have to fetch in that exact order, refer there.
- // But need to change
- // the context structure in order according to Infos_ppc64
- uint64_t gpr[32]; /* 64-bit gprs */
- unsigned long pc; /* msr */
- unsigned long msr; /* iar */
- unsigned long origr3; /* iar */
- unsigned long ctr; /* CTR */
- unsigned long lr; /* LR */
- unsigned long xer; /* XER */
- unsigned long cr; /* CR */
- unsigned long softe; /* CR */
- unsigned long trap; /* CR */
- unsigned int fpscr; /* floating pt status reg */
- unsigned int fpscrx; /* software ext to fpscr */
- unsigned long except[1]; /* exception address */
- double fpr[32]; /* floating pt regs */
- char fpeu; /* floating pt ever used */
- char fpinfo; /* floating pt info */
- char fpscr24_31; /* bits 24-31 of 64-bit FPSCR */
- char pad[1];
- int excp_type; /* exception type */
+ // The data is arranged in order as filled by AIXCore.cpp in this coredump
+ // file so we have to fetch in that exact order, refer there. But need to
+ // change the context structure in order according to Infos_ppc64
+ uint64_t gpr[32]; /* 64-bit gprs */
+ unsigned long pc; /* msr */
+ unsigned long msr; /* iar */
+ unsigned long origr3; /* iar */
+ unsigned long ctr; /* CTR */
+ unsigned long lr; /* LR */
+ unsigned long xer; /* XER */
+ unsigned long cr; /* CR */
+ unsigned long softe; /* CR */
+ unsigned long trap; /* CR */
+ unsigned int fpscr; /* floating pt status reg */
+ unsigned int fpscrx; /* software ext to fpscr */
+ unsigned long except[1]; /* exception address */
+ double fpr[32]; /* floating pt regs */
+ char fpeu; /* floating pt ever used */
+ char fpinfo; /* floating pt info */
+ char fpscr24_31; /* bits 24-31 of 64-bit FPSCR */
+ char pad[1];
+ int excp_type; /* exception type */
};
- struct ThreadContext64 {
- struct thrdentry64 thread;
- struct RegContext context;
- };
-
- struct UserData {
-
- struct procentry64 process;
- unsigned long long reserved[16];
- };
-
- struct AIXCore64Header {
-
- int8_t SignalNum; /* signal number (cause of error) */
- int8_t Flag; /* flag to describe core dump type */
- uint16_t Entries; /* number of core dump modules */
- uint32_t Version; /* core file format number */
- uint64_t FDInfo; /* offset to fd region in file */
-
- uint64_t LoaderOffset; /* offset to loader region in file */
- uint64_t LoaderSize; /* size of loader region */
-
- uint32_t NumberOfThreads ; /* number of elements in thread table */
- uint32_t Reserved0; /* Padding */
- uint64_t ThreadContextOffset; /* offset to thread context table */
-
- uint64_t NumSegRegion; /* n of elements in segregion */
- uint64_t SegRegionOffset; /* offset to start of segregion table */
-
- uint64_t StackOffset; /* offset of user stack in file */
- uint64_t StackBaseAddr; /* base address of user stack region */
- uint64_t StackSize; /* size of user stack region */
-
- uint64_t DataRegionOffset; /* offset to user data region */
- uint64_t DataBaseAddr; /* base address of user data region */
- uint64_t DataSize; /* size of user data region */
- uint64_t SDataBase; /* base address of sdata region */
- uint64_t SDataSize; /* size of sdata region */
-
- uint64_t NumVMRegions; /* number of anonymously mapped areas */
- uint64_t VMOffset; /* offset to start of vm_infox table */
-
- int32_t ProcessorImplementation; /* processor implementation */
- uint32_t NumElementsCTX; /* n of elements in extended ctx table*/
- uint64_t CPRSOffset; /* Checkpoint/Restart offset */
- uint64_t ExtendedContextOffset; /* extended context offset */
- uint64_t OffsetUserKey; /* Offset to user-key exception data */
- uint64_t OffsetLoaderTLS; /* offset to the loader region in file
- when a process uses TLS data */
- uint64_t TLSLoaderSize; /* size of the above loader region */
- uint64_t ExtendedProcEntry; /* Extended procentry64 information */
- uint64_t Reserved[2];
-
- struct ThreadContext64 Fault;
-
- struct UserData User;
-
- AIXCore64Header();
+struct ThreadContext64 {
+ struct thrdentry64 thread;
+ struct RegContext context;
+};
- bool ParseCoreHeader(lldb_private::DataExtractor &data,
- lldb::offset_t *offset);
- bool ParseThreadContext(lldb_private::DataExtractor &data,
- lldb::offset_t *offset);
- bool ParseUserData(lldb_private::DataExtractor &data,
- lldb::offset_t *offset);
- bool ParseRegisterContext(lldb_private::DataExtractor &data,
- lldb::offset_t *offset);
- bool ParseLoaderData(lldb_private::DataExtractor &data,
- lldb::offset_t *offset);
+struct UserData {
- };
+ struct procentry64 process;
+ unsigned long long reserved[16];
+};
+struct AIXCore64Header {
+
+ int8_t SignalNum; /* signal number (cause of error) */
+ int8_t Flag; /* flag to describe core dump type */
+ uint16_t Entries; /* number of core dump modules */
+ uint32_t Version; /* core file format number */
+ uint64_t FDInfo; /* offset to fd region in file */
+
+ uint64_t LoaderOffset; /* offset to loader region in file */
+ uint64_t LoaderSize; /* size of loader region */
+
+ uint32_t NumberOfThreads; /* number of elements in thread table */
+ uint32_t Reserved0; /* Padding */
+ uint64_t ThreadContextOffset; /* offset to thread context table */
+
+ uint64_t NumSegRegion; /* n of elements in segregion */
+ uint64_t SegRegionOffset; /* offset to start of segregion table */
+
+ uint64_t StackOffset; /* offset of user stack in file */
+ uint64_t StackBaseAddr; /* base address of user stack region */
+ uint64_t StackSize; /* size of user stack region */
+
+ uint64_t DataRegionOffset; /* offset to user data region */
+ uint64_t DataBaseAddr; /* base address of user data region */
+ uint64_t DataSize; /* size of user data region */
+ uint64_t SDataBase; /* base address of sdata region */
+ uint64_t SDataSize; /* size of sdata region */
+
+ uint64_t NumVMRegions; /* number of anonymously mapped areas */
+ uint64_t VMOffset; /* offset to start of vm_infox table */
+
+ int32_t ProcessorImplementation; /* processor implementation */
+ uint32_t NumElementsCTX; /* n of elements in extended ctx table*/
+ uint64_t CPRSOffset; /* Checkpoint/Restart offset */
+ uint64_t ExtendedContextOffset; /* extended context offset */
+ uint64_t OffsetUserKey; /* Offset to user-key exception data */
+ uint64_t OffsetLoaderTLS; /* offset to the loader region in file
+ when a process uses TLS data */
+ uint64_t TLSLoaderSize; /* size of the above loader region */
+ uint64_t ExtendedProcEntry; /* Extended procentry64 information */
+ uint64_t Reserved[2];
+
+ struct ThreadContext64 Fault;
+
+ struct UserData User;
+
+ AIXCore64Header();
+
+ bool ParseCoreHeader(lldb_private::DataExtractor &data,
+ lldb::offset_t *offset);
+ bool ParseThreadContext(lldb_private::DataExtractor &data,
+ lldb::offset_t *offset);
+ bool ParseUserData(lldb_private::DataExtractor &data, lldb::offset_t *offset);
+ bool ParseRegisterContext(lldb_private::DataExtractor &data,
+ lldb::offset_t *offset);
+ bool ParseLoaderData(lldb_private::DataExtractor &data,
+ lldb::offset_t *offset);
+};
-}
+} // namespace AIXCORE
#endif // LLDB_SOURCE_PLUGINS_PROCESS_AIX_CORE_AIXCORE_H
diff --git a/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.cpp b/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.cpp
index bb2db66e2..70895164d 100644
--- a/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.cpp
+++ b/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.cpp
@@ -25,11 +25,11 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/State.h"
-#include "llvm/Support/Threading.h"
#include "Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h"
+#include "llvm/Support/Threading.h"
-#include "ProcessAIXCore.h"
#include "AIXCore.h"
+#include "ProcessAIXCore.h"
#include "ThreadAIXCore.h"
using namespace lldb_private;
@@ -59,21 +59,20 @@ lldb::ProcessSP ProcessAIXCore::CreateInstance(lldb::TargetSP target_sp,
bool can_connect) {
lldb::ProcessSP process_sp;
if (crash_file && !can_connect) {
- const size_t header_size = sizeof(AIXCORE::AIXCore64Header);
-
- auto data_sp = FileSystem::Instance().CreateDataBuffer(
- crash_file->GetPath(), header_size, 0);
-
- if (data_sp && data_sp->GetByteSize() == header_size) {
- AIXCORE::AIXCore64Header aixcore_header;
- DataExtractor data(data_sp, lldb::eByteOrderBig, 4);
- lldb::offset_t data_offset = 0;
- if(aixcore_header.ParseCoreHeader(data, &data_offset)) {
- process_sp = std::make_shared<ProcessAIXCore>(target_sp, listener_sp,
- *crash_file);
- }
+ const size_t header_size = sizeof(AIXCORE::AIXCore64Header);
+
+ auto data_sp = FileSystem::Instance().CreateDataBuffer(
+ crash_file->GetPath(), header_size, 0);
+
+ if (data_sp && data_sp->GetByteSize() == header_size) {
+ AIXCORE::AIXCore64Header aixcore_header;
+ DataExtractor data(data_sp, lldb::eByteOrderBig, 4);
+ lldb::offset_t data_offset = 0;
+ if (aixcore_header.ParseCoreHeader(data, &data_offset)) {
+ process_sp = std::make_shared<ProcessAIXCore>(target_sp, listener_sp,
+ *crash_file);
}
-
+ }
}
return process_sp;
}
@@ -101,19 +100,18 @@ lldb::addr_t ProcessAIXCore::AddAddressRanges(AIXCORE::AIXCore64Header header) {
if (header.StackSize > 0) {
VMRangeToFileOffset::Entry *last_entry = m_core_aranges.Back();
- if (last_entry &&
- last_entry->GetRangeEnd() == range_entry.GetRangeBase() &&
+ if (last_entry && last_entry->GetRangeEnd() == range_entry.GetRangeBase() &&
last_entry->data.GetRangeEnd() == range_entry.data.GetRangeBase() &&
last_entry->GetByteSize() == last_entry->data.GetByteSize()) {
- last_entry->SetRangeEnd(range_entry.GetRangeEnd());
- last_entry->data.SetRangeEnd(range_entry.data.GetRangeEnd());
+ last_entry->SetRangeEnd(range_entry.GetRangeEnd());
+ last_entry->data.SetRangeEnd(range_entry.data.GetRangeEnd());
} else {
- m_core_aranges.Append(range_entry);
+ m_core_aranges.Append(range_entry);
}
}
- const uint32_t permissions = lldb::ePermissionsReadable |
- lldb::ePermissionsWritable;
+ const uint32_t permissions =
+ lldb::ePermissionsReadable | lldb::ePermissionsWritable;
m_core_range_infos.Append(
VMRangeToPermissions::Entry(addr, header.StackSize, permissions));
@@ -122,21 +120,21 @@ lldb::addr_t ProcessAIXCore::AddAddressRanges(AIXCORE::AIXCore64Header header) {
}
bool ProcessAIXCore::CanDebug(lldb::TargetSP target_sp,
- bool plugin_specified_by_name) {
-
- if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) {
- ModuleSpec core_module_spec(m_core_file, target_sp->GetArchitecture());
- Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp,
- nullptr, nullptr, nullptr));
- if (m_core_module_sp) {
- ObjectFile *core_objfile = m_core_module_sp->GetObjectFile();
- if (core_objfile && core_objfile->GetType() == ObjectFile::eTypeCoreFile){
- return true;
- }
- }
+ bool plugin_specified_by_name) {
+
+ if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) {
+ ModuleSpec core_module_spec(m_core_file, target_sp->GetArchitecture());
+ Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp,
+ nullptr, nullptr, nullptr));
+ if (m_core_module_sp) {
+ ObjectFile *core_objfile = m_core_module_sp->GetObjectFile();
+ if (core_objfile &&
+ core_objfile->GetType() == ObjectFile::eTypeCoreFile) {
+ return true;
+ }
}
- return false;
-
+ }
+ return false;
}
ArchSpec ProcessAIXCore::GetArchitecture() {
@@ -158,118 +156,120 @@ lldb_private::DynamicLoader *ProcessAIXCore::GetDynamicLoader() {
}
void ProcessAIXCore::ParseAIXCoreFile() {
-
- Log *log = GetLog(LLDBLog::Process);
- AIXSigInfo siginfo;
- ThreadData thread_data;
-
- const lldb_private::UnixSignals &unix_signals = *GetUnixSignals();
- const ArchSpec &arch = GetArchitecture();
-
- siginfo.Parse(m_aixcore_header, arch, unix_signals);
- thread_data.siginfo = siginfo;
- SetID(m_aixcore_header.User.process.pi_pid);
-
- thread_data.name.assign (m_aixcore_header.User.process.pi_comm,
- strnlen (m_aixcore_header.User.process.pi_comm,
- sizeof (m_aixcore_header.User.process.pi_comm)));
-
- lldb::DataBufferSP data_buffer_sp(new lldb_private::DataBufferHeap(sizeof(m_aixcore_header.Fault.context), 0));
-
- memcpy(static_cast<void *>(const_cast<uint8_t *>(data_buffer_sp->GetBytes())),
- &m_aixcore_header.Fault.context, sizeof(m_aixcore_header.Fault.context));
-
- lldb_private::DataExtractor data(data_buffer_sp, lldb::eByteOrderBig, 8);
-
- thread_data.gpregset = DataExtractor(data, 0, sizeof(m_aixcore_header.Fault.context));
- m_thread_data.push_back(thread_data);
- LLDB_LOGF(log, "ProcessAIXCore: Parsing Complete!");
+ Log *log = GetLog(LLDBLog::Process);
+ AIXSigInfo siginfo;
+ ThreadData thread_data;
+
+ const lldb_private::UnixSignals &unix_signals = *GetUnixSignals();
+ const ArchSpec &arch = GetArchitecture();
+
+ siginfo.Parse(m_aixcore_header, arch, unix_signals);
+ thread_data.siginfo = siginfo;
+ SetID(m_aixcore_header.User.process.pi_pid);
+
+ thread_data.name.assign(
+ m_aixcore_header.User.process.pi_comm,
+ strnlen(m_aixcore_header.User.process.pi_comm,
+ sizeof(m_aixcore_header.User.process.pi_comm)));
+
+ lldb::DataBufferSP data_buffer_sp(new lldb_private::DataBufferHeap(
+ sizeof(m_aixcore_header.Fault.context), 0));
+
+ memcpy(static_cast<void *>(const_cast<uint8_t *>(data_buffer_sp->GetBytes())),
+ &m_aixcore_header.Fault.context,
+ sizeof(m_aixcore_header.Fault.context));
+
+ lldb_private::DataExtractor data(data_buffer_sp, lldb::eByteOrderBig, 8);
+
+ thread_data.gpregset =
+ DataExtractor(data, 0, sizeof(m_aixcore_header.Fault.context));
+ m_thread_data.push_back(thread_data);
+ LLDB_LOGF(log, "ProcessAIXCore: Parsing Complete!");
}
// Process Control
Status ProcessAIXCore::DoLoadCore() {
-
- Status error;
- if (!m_core_module_sp) {
- error = Status::FromErrorString("invalid core module");
- return error;
- }
- FileSpec file = m_core_module_sp->GetObjectFile()->GetFileSpec();
- Log *log = GetLog(LLDBLog::Process);
-
- if (file) {
- const size_t header_size = sizeof(AIXCORE::AIXCore64Header);
- auto data_sp = FileSystem::Instance().CreateDataBuffer(
- file.GetPath(), -1, 0);
- if (data_sp && data_sp->GetByteSize() != 0) {
-
- DataExtractor data(data_sp, lldb::eByteOrderBig, 4);
- lldb::offset_t data_offset = 0;
- m_aixcore_header.ParseCoreHeader(data, &data_offset);
- lldb::addr_t addr = AddAddressRanges(m_aixcore_header);
- if (addr == LLDB_INVALID_ADDRESS)
- LLDB_LOGF(log, "ProcessAIXCore: Invalid base address. Stack information will be limited");
- auto dyld = static_cast<DynamicLoaderAIXDYLD *>(GetDynamicLoader());
- dyld->FillCoreLoaderData(data, m_aixcore_header.LoaderOffset,
- m_aixcore_header.LoaderSize);
-
- } else {
- error = Status::FromErrorString("invalid data");
- return error;
- }
- } else {
- error = Status::FromErrorString("invalid file");
- return error;
- }
+ Status error;
+ if (!m_core_module_sp) {
+ error = Status::FromErrorString("invalid core module");
+ return error;
+ }
+
+ FileSpec file = m_core_module_sp->GetObjectFile()->GetFileSpec();
+ Log *log = GetLog(LLDBLog::Process);
+
+ if (file) {
+ const size_t header_size = sizeof(AIXCORE::AIXCore64Header);
+ auto data_sp =
+ FileSystem::Instance().CreateDataBuffer(file.GetPath(), -1, 0);
+ if (data_sp && data_sp->GetByteSize() != 0) {
+
+ DataExtractor data(data_sp, lldb::eByteOrderBig, 4);
+ lldb::offset_t data_offset = 0;
+ m_aixcore_header.ParseCoreHeader(data, &data_offset);
+ lldb::addr_t addr = AddAddressRanges(m_aixcore_header);
+ if (addr == LLDB_INVALID_ADDRESS)
+ LLDB_LOGF(log, "ProcessAIXCore: Invalid base address. Stack "
+ "information will be limited");
+ auto dyld = static_cast<DynamicLoaderAIXDYLD *>(GetDynamicLoader());
+ dyld->FillCoreLoaderData(data, m_aixcore_header.LoaderOffset,
+ m_aixcore_header.LoaderSize);
- m_thread_data_valid = true;
- ParseAIXCoreFile();
- ArchSpec arch(m_core_module_sp->GetArchitecture());
-
- ArchSpec target_arch = GetTarget().GetArchitecture();
- ArchSpec core_arch(m_core_module_sp->GetArchitecture());
- target_arch.MergeFrom(core_arch);
- GetTarget().SetArchitecture(target_arch);
-
- lldb::ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
- if (!exe_module_sp) {
- ModuleSpec exe_module_spec;
- exe_module_spec.GetArchitecture() = arch;
- exe_module_spec.GetFileSpec().SetFile(m_aixcore_header.User.process.pi_comm,
- FileSpec::Style::native);
- exe_module_sp =
- GetTarget().GetOrCreateModule(exe_module_spec, true /* notify */);
- if (exe_module_sp)
- GetTarget().SetExecutableModule(exe_module_sp, eLoadDependentsNo);
+ } else {
+ error = Status::FromErrorString("invalid data");
+ return error;
}
-
+ } else {
+ error = Status::FromErrorString("invalid file");
return error;
+ }
+
+ m_thread_data_valid = true;
+ ParseAIXCoreFile();
+ ArchSpec arch(m_core_module_sp->GetArchitecture());
+
+ ArchSpec target_arch = GetTarget().GetArchitecture();
+ ArchSpec core_arch(m_core_module_sp->GetArchitecture());
+ target_arch.MergeFrom(core_arch);
+ GetTarget().SetArchitecture(target_arch);
+
+ lldb::ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
+ if (!exe_module_sp) {
+ ModuleSpec exe_module_spec;
+ exe_module_spec.GetArchitecture() = arch;
+ exe_module_spec.GetFileSpec().SetFile(m_aixcore_header.User.process.pi_comm,
+ FileSpec::Style::native);
+ exe_module_sp =
+ GetTarget().GetOrCreateModule(exe_module_spec, true /* notify */);
+ if (exe_module_sp)
+ GetTarget().SetExecutableModule(exe_module_sp, eLoadDependentsNo);
+ }
+
+ return error;
}
bool ProcessAIXCore::DoUpdateThreadList(ThreadList &old_thread_list,
- ThreadList &new_thread_list)
-{
- const ThreadData &td = m_thread_data[0];
-
- lldb::ThreadSP thread_sp =
- std::make_shared<ThreadAIXCore>(*this, td);
- new_thread_list.AddThread(thread_sp);
-
- return true;
-}
+ ThreadList &new_thread_list) {
+ const ThreadData &td = m_thread_data[0];
+
+ lldb::ThreadSP thread_sp = std::make_shared<ThreadAIXCore>(*this, td);
+ new_thread_list.AddThread(thread_sp);
+
+ return true;
+}
void ProcessAIXCore::RefreshStateAfterStop() {}
// Process Memory
size_t ProcessAIXCore::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
Status &error) {
- if(addr == LLDB_INVALID_ADDRESS)
- return 0;
+ if (addr == LLDB_INVALID_ADDRESS)
+ return 0;
if (lldb::ABISP abi_sp = GetABI())
- addr = abi_sp->FixAnyAddress(addr);
+ addr = abi_sp->FixAnyAddress(addr);
// Don't allow the caching that lldb_private::Process::ReadMemory does since
// in core files we have it all cached our our core file anyway.
@@ -278,39 +278,39 @@ size_t ProcessAIXCore::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
size_t ProcessAIXCore::DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
Status &error) {
- ObjectFile *core_objfile = m_core_module_sp->GetObjectFile();
- if (core_objfile == nullptr)
- return 0;
- // Get the address range
- const VMRangeToFileOffset::Entry *address_range =
- m_core_aranges.FindEntryThatContains(addr);
- if (address_range == nullptr || address_range->GetRangeEnd() < addr) {
- error = Status::FromErrorStringWithFormat(
- "core file does not contain 0x%" PRIx64, addr);
- return 0;
- }
+ ObjectFile *core_objfile = m_core_module_sp->GetObjectFile();
+ if (core_objfile == nullptr)
+ return 0;
+ // Get the address range
+ const VMRangeToFileOffset::Entry *address_range =
+ m_core_aranges.FindEntryThatContains(addr);
+ if (address_range == nullptr || address_range->GetRangeEnd() < addr) {
+ error = Status::FromErrorStringWithFormat(
+ "core file does not contain 0x%" PRIx64, addr);
+ return 0;
+ }
- // Convert the address into core file offset
- const lldb::addr_t offset = addr - address_range->GetRangeBase();
- const lldb::addr_t file_start = address_range->data.GetRangeBase();
- const lldb::addr_t file_end = address_range->data.GetRangeEnd();
- size_t bytes_to_read = size; // Number of bytes to read from the core file
- size_t bytes_copied = 0; // Number of bytes actually read from the core file
- // Number of bytes available in the core file from the given address
- lldb::addr_t bytes_left = 0;
+ // Convert the address into core file offset
+ const lldb::addr_t offset = addr - address_range->GetRangeBase();
+ const lldb::addr_t file_start = address_range->data.GetRangeBase();
+ const lldb::addr_t file_end = address_range->data.GetRangeEnd();
+ size_t bytes_to_read = size; // Number of bytes to read from the core file
+ size_t bytes_copied = 0; // Number of bytes actually read from the core file
+ // Number of bytes available in the core file from the given address
+ lldb::addr_t bytes_left = 0;
- // Don't proceed if core file doesn't contain the actual data for this
- // address range.
- if (file_start == file_end)
- return 0;
+ // Don't proceed if core file doesn't contain the actual data for this
+ // address range.
+ if (file_start == file_end)
+ return 0;
- // Figure out how many on-disk bytes remain in this segment starting at the
- // given offset
- if (file_end > file_start + offset)
- bytes_left = file_end - (file_start + offset);
+ // Figure out how many on-disk bytes remain in this segment starting at the
+ // given offset
+ if (file_end > file_start + offset)
+ bytes_left = file_end - (file_start + offset);
- if (bytes_to_read > bytes_left)
- bytes_to_read = bytes_left;
+ if (bytes_to_read > bytes_left)
+ bytes_to_read = bytes_left;
// If there is data available on the core file read it
if (bytes_to_read)
@@ -321,8 +321,8 @@ size_t ProcessAIXCore::DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
}
Status ProcessAIXCore::DoGetMemoryRegionInfo(lldb::addr_t load_addr,
- MemoryRegionInfo ®ion_info) {
- return Status();
+ MemoryRegionInfo ®ion_info) {
+ return Status();
}
Status ProcessAIXCore::DoDestroy() { return Status(); }
diff --git a/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.h b/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.h
index ffd9e401e..7c92f292f 100644
--- a/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.h
+++ b/lldb/source/Plugins/Process/aix-core/ProcessAIXCore.h
@@ -14,11 +14,11 @@
#include <list>
#include <vector>
-#include "lldb/Target/PostMortemProcess.h"
-#include "lldb/Utility/Status.h"
-#include "lldb/Target/Process.h"
#include "AIXCore.h"
#include "ThreadAIXCore.h"
+#include "lldb/Target/PostMortemProcess.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/Status.h"
struct ThreadData;
@@ -58,19 +58,19 @@ public:
bool WarnBeforeDetach() const override { return false; }
lldb_private::ArchSpec GetArchitecture();
-
+
bool CanDebug(lldb::TargetSP target_sp,
- bool plugin_specified_by_name) override;
-
+ bool plugin_specified_by_name) override;
+
// Creating a new process, or attaching to an existing one
lldb_private::Status DoLoadCore() override;
-
+
bool DoUpdateThreadList(lldb_private::ThreadList &old_thread_list,
- lldb_private::ThreadList &new_thread_list) override;
+ lldb_private::ThreadList &new_thread_list) override;
lldb_private::Status
DoGetMemoryRegionInfo(lldb::addr_t load_addr,
- lldb_private::MemoryRegionInfo ®ion_info) override;
+ lldb_private::MemoryRegionInfo ®ion_info) override;
void RefreshStateAfterStop() override;
@@ -81,11 +81,11 @@ public:
lldb_private::Status &error) override;
size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
- lldb_private::Status &error) override;
+ lldb_private::Status &error) override;
void ParseAIXCoreFile();
- lldb::addr_t AddAddressRanges(AIXCORE::AIXCore64Header header);
+ lldb::addr_t AddAddressRanges(AIXCORE::AIXCore64Header header);
private:
lldb::ModuleSP m_core_module_sp;
diff --git a/lldb/source/Plugins/Process/aix-core/RegisterContextCoreAIX_ppc64.cpp b/lldb/source/Plugins/Process/aix-core/RegisterContextCoreAIX_ppc64.cpp
index b243017bf..20f59e08e 100644
--- a/lldb/source/Plugins/Process/aix-core/RegisterContextCoreAIX_ppc64.cpp
+++ b/lldb/source/Plugins/Process/aix-core/RegisterContextCoreAIX_ppc64.cpp
@@ -30,7 +30,7 @@ RegisterContextCoreAIX_ppc64::RegisterContextCoreAIX_ppc64(
// This Code is for Registers like FPR, VSR, VMX and is disabled right now.
// It will be implemented as per need.
-
+
/* ArchSpec arch = register_info->GetTargetArchitecture();
DataExtractor fpregset;// = getRegset(notes, arch.GetTriple(), FPR_Desc);
m_fpr_buffer = std::make_shared<DataBufferHeap>(fpregset.GetDataStart(),
@@ -64,8 +64,8 @@ size_t RegisterContextCoreAIX_ppc64::GetVSXSize() const {
return k_num_vsx_registers_ppc64le * sizeof(uint64_t) * 2;
}
-bool RegisterContextCoreAIX_ppc64::ReadRegister(
- const RegisterInfo *reg_info, RegisterValue &value) {
+bool RegisterContextCoreAIX_ppc64::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &value) {
lldb::offset_t offset = reg_info->byte_offset;
if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
@@ -130,7 +130,7 @@ bool RegisterContextCoreAIX_ppc64::ReadRegister(
return false;
}
-bool RegisterContextCoreAIX_ppc64::WriteRegister(
- const RegisterInfo *reg_info, const RegisterValue &value) {
+bool RegisterContextCoreAIX_ppc64::WriteRegister(const RegisterInfo *reg_info,
+ const RegisterValue &value) {
return false;
}
diff --git a/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.cpp b/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.cpp
index 979e5199f..11088b2fe 100644
--- a/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.cpp
+++ b/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.cpp
@@ -22,12 +22,12 @@
#include "Plugins/Process/elf-core/RegisterContextPOSIXCore_powerpc.h"
#include "RegisterContextCoreAIX_ppc64.h"
-#include "ProcessAIXCore.h"
#include "AIXCore.h"
+#include "ProcessAIXCore.h"
#include "ThreadAIXCore.h"
-#include <memory>
#include <iostream>
+#include <memory>
using namespace lldb;
using namespace lldb_private;
@@ -35,8 +35,7 @@ using namespace lldb_private;
// Construct a Thread object with given data
ThreadAIXCore::ThreadAIXCore(Process &process, const ThreadData &td)
: Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(),
- m_gpregset_data(td.gpregset),
- m_siginfo(std::move(td.siginfo)) {}
+ m_gpregset_data(td.gpregset), m_siginfo(std::move(td.siginfo)) {}
ThreadAIXCore::~ThreadAIXCore() { DestroyThread(); }
@@ -69,18 +68,18 @@ ThreadAIXCore::CreateRegisterContextForFrame(StackFrame *frame) {
RegisterInfoInterface *reg_interface = nullptr;
switch (arch.GetMachine()) {
- case llvm::Triple::ppc64:
- reg_interface = new RegisterInfoPOSIX_ppc64le(arch);
- m_thread_reg_ctx_sp = std::make_shared<RegisterContextCoreAIX_ppc64>(
- *this, reg_interface, m_gpregset_data);
- break;
- default:
- break;
+ case llvm::Triple::ppc64:
+ reg_interface = new RegisterInfoPOSIX_ppc64le(arch);
+ m_thread_reg_ctx_sp = std::make_shared<RegisterContextCoreAIX_ppc64>(
+ *this, reg_interface, m_gpregset_data);
+ break;
+ default:
+ break;
}
reg_ctx_sp = m_thread_reg_ctx_sp;
- } else {
- reg_ctx_sp = GetUnwinder().CreateRegisterContextForFrame(frame);
- }
+ } else {
+ reg_ctx_sp = GetUnwinder().CreateRegisterContextForFrame(frame);
+ }
return reg_ctx_sp;
}
@@ -107,21 +106,20 @@ bool ThreadAIXCore::CalculateStopInfo() {
return true;
}
-void AIXSigInfo::Parse(const AIXCORE::AIXCore64Header data, const ArchSpec &arch,
- const lldb_private::UnixSignals &unix_signals) {
- si_signo = data.SignalNum;
- sigfault.si_addr = data.Fault.context.pc;
+void AIXSigInfo::Parse(const AIXCORE::AIXCore64Header data,
+ const ArchSpec &arch,
+ const lldb_private::UnixSignals &unix_signals) {
+ si_signo = data.SignalNum;
+ sigfault.si_addr = data.Fault.context.pc;
}
AIXSigInfo::AIXSigInfo() { memset(this, 0, sizeof(AIXSigInfo)); }
size_t AIXSigInfo::GetSize(const lldb_private::ArchSpec &arch) {
- return sizeof(AIXSigInfo);
+ return sizeof(AIXSigInfo);
}
std::string AIXSigInfo::GetDescription(
const lldb_private::UnixSignals &unix_signals) const {
- return unix_signals.GetSignalDescription(si_signo, 0,
- sigfault.si_addr);
-
+ return unix_signals.GetSignalDescription(si_signo, 0, sigfault.si_addr);
}
diff --git a/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.h b/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.h
index 9ee157e9b..a7e53c934 100644
--- a/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.h
+++ b/lldb/source/Plugins/Process/aix-core/ThreadAIXCore.h
@@ -9,27 +9,27 @@
#ifndef LLDB_SOURCE_PLUGINS_PROCESS_AIX_CORE_THREADAIXCORE_H
#define LLDB_SOURCE_PLUGINS_PROCESS_AIX_CORE_THREADAIXCORE_H
+#include "AIXCore.h"
+#include "ProcessAIXCore.h"
+#include "ThreadAIXCore.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/DataExtractor.h"
#include "llvm/ADT/DenseMap.h"
#include <optional>
#include <string>
-#include "ProcessAIXCore.h"
-#include "AIXCore.h"
-#include "ThreadAIXCore.h"
namespace lldb_private {
class ProcessInstanceInfo;
}
struct AIXSigInfo {
-
- //COPY siginfo_t correctly for AIX version
+
+ // COPY siginfo_t correctly for AIX version
int32_t si_signo; // Order matters for the first 3.
int32_t si_errno;
int32_t si_code;
struct alignas(8) {
- lldb::addr_t si_addr;
+ lldb::addr_t si_addr;
int16_t si_addr_lsb;
union {
struct {
@@ -46,8 +46,8 @@ struct AIXSigInfo {
AIXSigInfo();
void Parse(const AIXCORE::AIXCore64Header data,
- const lldb_private::ArchSpec &arch,
- const lldb_private::UnixSignals &unix_signals);
+ const lldb_private::ArchSpec &arch,
+ const lldb_private::UnixSignals &unix_signals);
std::string
GetDescription(const lldb_private::UnixSignals &unix_signals) const;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index f8ade2e2e..8850ecc39 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1735,8 +1735,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];
@@ -1744,12 +1743,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 007357910..8f25a8885 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);
@@ -3011,7 +3012,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);
@@ -3022,7 +3024,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 0016e65e3..bfac10cf0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -999,7 +999,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;
@@ -1083,7 +1083,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 4454ac4f0..cf7d06d6e 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1517,7 +1517,8 @@ RegisterContextUnwind::SavedLocationForRegister(
UnwindLLDB::ConcreteRegisterLocation::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
@@ -2402,12 +2403,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 1151da982..c875d31cd 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/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index c6a929b72..e4ecaa4c4 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -642,7 +642,8 @@ void Driver::UpdateWindowSize() {
}
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
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 9c6f444b5..fdff75d62 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,
|
) 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 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 (cherry picked from commit b804516)
Resolved merge conflict with the file: lldb/tools/lldb-dap/CMakeLists.txt Signed-off-by: Ravindra Shinde <[email protected]>
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 Incremental PR on ObjectFileXCOFF.cpp This PR is intended to handle XCOFF sections.
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/llvm-project#101657 The complete changes for porting are present in this draft PR: llvm/llvm-project#102601 Incremental PR on ObjectFileXCOFF.cpp This PR is intended to handle XCOFF sections.
Removing netbsd license dependency dladdr() code removed.
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 **Description:** Adding NativeThreadAIX base files, to be integrated with already merged NativeProcessAIX.
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/llvm-project#101657 The complete changes for porting are present in this draft PR: llvm/llvm-project#102601 **Description:** Adding NativeThreadAIX base files, to be integrated with already merged NativeProcessAIX.
Removed netbsd license files Actual netbsd's code removed through this PR #59
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 **Description:** Adding support for XCOFF 32 bit file format as well in lldb, up to the point where 64-bit support is implemented. Added a new test case for the same. This is an incremental PR on top of the previous couple of XCOFF support commits.
Need to access process/main-thread name from psinfo on aix rather than comm on linux. (0) root @ unobosdev002: /home/dhruv/dio_fs/LLDB/build-lldb # bin/lldb ../tests/1 (lldb) target create "../tests/1" Current executable set to '/home/dhruv/dio_fs/LLDB/tests/1' (powerpc64). (lldb) b main Breakpoint 1: where = 1`main + 8 at 1.c:3, address = 0x0000000100000928 (lldb) r Process 44433678 launched: '/home/dhruv/dio_fs/LLDB/tests/1' (powerpc64) Process 44433678 stopped * thread #1, name = '1', stop reason = breakpoint 1.1 frame #0: 0x0000000100000928 1`main at 1.c:3 1 int main() 2 { -> 3 int x = 10; 4 x++; 5 return x; 6 } (lldb) thread info thread #1: tid = 0x2a6010e, 0x0000000100000928 1`main at 1.c:3, name = '1', stop reason = breakpoint 1.1
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/llvm-project#101657 The complete changes for porting are present in this draft PR: llvm/llvm-project#102601 **Description:** Adding support for XCOFF 32 bit file format as well in lldb, up to the point where 64-bit support is implemented. Added a new test case for the same. This is an incremental PR on top of the previous couple of XCOFF support commits.
Get base address for each module for image list command
1188732:lldb, print command does not works properly sometimes Signed-off-by: Ravindra Shinde <[email protected]>
Global variables are not accessed correctly, as the data/bss sections corrupted.
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