[clang] [lldb] [llvm] Extending LLDB to work on AIX (PR #102601)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 30 00:36:12 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 8ca6401fdd36c17a8d68a8fb06b7d43c2540a027 094e5907fe6b81b894916c6d9da72b7c212e2c80 --extensions cpp,h -- lldb/include/lldb/Host/aix/AbstractSocket.h lldb/include/lldb/Host/aix/Host.h lldb/include/lldb/Host/aix/HostInfoAIX.h lldb/include/lldb/Host/aix/Ptrace.h lldb/include/lldb/Host/aix/Support.h lldb/include/lldb/Host/aix/Uio.h lldb/source/Host/aix/AbstractSocket.cpp lldb/source/Host/aix/Host.cpp lldb/source/Host/aix/HostInfoAIX.cpp lldb/source/Host/aix/Support.cpp lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp lldb/source/Plugins/Platform/AIX/PlatformAIX.h lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp lldb/source/Plugins/Process/AIX/NativeProcessAIX.h lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp lldb/source/Plugins/Process/AIX/NativeThreadAIX.h clang/lib/CodeGen/CGObjCMac.cpp lldb/include/lldb/Core/Module.h lldb/include/lldb/Core/ModuleSpec.h lldb/include/lldb/Host/HostGetOpt.h lldb/include/lldb/Host/HostInfo.h lldb/include/lldb/Host/HostInfoBase.h lldb/include/lldb/Host/XML.h lldb/include/lldb/Host/common/GetOptInc.h lldb/include/lldb/Symbol/ObjectFile.h lldb/include/lldb/Target/ABI.h lldb/include/lldb/Target/DynamicLoader.h lldb/include/lldb/Target/Process.h lldb/include/lldb/Target/RegisterContextUnwind.h lldb/include/lldb/Target/ThreadPlanCallFunction.h lldb/include/lldb/Utility/StringExtractorGDBRemote.h lldb/source/Core/DynamicLoader.cpp lldb/source/Core/Mangled.cpp lldb/source/Core/Module.cpp lldb/source/Core/Section.cpp lldb/source/Host/common/GetOptInc.cpp lldb/source/Host/common/Host.cpp lldb/source/Host/common/XML.cpp lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/source/Host/posix/FileSystemPosix.cpp lldb/source/Host/posix/MainLoopPosix.cpp lldb/source/Host/posix/ProcessLauncherPosixFork.cpp lldb/source/Initialization/SystemInitializerCommon.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/Language/ObjC/Cocoa.cpp lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/source/Target/ABI.cpp lldb/source/Target/Process.cpp lldb/source/Target/RegisterContextUnwind.cpp lldb/source/Target/ThreadPlanCallFunction.cpp lldb/source/Target/UnwindLLDB.cpp lldb/source/Utility/ArchSpec.cpp lldb/source/Utility/StringExtractorGDBRemote.cpp lldb/tools/driver/Driver.cpp lldb/tools/lldb-server/SystemInitializerLLGS.cpp lldb/tools/lldb-server/lldb-gdbserver.cpp lldb/unittests/Host/FileSystemTest.cpp lldb/unittests/Host/posix/TerminalTest.cpp llvm/include/llvm/Object/XCOFFObjectFile.h llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 4fe06412b6..ddf35ed25e 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -20,8 +20,8 @@
#include "llvm/Support/Chrono.h"
#include <mutex>
-#include <vector>
#include <string.h>
+#include <vector>
namespace lldb_private {
@@ -43,7 +43,8 @@ public:
ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
: m_arch(arch), m_object_offset(0) {
- // parse object inside module format for example: /usr/ccs/lib/libc.a(shr_64.o)
+ // parse object inside module format for example:
+ // /usr/ccs/lib/libc.a(shr_64.o)
llvm::SmallString<256> path_with_object;
file_spec.GetPath(path_with_object);
if (strstr(path_with_object.c_str(), "(") != nullptr) {
diff --git a/lldb/include/lldb/Host/XML.h b/lldb/include/lldb/Host/XML.h
index cf359f7726..7c88f558a5 100644
--- a/lldb/include/lldb/Host/XML.h
+++ b/lldb/include/lldb/Host/XML.h
@@ -12,7 +12,7 @@
#include "lldb/Host/Config.h"
#if defined(__AIX__)
-//FIXME for AIX
+// FIXME for AIX
#undef LLDB_ENABLE_LIBXML2
#endif
diff --git a/lldb/include/lldb/Host/aix/AbstractSocket.h b/lldb/include/lldb/Host/aix/AbstractSocket.h
index 78a567a6b9..f8741c99ae 100644
--- a/lldb/include/lldb/Host/aix/AbstractSocket.h
+++ b/lldb/include/lldb/Host/aix/AbstractSocket.h
@@ -20,6 +20,6 @@ protected:
size_t GetNameOffset() const override;
void DeleteSocketFile(llvm::StringRef name) override;
};
-}
+} // namespace lldb_private
#endif // ifndef liblldb_AbstractSocket_h_
diff --git a/lldb/include/lldb/Host/aix/HostInfoAIX.h b/lldb/include/lldb/Host/aix/HostInfoAIX.h
index ced4cf34d3..8f21379752 100644
--- a/lldb/include/lldb/Host/aix/HostInfoAIX.h
+++ b/lldb/include/lldb/Host/aix/HostInfoAIX.h
@@ -37,6 +37,6 @@ protected:
static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
ArchSpec &arch_64);
};
-}
+} // namespace lldb_private
#endif
diff --git a/lldb/include/lldb/Host/aix/Ptrace.h b/lldb/include/lldb/Host/aix/Ptrace.h
index 88928f1810..72737fd9b1 100644
--- a/lldb/include/lldb/Host/aix/Ptrace.h
+++ b/lldb/include/lldb/Host/aix/Ptrace.h
@@ -17,16 +17,16 @@
// Support ptrace extensions even when compiled without required kernel support
#ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS (PT_COMMAND_MAX+1)
+#define PTRACE_GETREGS (PT_COMMAND_MAX + 1)
#endif
#ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS (PT_COMMAND_MAX+2)
+#define PTRACE_SETREGS (PT_COMMAND_MAX + 2)
#endif
#ifndef PTRACE_GETFPREGS
-#define PTRACE_GETFPREGS (PT_COMMAND_MAX+3)
+#define PTRACE_GETFPREGS (PT_COMMAND_MAX + 3)
#endif
#ifndef PTRACE_SETFPREGS
-#define PTRACE_SETFPREGS (PT_COMMAND_MAX+4)
+#define PTRACE_SETFPREGS (PT_COMMAND_MAX + 4)
#endif
#ifndef PTRACE_GETREGSET
#define PTRACE_GETREGSET 0x4204
@@ -35,10 +35,10 @@
#define PTRACE_SETREGSET 0x4205
#endif
#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA (PT_COMMAND_MAX+5)
+#define PTRACE_GET_THREAD_AREA (PT_COMMAND_MAX + 5)
#endif
#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL (PT_COMMAND_MAX+6)
+#define PTRACE_ARCH_PRCTL (PT_COMMAND_MAX + 6)
#endif
#ifndef ARCH_GET_FS
#define ARCH_SET_GS 0x1001
@@ -47,16 +47,16 @@
#define ARCH_GET_GS 0x1004
#endif
#ifndef PTRACE_PEEKMTETAGS
-#define PTRACE_PEEKMTETAGS (PT_COMMAND_MAX+7)
+#define PTRACE_PEEKMTETAGS (PT_COMMAND_MAX + 7)
#endif
#ifndef PTRACE_POKEMTETAGS
-#define PTRACE_POKEMTETAGS (PT_COMMAND_MAX+8)
+#define PTRACE_POKEMTETAGS (PT_COMMAND_MAX + 8)
#endif
#ifndef PTRACE_GETVRREGS
-#define PTRACE_GETVRREGS (PT_COMMAND_MAX+9)
+#define PTRACE_GETVRREGS (PT_COMMAND_MAX + 9)
#endif
#ifndef PTRACE_GETVSRREGS
-#define PTRACE_GETVSRREGS (PT_COMMAND_MAX+10)
+#define PTRACE_GETVSRREGS (PT_COMMAND_MAX + 10)
#endif
#endif // liblldb_Host_aix_Ptrace_h_
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index 49be7bd88d..56b66830a3 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -402,7 +402,7 @@ public:
}
virtual bool SetLoadAddressByType(Target &target, lldb::addr_t value,
- bool value_is_offset, int type_id) {
+ bool value_is_offset, int type_id) {
return false;
}
diff --git a/lldb/include/lldb/Target/DynamicLoader.h b/lldb/include/lldb/Target/DynamicLoader.h
index 7dccd317c2..be41d440f1 100644
--- a/lldb/include/lldb/Target/DynamicLoader.h
+++ b/lldb/include/lldb/Target/DynamicLoader.h
@@ -360,10 +360,10 @@ protected:
bool base_addr_is_offset);
virtual void UpdateLoadedSectionsByType(lldb::ModuleSP module,
- lldb::addr_t link_map_addr,
- lldb::addr_t base_addr,
- bool base_addr_is_offset,
- int type_id);
+ lldb::addr_t link_map_addr,
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset,
+ int type_id);
// Utility method so base classes can share implementation of
// UpdateLoadedSections
diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index 7880db1592..4925093c1c 100644
--- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -28,8 +28,7 @@ public:
const EvaluateExpressionOptions &options);
ThreadPlanCallFunction(Thread &thread, const Address &function,
- const Address &toc,
- const CompilerType &return_type,
+ const Address &toc, const CompilerType &return_type,
llvm::ArrayRef<lldb::addr_t> args,
const EvaluateExpressionOptions &options);
diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp
index ea43a7f98b..bb3280968b 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -114,13 +114,13 @@ void DynamicLoader::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr,
}
void DynamicLoader::UpdateLoadedSectionsByType(lldb::ModuleSP module,
- lldb::addr_t link_map_addr,
- lldb::addr_t base_addr,
- bool base_addr_is_offset,
- int type_id) {
+ lldb::addr_t link_map_addr,
+ lldb::addr_t base_addr,
+ bool base_addr_is_offset,
+ int type_id) {
bool changed;
- module->SetLoadAddressByType(m_process->GetTarget(), base_addr, base_addr_is_offset,
- changed, type_id);
+ module->SetLoadAddressByType(m_process->GetTarget(), base_addr,
+ base_addr_is_offset, changed, type_id);
}
void DynamicLoader::UpdateLoadedSectionsCommon(ModuleSP module,
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index 43c5b043ef..4bd1c75a6b 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -167,7 +167,7 @@ static char *GetItaniumDemangledStr(const char *M) {
"Expected demangled_size to return length including trailing null");
}
-#if !defined(__AIX__)
+#if !defined(__AIX__)
if (Log *log = GetLog(LLDBLog::Demangle)) {
if (demangled_cstr)
LLDB_LOGF(log, "demangled itanium: %s -> \"%s\"", M, demangled_cstr);
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 326c4a3dbd..bd93d37047 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1512,10 +1512,12 @@ bool Module::SetLoadAddress(Target &target, lldb::addr_t value,
}
bool Module::SetLoadAddressByType(Target &target, lldb::addr_t value,
- bool value_is_offset, bool &changed, int type_id) {
+ bool value_is_offset, bool &changed,
+ int type_id) {
ObjectFile *object_file = GetObjectFile();
if (object_file != nullptr) {
- changed = object_file->SetLoadAddressByType(target, value, value_is_offset, type_id);
+ changed = object_file->SetLoadAddressByType(target, value, value_is_offset,
+ type_id);
return true;
} else {
changed = false;
diff --git a/lldb/source/Host/aix/Host.cpp b/lldb/source/Host/aix/Host.cpp
index d82cb9049d..cf1343bdfb 100644
--- a/lldb/source/Host/aix/Host.cpp
+++ b/lldb/source/Host/aix/Host.cpp
@@ -161,7 +161,7 @@ static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) {
if (len > 0) {
ExePath.resize(len);
- //FIXME: hack to get basename
+ // FIXME: hack to get basename
struct stat statData;
std::ostringstream oss;
@@ -170,12 +170,12 @@ static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) {
assert(stat(oss.str().c_str(), &statData) == 0);
const int fd = open(oss.str().c_str(), O_RDONLY);
- assert (fd >= 0);
+ assert(fd >= 0);
ssize_t readNum = read(fd, &psinfoData, sizeof(psinfoData));
- assert (readNum >= 0);
+ assert(readNum >= 0);
- close (fd);
+ close(fd);
} else {
LLDB_LOG(log, "failed to read link exe link for {0}: {1}", pid,
Status(errno, eErrorTypePOSIX));
@@ -187,7 +187,8 @@ static void GetExePathAndArch(::pid_t pid, ProcessInstanceInfo &process_info) {
if (!PathRef.empty()) {
process_info.GetExecutableFile().SetFile(PathRef, FileSpec::Style::native);
ArchSpec arch_spec = ArchSpec();
- arch_spec.SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE, llvm::Triple::AIX);
+ arch_spec.SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64,
+ LLDB_INVALID_CPUTYPE, llvm::Triple::AIX);
process_info.SetArchitecture(arch_spec);
}
}
diff --git a/lldb/source/Host/aix/HostInfoAIX.cpp b/lldb/source/Host/aix/HostInfoAIX.cpp
index 8bda09e017..646c26f517 100644
--- a/lldb/source/Host/aix/HostInfoAIX.cpp
+++ b/lldb/source/Host/aix/HostInfoAIX.cpp
@@ -197,7 +197,7 @@ bool HostInfoAIX::ComputeUserPluginsDirectory(FileSpec &file_spec) {
}
void HostInfoAIX::ComputeHostArchitectureSupport(ArchSpec &arch_32,
- ArchSpec &arch_64) {
+ ArchSpec &arch_64) {
HostInfoPosix::ComputeHostArchitectureSupport(arch_32, arch_64);
const char *distribution_id = GetDistributionId().data();
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 3ca7b8e0b3..6a1ebdedfd 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -363,47 +363,47 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) { return false; }
extern char **p_xargv;
/* Fix missing Dl_info & dladdr in AIX
- * The code is taken from netbsd.org (src/crypto/external/bsd/openssl/dist/crypto/dso/dso_dlfcn.c)
- * except strlcpy & strlcat (those are taken from openbsd.org (src/lib/libc/string))
+ * The code is taken from netbsd.org
+ * (src/crypto/external/bsd/openssl/dist/crypto/dso/dso_dlfcn.c) except strlcpy
+ * & strlcat (those are taken from openbsd.org (src/lib/libc/string))
*/
/*-
* See IBM's AIX Version 7.2, Technical Reference:
* Base Operating System and Extensions, Volume 1 and 2
* https://www.ibm.com/support/knowledgecenter/ssw_aix_72/com.ibm.aix.base/technicalreferences.htm
*/
-#include <sys/ldr.h>
#include <errno.h>
+#include <sys/ldr.h>
/* strlcpy:
* Copy string src to buffer dst of size dsize. At most dsize-1
* chars will be copied. Always NUL terminates (unless dsize == 0).
* Returns strlen(src); if retval >= dsize, truncation occurred.
*/
-size_t strlcpy(char *dst, const char *src, size_t dsize)
-{
- const char *osrc = src;
- size_t nleft = dsize;
-
- /* Copy as many bytes as will fit. */
- if (nleft != 0) {
- while (--nleft != 0) {
- if ((*dst++ = *src++) == '\0') {
- break;
- }
- }
+size_t strlcpy(char *dst, const char *src, size_t dsize) {
+ const char *osrc = src;
+ size_t nleft = dsize;
+
+ /* Copy as many bytes as will fit. */
+ if (nleft != 0) {
+ while (--nleft != 0) {
+ if ((*dst++ = *src++) == '\0') {
+ break;
+ }
}
+ }
- /* Not enough room in dst, add NUL and traverse rest of src. */
- if (nleft == 0) {
- if (dsize != 0) {
- *dst = '\0'; /* NUL-terminate dst */
- }
- while (*src++) {
- ;
- }
+ /* Not enough room in dst, add NUL and traverse rest of src. */
+ if (nleft == 0) {
+ if (dsize != 0) {
+ *dst = '\0'; /* NUL-terminate dst */
}
+ while (*src++) {
+ ;
+ }
+ }
- return src - osrc - 1; /* count does not include NUL */
+ return src - osrc - 1; /* count does not include NUL */
}
/* strlcat:
@@ -413,110 +413,108 @@ size_t strlcpy(char *dst, const char *src, size_t dsize)
* Returns strlen(src) + MIN(dsize, strlen(initial dst)).
* If retval >= dsize, truncation occurred.
*/
-size_t strlcat(char *dst, const char *src, size_t dsize)
-{
- const char *odst = dst;
- const char *osrc = src;
- size_t n = dsize;
- size_t dlen;
-
- /* Find the end of dst and adjust bytes left but don't go past end. */
- while (n-- != 0 && *dst != '\0') {
- dst++;
- }
- dlen = dst - odst;
- n = dsize - dlen;
+size_t strlcat(char *dst, const char *src, size_t dsize) {
+ const char *odst = dst;
+ const char *osrc = src;
+ size_t n = dsize;
+ size_t dlen;
+
+ /* Find the end of dst and adjust bytes left but don't go past end. */
+ while (n-- != 0 && *dst != '\0') {
+ dst++;
+ }
+ dlen = dst - odst;
+ n = dsize - dlen;
- if (n-- == 0) {
- return dlen + strlen(src);
- }
- while (*src != '\0') {
- if (n != 0) {
- *dst++ = *src;
- n--;
- }
- src++;
+ if (n-- == 0) {
+ return dlen + strlen(src);
+ }
+ while (*src != '\0') {
+ if (n != 0) {
+ *dst++ = *src;
+ n--;
}
- *dst = '\0';
+ src++;
+ }
+ *dst = '\0';
- return dlen + src - osrc; /* count does not include NUL */
+ return dlen + src - osrc; /* count does not include NUL */
}
/* ~ 64 * (sizeof(struct ld_info) + _XOPEN_PATH_MAX + _XOPEN_NAME_MAX) */
-# define DLFCN_LDINFO_SIZE 86976
+#define DLFCN_LDINFO_SIZE 86976
typedef struct Dl_info {
- const char *dli_fname;
+ const char *dli_fname;
} Dl_info;
/*
* This dladdr()-implementation will also find the ptrgl (Pointer Glue) virtual
* address of a function, which is just located in the DATA segment instead of
* the TEXT segment.
*/
-static int dladdr(const void *ptr, Dl_info *dl)
-{
- uintptr_t addr = (uintptr_t)ptr;
- struct ld_info *ldinfos;
- struct ld_info *next_ldi;
- struct ld_info *this_ldi;
-
- if ((ldinfos = (struct ld_info *)malloc(DLFCN_LDINFO_SIZE)) == NULL) {
- dl->dli_fname = NULL;
- return 0;
- }
+static int dladdr(const void *ptr, Dl_info *dl) {
+ uintptr_t addr = (uintptr_t)ptr;
+ struct ld_info *ldinfos;
+ struct ld_info *next_ldi;
+ struct ld_info *this_ldi;
+
+ if ((ldinfos = (struct ld_info *)malloc(DLFCN_LDINFO_SIZE)) == NULL) {
+ dl->dli_fname = NULL;
+ return 0;
+ }
- if ((loadquery(L_GETINFO, (void *)ldinfos, DLFCN_LDINFO_SIZE)) < 0) {
- /*-
- * Error handling is done through errno and dlerror() reading errno:
- * ENOMEM (ldinfos buffer is too small),
- * EINVAL (invalid flags),
- * EFAULT (invalid ldinfos ptr)
- */
- free((void *)ldinfos);
- dl->dli_fname = NULL;
- return 0;
- }
- next_ldi = ldinfos;
-
- do {
- this_ldi = next_ldi;
- if (((addr >= (uintptr_t)this_ldi->ldinfo_textorg)
- && (addr < ((uintptr_t)this_ldi->ldinfo_textorg +
- this_ldi->ldinfo_textsize)))
- || ((addr >= (uintptr_t)this_ldi->ldinfo_dataorg)
- && (addr < ((uintptr_t)this_ldi->ldinfo_dataorg +
- this_ldi->ldinfo_datasize)))) {
- char *buffer = NULL;
- char *member = NULL;
- size_t buffer_sz;
- size_t member_len;
-
- buffer_sz = strlen(this_ldi->ldinfo_filename) + 1;
- member = this_ldi->ldinfo_filename + buffer_sz;
- if ((member_len = strlen(member)) > 0) {
- buffer_sz += 1 + member_len + 1;
- }
- if ((buffer = (char *)malloc(buffer_sz)) != NULL) {
- strlcpy(buffer, this_ldi->ldinfo_filename, buffer_sz);
- if (member_len > 0) {
- /*
- * Need to respect a possible member name and not just
- * returning the path name in this case. See docs:
- * sys/ldr.h, loadquery() and dlopen()/RTLD_MEMBER.
- */
- strlcat(buffer, "(", buffer_sz);
- strlcat(buffer, member, buffer_sz);
- strlcat(buffer, ")", buffer_sz);
- }
- dl->dli_fname = buffer;
- }
- break;
- } else {
- next_ldi = (struct ld_info *)((uintptr_t)this_ldi +
- this_ldi->ldinfo_next);
- }
- } while (this_ldi->ldinfo_next);
+ if ((loadquery(L_GETINFO, (void *)ldinfos, DLFCN_LDINFO_SIZE)) < 0) {
+ /*-
+ * Error handling is done through errno and dlerror() reading errno:
+ * ENOMEM (ldinfos buffer is too small),
+ * EINVAL (invalid flags),
+ * EFAULT (invalid ldinfos ptr)
+ */
free((void *)ldinfos);
- return dl->dli_fname != NULL;
+ dl->dli_fname = NULL;
+ return 0;
+ }
+ next_ldi = ldinfos;
+
+ do {
+ this_ldi = next_ldi;
+ if (((addr >= (uintptr_t)this_ldi->ldinfo_textorg) &&
+ (addr <
+ ((uintptr_t)this_ldi->ldinfo_textorg + this_ldi->ldinfo_textsize))) ||
+ ((addr >= (uintptr_t)this_ldi->ldinfo_dataorg) &&
+ (addr <
+ ((uintptr_t)this_ldi->ldinfo_dataorg + this_ldi->ldinfo_datasize)))) {
+ char *buffer = NULL;
+ char *member = NULL;
+ size_t buffer_sz;
+ size_t member_len;
+
+ buffer_sz = strlen(this_ldi->ldinfo_filename) + 1;
+ member = this_ldi->ldinfo_filename + buffer_sz;
+ if ((member_len = strlen(member)) > 0) {
+ buffer_sz += 1 + member_len + 1;
+ }
+ if ((buffer = (char *)malloc(buffer_sz)) != NULL) {
+ strlcpy(buffer, this_ldi->ldinfo_filename, buffer_sz);
+ if (member_len > 0) {
+ /*
+ * Need to respect a possible member name and not just
+ * returning the path name in this case. See docs:
+ * sys/ldr.h, loadquery() and dlopen()/RTLD_MEMBER.
+ */
+ strlcat(buffer, "(", buffer_sz);
+ strlcat(buffer, member, buffer_sz);
+ strlcat(buffer, ")", buffer_sz);
+ }
+ dl->dli_fname = buffer;
+ }
+ break;
+ } else {
+ next_ldi =
+ (struct ld_info *)((uintptr_t)this_ldi + this_ldi->ldinfo_next);
+ }
+ } while (this_ldi->ldinfo_next);
+ free((void *)ldinfos);
+ return dl->dli_fname != NULL;
}
#endif
@@ -525,7 +523,8 @@ FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) {
FileSpec module_filespec;
#if !defined(__ANDROID__)
#ifdef __AIX__
- if (host_addr == reinterpret_cast<void *>(HostInfoBase::ComputeSharedLibraryDirectory)) {
+ if (host_addr ==
+ reinterpret_cast<void *>(HostInfoBase::ComputeSharedLibraryDirectory)) {
// FIXME: AIX dladdr return "lldb" for this case
if (p_xargv[0]) {
module_filespec.SetFile(p_xargv[0], FileSpec::Style::native);
diff --git a/lldb/source/Host/posix/MainLoopPosix.cpp b/lldb/source/Host/posix/MainLoopPosix.cpp
index d1eba52791..4235af23f8 100644
--- a/lldb/source/Host/posix/MainLoopPosix.cpp
+++ b/lldb/source/Host/posix/MainLoopPosix.cpp
@@ -326,7 +326,7 @@ MainLoopPosix::RegisterSignal(int signo, const Callback &callback,
// receive it. If using pselect/ppoll, we need to block it, and later unblock
// it as a part of the system call.
#if defined(__AIX__)
- //FIXME: where is signal unblocked?
+ // FIXME: where is signal unblocked?
ret = pthread_sigmask(SIG_UNBLOCK, &new_action.sa_mask, &old_set);
#else
ret = pthread_sigmask(HAVE_SYS_EVENT_H ? SIG_UNBLOCK : SIG_BLOCK,
diff --git a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
index d752a8ded9..714f87abeb 100644
--- a/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
+++ b/lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
@@ -24,8 +24,7 @@ public:
llvm::ArrayRef<lldb::addr_t> args) const override;
bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,
- lldb::addr_t functionAddress,
- lldb::addr_t tocAddress,
+ lldb::addr_t functionAddress, lldb::addr_t tocAddress,
lldb::addr_t returnAddress,
llvm::ArrayRef<lldb::addr_t> args) const override;
diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
index 6266397413..254a9601b5 100644
--- a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp
@@ -23,7 +23,7 @@
#endif
/*#include "llvm/ADT/Triple.h"
-*/
+ */
using namespace lldb;
using namespace lldb_private;
@@ -48,7 +48,7 @@ llvm::StringRef DynamicLoaderAIXDYLD::GetPluginDescriptionStatic() {
}
DynamicLoader *DynamicLoaderAIXDYLD::CreateInstance(Process *process,
- bool force) {
+ bool force) {
bool should_create = force;
if (!should_create) {
const llvm::Triple &triple_ref =
@@ -64,14 +64,14 @@ DynamicLoader *DynamicLoaderAIXDYLD::CreateInstance(Process *process,
}
void DynamicLoaderAIXDYLD::OnLoadModule(lldb::ModuleSP module_sp,
- const ModuleSpec module_spec,
- lldb::addr_t module_addr) {
+ const ModuleSpec module_spec,
+ lldb::addr_t module_addr) {
// Resolve the module unless we already have one.
if (!module_sp) {
Status error;
- module_sp = m_process->GetTarget().GetOrCreateModule(module_spec,
- true /* notify */, &error);
+ module_sp = m_process->GetTarget().GetOrCreateModule(
+ module_spec, true /* notify */, &error);
if (error.Fail())
return;
}
@@ -119,17 +119,17 @@ lldb::addr_t DynamicLoaderAIXDYLD::GetLoadAddress(ModuleSP executable) {
}
//// Hack to try set breakpoint
- //Breakpoint *dyld_break = m_process->GetTarget().CreateBreakpoint(0x100000638, true, false).get();
- //dyld_break->SetCallback(DynamicLoaderAIXDYLD::NotifyBreakpointHit, this, true);
- //dyld_break->SetBreakpointKind("hack-debug");
+ // Breakpoint *dyld_break =
+ // m_process->GetTarget().CreateBreakpoint(0x100000638, true, false).get();
+ // dyld_break->SetCallback(DynamicLoaderAIXDYLD::NotifyBreakpointHit, this,
+ // true); dyld_break->SetBreakpointKind("hack-debug");
return LLDB_INVALID_ADDRESS;
}
bool DynamicLoaderAIXDYLD::NotifyBreakpointHit(
void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
- lldb::user_id_t break_loc_id) {
-}
+ lldb::user_id_t break_loc_id) {}
void DynamicLoaderAIXDYLD::DidAttach() {
Log *log = GetLog(LLDBLog::DynamicLoader);
@@ -184,9 +184,12 @@ void DynamicLoaderAIXDYLD::DidAttach() {
}
FileSpec file(pathWithMember);
ModuleSpec module_spec(file, m_process->GetTarget().GetArchitecture());
- if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, true /* notify */)) {
- UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
- UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
+ if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(
+ module_spec, true /* notify */)) {
+ UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+ (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
+ UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+ (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
// FIXME: .tdata, .bss
}
} else {
@@ -245,9 +248,12 @@ void DynamicLoaderAIXDYLD::DidLaunch() {
}
FileSpec file(pathWithMember);
ModuleSpec module_spec(file, m_process->GetTarget().GetArchitecture());
- if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(module_spec, true /* notify */)) {
- UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
- UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS, (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
+ if (ModuleSP module_sp = m_process->GetTarget().GetOrCreateModule(
+ module_spec, true /* notify */)) {
+ UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+ (lldb::addr_t)ptr->ldinfo_textorg, false, 1);
+ UpdateLoadedSectionsByType(module_sp, LLDB_INVALID_ADDRESS,
+ (lldb::addr_t)ptr->ldinfo_dataorg, false, 2);
// FIXME: .tdata, .bss
}
} else {
@@ -264,9 +270,8 @@ void DynamicLoaderAIXDYLD::DidLaunch() {
Status DynamicLoaderAIXDYLD::CanLoadImage() { return Status(); }
-ThreadPlanSP
-DynamicLoaderAIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
- bool stop) {
- //FIXME
+ThreadPlanSP DynamicLoaderAIXDYLD::GetStepThroughTrampolinePlan(Thread &thread,
+ bool stop) {
+ // FIXME
return ThreadPlanSP();
}
diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
index ae4b7aca66..c3a3006ef0 100644
--- a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
+++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h
@@ -41,7 +41,10 @@ public:
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
- static bool NotifyBreakpointHit(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
+ static bool NotifyBreakpointHit(void *baton,
+ StoppointCallbackContext *context,
+ lldb::user_id_t break_id,
+ lldb::user_id_t break_loc_id);
protected:
lldb::addr_t GetLoadAddress(lldb::ModuleSP executable);
diff --git a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
index d14ae2daeb..c491d00671 100644
--- a/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
+++ b/lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
@@ -147,10 +147,9 @@ EmulateInstructionPPC64::GetOpcodeForInstruction(uint32_t opcode) {
"addi RT, RA, SI"},
{0xfc000003, 0xe8000000, &EmulateInstructionPPC64::EmulateLD,
"ld RT, DS(RA)"},
-// {0xffff0003, 0x40820000, &EmulateInstructionPPC64::EmulateBNE,
-// "bne TARGET"},
- {0xfc000002, 0x48000000, &EmulateInstructionPPC64::EmulateB,
- "b TARGET"},
+ // {0xffff0003, 0x40820000, &EmulateInstructionPPC64::EmulateBNE,
+ // "bne TARGET"},
+ {0xfc000002, 0x48000000, &EmulateInstructionPPC64::EmulateB, "b TARGET"},
{0xfc000003, 0x48000002, &EmulateInstructionPPC64::EmulateBA,
"ba TARGET"},
{0xfc000003, 0x48000003, &EmulateInstructionPPC64::EmulateBLA,
@@ -412,7 +411,8 @@ bool EmulateInstructionPPC64::EmulateADDI(uint32_t opcode) {
LLDB_LOG(log, "EmulateADDI: success!");
// FIX the next-pc
- uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+ uint64_t pc_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
uint64_t next_pc = pc_value + 4;
ctx.type = eContextAdjustPC;
WriteRegisterUnsigned(ctx, eRegisterKindLLDB, gpr_pc_ppc64le, next_pc);
@@ -424,18 +424,25 @@ bool EmulateInstructionPPC64::EmulateBC(uint32_t opcode) {
// FIXME:32bit M
uint32_t M = 0;
uint32_t target32 = Bits32(opcode, 15, 2) << 2;
- uint64_t target = (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
+ uint64_t target =
+ (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
uint32_t BO = Bits32(opcode, 25, 21);
bool success;
- uint64_t ctr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+ uint64_t ctr_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
if ((~BO) & (1U << 2))
ctr_value = ctr_value - 1;
- bool ctr_ok = (bool)(BO & (1U << 2)) | ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
- uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+ bool ctr_ok = (bool)(BO & (1U << 2)) |
+ ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
+ uint64_t cr_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
uint32_t BI = Bits32(opcode, 20, 16);
- bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+ bool cond_ok =
+ (bool)(BO & (1U << 4)) |
+ (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
- uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+ uint64_t pc_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
uint64_t next_pc = pc_value + 4;
if (ctr_ok & cond_ok)
next_pc = pc_value + target;
@@ -452,18 +459,25 @@ bool EmulateInstructionPPC64::EmulateBCA(uint32_t opcode) {
// FIXME:32bit M
uint32_t M = 0;
uint32_t target32 = Bits32(opcode, 15, 2) << 2;
- uint64_t target = (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
+ uint64_t target =
+ (uint64_t)target32 + ((target32 & 0x8000) ? 0xffffffffffff0000UL : 0);
uint32_t BO = Bits32(opcode, 25, 21);
bool success;
- uint64_t ctr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+ uint64_t ctr_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
if ((~BO) & (1U << 2))
ctr_value = ctr_value - 1;
- bool ctr_ok = (bool)(BO & (1U << 2)) | ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
- uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+ bool ctr_ok = (bool)(BO & (1U << 2)) |
+ ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
+ uint64_t cr_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
uint32_t BI = Bits32(opcode, 20, 16);
- bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+ bool cond_ok =
+ (bool)(BO & (1U << 4)) |
+ (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
- uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+ uint64_t pc_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
uint64_t next_pc = pc_value + 4;
if (ctr_ok & cond_ok)
next_pc = target;
@@ -481,18 +495,25 @@ bool EmulateInstructionPPC64::EmulateBCLR(uint32_t opcode) {
uint32_t M = 0;
uint32_t BO = Bits32(opcode, 25, 21);
bool success;
- uint64_t ctr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+ uint64_t ctr_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
if ((~BO) & (1U << 2))
ctr_value = ctr_value - 1;
- bool ctr_ok = (bool)(BO & (1U << 2)) | ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
- uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+ bool ctr_ok = (bool)(BO & (1U << 2)) |
+ ((bool)(ctr_value != 0) ^ (bool)(BO & (1U << 1)));
+ uint64_t cr_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
uint32_t BI = Bits32(opcode, 20, 16);
- bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+ bool cond_ok =
+ (bool)(BO & (1U << 4)) |
+ (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
- uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+ uint64_t pc_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
uint64_t next_pc = pc_value + 4;
if (ctr_ok & cond_ok) {
- next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
+ next_pc =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
next_pc &= ~((1UL << 2) - 1);
}
@@ -509,19 +530,27 @@ bool EmulateInstructionPPC64::EmulateBCCTR(uint32_t opcode) {
uint32_t M = 0;
uint32_t BO = Bits32(opcode, 25, 21);
bool success;
- uint64_t cr_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
+ uint64_t cr_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_cr_ppc64le, 0, &success);
uint32_t BI = Bits32(opcode, 20, 16);
- bool cond_ok = (bool)(BO & (1U << 4)) | (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
+ bool cond_ok =
+ (bool)(BO & (1U << 4)) |
+ (bool)(((cr_value >> (63 - (BI + 32))) & 1U) == ((BO >> 3) & 1U));
Log *log = GetLog(LLDBLog::Unwind);
- uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+ uint64_t pc_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
uint64_t next_pc = pc_value + 4;
if (cond_ok) {
- next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
+ next_pc =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_ctr_ppc64le, 0, &success);
next_pc &= ~((1UL << 2) - 1);
if (next_pc < 0x4000000) {
- LLDB_LOGF(log, "EmulateBCCTR: next address %lx out of range, emulate by goto LR!");
- next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
+ LLDB_LOGF(
+ log,
+ "EmulateBCCTR: next address %lx out of range, emulate by goto LR!");
+ next_pc =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
}
}
@@ -541,10 +570,12 @@ bool EmulateInstructionPPC64::EmulateBCTAR(uint32_t opcode) {
bool EmulateInstructionPPC64::EmulateB(uint32_t opcode) {
uint32_t target32 = Bits32(opcode, 25, 2) << 2;
- uint64_t target = (uint64_t)target32 + ((target32 & 0x2000000) ? 0xfffffffffc000000UL : 0);
+ uint64_t target =
+ (uint64_t)target32 + ((target32 & 0x2000000) ? 0xfffffffffc000000UL : 0);
bool success;
- uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+ uint64_t pc_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
uint64_t next_pc = pc_value + target;
Context ctx;
@@ -559,7 +590,8 @@ bool EmulateInstructionPPC64::EmulateBA(uint32_t opcode) {
Log *log = GetLog(LLDBLog::Unwind);
bool success;
- uint64_t next_pc = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
+ uint64_t next_pc =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_lr_ppc64le, 0, &success);
Context ctx;
ctx.type = eContextAdjustPC;
@@ -572,7 +604,8 @@ bool EmulateInstructionPPC64::EmulateBLA(uint32_t opcode) {
Log *log = GetLog(LLDBLog::Unwind);
bool success;
- uint64_t pc_value = ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
+ uint64_t pc_value =
+ ReadRegisterUnsigned(eRegisterKindLLDB, gpr_pc_ppc64le, 0, &success);
uint64_t next_pc = pc_value + 4;
Context ctx;
diff --git a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
index 050ad73f1d..07bf50a619 100644
--- a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
@@ -35,9 +35,9 @@ typedef struct ar_hdr {
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
-#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Object/Archive.h"
#include "llvm/Support/Chrono.h"
+#include "llvm/Support/MemoryBuffer.h"
using namespace lldb;
using namespace lldb_private;
@@ -148,11 +148,15 @@ size_t ObjectContainerBigArchive::Archive::ParseObjects() {
DataExtractor &data = m_data;
std::string str;
lldb::offset_t offset = 0;
- str.assign((const char *)data.GetData(&offset, (sizeof(llvm::object::BigArchiveMagic) - 1)),
+ str.assign((const char *)data.GetData(
+ &offset, (sizeof(llvm::object::BigArchiveMagic) - 1)),
(sizeof(llvm::object::BigArchiveMagic) - 1));
if (str == llvm::object::BigArchiveMagic) {
llvm::Error err = llvm::Error::success();
- llvm::object::BigArchive bigAr(llvm::MemoryBufferRef(toStringRef(m_data.GetData()), llvm::StringRef("")), err);
+ llvm::object::BigArchive bigAr(
+ llvm::MemoryBufferRef(toStringRef(m_data.GetData()),
+ llvm::StringRef("")),
+ err);
if (err)
return 0;
@@ -168,10 +172,12 @@ size_t ObjectContainerBigArchive::Archive::ParseObjects() {
if (!childNameOrErr)
continue;
obj.ar_name.SetCString(childNameOrErr->str().c_str());
- llvm::Expected<llvm::sys::TimePoint<std::chrono::seconds>> lastModifiedOrErr = child.getLastModified();
+ llvm::Expected<llvm::sys::TimePoint<std::chrono::seconds>>
+ lastModifiedOrErr = child.getLastModified();
if (!lastModifiedOrErr)
continue;
- obj.modification_time = (uint32_t)llvm::sys::toTimeT(*(lastModifiedOrErr));
+ obj.modification_time =
+ (uint32_t)llvm::sys::toTimeT(*(lastModifiedOrErr));
llvm::Expected<unsigned> getUIDOrErr = child.getUID();
if (!getUIDOrErr)
continue;
@@ -180,7 +186,8 @@ size_t ObjectContainerBigArchive::Archive::ParseObjects() {
if (!getGIDOrErr)
continue;
obj.gid = (uint16_t)*getGIDOrErr;
- llvm::Expected<llvm::sys::fs::perms> getAccessModeOrErr = child.getAccessMode();
+ llvm::Expected<llvm::sys::fs::perms> getAccessModeOrErr =
+ child.getAccessMode();
if (!getAccessModeOrErr)
continue;
obj.mode = (uint16_t)*getAccessModeOrErr;
@@ -388,8 +395,10 @@ ObjectContainer *ObjectContainerBigArchive::CreateInstance(
bool ObjectContainerBigArchive::MagicBytesMatch(const DataExtractor &data) {
uint32_t offset = 0;
- const char *armag = (const char *)data.PeekData(offset, (sizeof(llvm::object::BigArchiveMagic) - 1));
- if (armag && ::strncmp(armag, llvm::object::BigArchiveMagic, (sizeof(llvm::object::BigArchiveMagic) - 1)) == 0)
+ const char *armag = (const char *)data.PeekData(
+ offset, (sizeof(llvm::object::BigArchiveMagic) - 1));
+ if (armag && ::strncmp(armag, llvm::object::BigArchiveMagic,
+ (sizeof(llvm::object::BigArchiveMagic) - 1)) == 0)
return true;
return false;
}
@@ -464,7 +473,8 @@ size_t ObjectContainerBigArchive::GetModuleSpecifications(
return 0;
const size_t initial_count = specs.GetSize();
- llvm::sys::TimePoint<> file_mod_time = FileSystem::Instance().GetModificationTime(file);
+ llvm::sys::TimePoint<> file_mod_time =
+ FileSystem::Instance().GetModificationTime(file);
Archive::shared_ptr archive_sp(
Archive::FindCachedArchive(file, ArchSpec(), file_mod_time, file_offset));
bool set_archive_arch = false;
diff --git a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
index ad9b814048..b89472babf 100644
--- a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
+++ b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
@@ -101,8 +101,8 @@ protected:
/// Length of the object data.
lldb::offset_t file_size = 0;
-
- void Dump(lldb_private::Stream *s) const;
+
+ void Dump(lldb_private::Stream *s) const;
};
class Archive {
@@ -165,8 +165,8 @@ protected:
std::vector<Object> m_objects;
ObjectNameToIndexMap m_object_name_to_index_map;
lldb_private::DataExtractor m_data; ///< The data for this object container
- ///so we don't lose data if the .a files
- ///gets modified
+ /// so we don't lose data if the .a
+ /// files gets modified
};
void SetArchive(Archive::shared_ptr &archive_sp);
diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
index 75cc54e4f0..c9aec799aa 100644
--- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
+++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
@@ -116,7 +116,7 @@ size_t ObjectFilePDB::GetModuleSpecifications(
ModuleSpec module_spec(file);
llvm::BumpPtrAllocator allocator;
std::unique_ptr<PDBFile> pdb_file = loadPDBFile(file.GetPath(), allocator);
- if (!pdb_file){
+ if (!pdb_file) {
#if !defined(__AIX__)
return initial_count;
#else
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index b67c036b87..70339704af 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -252,7 +252,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
@@ -279,7 +279,7 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
}
auto *COFFObj = llvm::dyn_cast<llvm::object::COFFObjectFile>(binary->get());
- if (!COFFObj){
+ if (!COFFObj) {
#if !defined(__AIX__)
return initial_count;
#else
diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
index a4d9ea295b..c6e7299420 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.cpp
@@ -1,4 +1,5 @@
-//===-- ObjectFileXCOFF.cpp -------------------------------------------------===//
+//===-- ObjectFileXCOFF.cpp
+//-------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,10 +11,9 @@
#include <algorithm>
#include <cassert>
-#include <unordered_map>
#include <string.h>
+#include <unordered_map>
-#include "lldb/Utility/FileSpecList.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
@@ -23,11 +23,12 @@
#include "lldb/Host/LZMA.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/FileSpecList.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RangeMap.h"
@@ -39,11 +40,11 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/Object/Decompressor.h"
+#include "llvm/Object/XCOFFObjectFile.h"
#include "llvm/Support/CRC.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Object/XCOFFObjectFile.h"
using namespace llvm;
using namespace lldb;
@@ -69,11 +70,11 @@ void ObjectFileXCOFF::Terminate() {
bool UGLY_FLAG_FOR_AIX __attribute__((weak)) = false;
ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp,
- DataBufferSP data_sp,
- lldb::offset_t data_offset,
- const lldb_private::FileSpec *file,
- lldb::offset_t file_offset,
- lldb::offset_t length) {
+ DataBufferSP data_sp,
+ lldb::offset_t data_offset,
+ const lldb_private::FileSpec *file,
+ lldb::offset_t file_offset,
+ lldb::offset_t length) {
if (!data_sp) {
data_sp = MapFileData(*file, length, file_offset);
if (!data_sp)
@@ -101,7 +102,7 @@ ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp,
return nullptr;
if (!objfile_up->ParseHeader())
- //FIXME objfile leak
+ // FIXME objfile leak
return nullptr;
UGLY_FLAG_FOR_AIX = true;
@@ -114,9 +115,10 @@ bool ObjectFileXCOFF::CreateBinary() {
Log *log = GetLog(LLDBLog::Object);
- auto binary = llvm::object::XCOFFObjectFile::createObjectFile(llvm::MemoryBufferRef(
- toStringRef(m_data.GetData()), m_file.GetFilename().GetStringRef()),
- file_magic::xcoff_object_64);
+ auto binary = llvm::object::XCOFFObjectFile::createObjectFile(
+ llvm::MemoryBufferRef(toStringRef(m_data.GetData()),
+ m_file.GetFilename().GetStringRef()),
+ file_magic::xcoff_object_64);
if (!binary) {
LLDB_LOG_ERROR(log, binary.takeError(),
"Failed to create binary for file ({1}): {0}", m_file);
@@ -148,9 +150,12 @@ size_t ObjectFileXCOFF::GetModuleSpecifications(
const size_t initial_count = specs.GetSize();
if (ObjectFileXCOFF::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize())) {
- ArchSpec arch_spec = ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
+ ArchSpec arch_spec =
+ ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
ModuleSpec spec(file, arch_spec);
- spec.GetArchitecture().SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE, llvm::Triple::AIX);
+ spec.GetArchitecture().SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64,
+ LLDB_INVALID_CPUTYPE,
+ llvm::Triple::AIX);
specs.Append(spec);
}
return specs.GetSize() - initial_count;
@@ -158,10 +163,10 @@ size_t ObjectFileXCOFF::GetModuleSpecifications(
static uint32_t XCOFFHeaderSizeFromMagic(uint32_t magic) {
switch (magic) {
- /* TODO: 32bit not supported yet
- case XCOFF::XCOFF32:
- return sizeof(struct llvm::object::XCOFFFileHeader32);
- */
+ /* TODO: 32bit not supported yet
+ case XCOFF::XCOFF32:
+ return sizeof(struct llvm::object::XCOFFFileHeader32);
+ */
case XCOFF::XCOFF64:
return sizeof(struct llvm::object::XCOFFFileHeader64);
@@ -174,9 +179,9 @@ static uint32_t XCOFFHeaderSizeFromMagic(uint32_t magic) {
}
bool ObjectFileXCOFF::MagicBytesMatch(DataBufferSP &data_sp,
- lldb::addr_t data_offset,
- lldb::addr_t data_length) {
- lldb_private::DataExtractor data;
+ lldb::addr_t data_offset,
+ lldb::addr_t data_length) {
+ lldb_private::DataExtractor data;
data.SetData(data_sp, data_offset, data_length);
lldb::offset_t offset = 0;
uint16_t magic = data.GetU16(&offset);
@@ -205,7 +210,7 @@ bool ObjectFileXCOFF::ParseHeader() {
bool ObjectFileXCOFF::ParseXCOFFHeader(lldb_private::DataExtractor &data,
lldb::offset_t *offset_ptr,
xcoff_header_t &xcoff_header) {
- //FIXME: data.ValidOffsetForDataOfSize
+ // FIXME: data.ValidOffsetForDataOfSize
xcoff_header.magic = data.GetU16(offset_ptr);
xcoff_header.nsects = data.GetU16(offset_ptr);
xcoff_header.modtime = data.GetU32(offset_ptr);
@@ -216,10 +221,10 @@ bool ObjectFileXCOFF::ParseXCOFFHeader(lldb_private::DataExtractor &data,
return true;
}
-bool ObjectFileXCOFF::ParseXCOFFOptionalHeader(lldb_private::DataExtractor &data,
- lldb::offset_t *offset_ptr) {
+bool ObjectFileXCOFF::ParseXCOFFOptionalHeader(
+ lldb_private::DataExtractor &data, lldb::offset_t *offset_ptr) {
lldb::offset_t init_offset = *offset_ptr;
- //FIXME: data.ValidOffsetForDataOfSize
+ // FIXME: data.ValidOffsetForDataOfSize
m_xcoff_aux_header.AuxMagic = data.GetU16(offset_ptr);
m_xcoff_aux_header.Version = data.GetU16(offset_ptr);
m_xcoff_aux_header.ReservedForDebugger = data.GetU32(offset_ptr);
@@ -256,18 +261,18 @@ bool ObjectFileXCOFF::ParseXCOFFOptionalHeader(lldb_private::DataExtractor &data
return true;
}
-bool ObjectFileXCOFF::ParseSectionHeaders(
- uint32_t section_header_data_offset) {
+bool ObjectFileXCOFF::ParseSectionHeaders(uint32_t section_header_data_offset) {
const uint32_t nsects = m_xcoff_header.nsects;
m_sect_headers.clear();
if (nsects > 0) {
- const size_t section_header_byte_size = nsects * m_binary->getSectionHeaderSize();
+ const size_t section_header_byte_size =
+ nsects * m_binary->getSectionHeaderSize();
lldb_private::DataExtractor section_header_data =
ReadImageData(section_header_data_offset, section_header_byte_size);
lldb::offset_t offset = 0;
- //FIXME: section_header_data.ValidOffsetForDataOfSize
+ // FIXME: section_header_data.ValidOffsetForDataOfSize
m_sect_headers.resize(nsects);
for (uint32_t idx = 0; idx < nsects; ++idx) {
@@ -293,7 +298,8 @@ bool ObjectFileXCOFF::ParseSectionHeaders(
return !m_sect_headers.empty();
}
-lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset, size_t size) {
+lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset,
+ size_t size) {
if (!size)
return {};
@@ -306,9 +312,8 @@ lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset, size
if (process_sp) {
auto data_up = std::make_unique<DataBufferHeap>(size, 0);
Status readmem_error;
- size_t bytes_read =
- process_sp->ReadMemory(offset, data_up->GetBytes(),
- data_up->GetByteSize(), readmem_error);
+ size_t bytes_read = process_sp->ReadMemory(
+ offset, data_up->GetBytes(), data_up->GetByteSize(), readmem_error);
if (bytes_read == size) {
DataBufferSP buffer_sp(data_up.release());
data.SetData(buffer_sp, 0, buffer_sp->GetByteSize());
@@ -318,7 +323,7 @@ lldb_private::DataExtractor ObjectFileXCOFF::ReadImageData(uint32_t offset, size
}
bool ObjectFileXCOFF::SetLoadAddress(Target &target, lldb::addr_t value,
- bool value_is_offset) {
+ bool value_is_offset) {
bool changed = false;
ModuleSP module_sp = GetModule();
if (module_sp) {
@@ -340,8 +345,9 @@ bool ObjectFileXCOFF::SetLoadAddress(Target &target, lldb::addr_t value,
use_offset = true;
if (target.GetSectionLoadList().SetSectionLoadAddress(
- section_sp, (use_offset ?
- (section_sp->GetFileOffset() + value) : (section_sp->GetFileAddress() + value))))
+ section_sp,
+ (use_offset ? (section_sp->GetFileOffset() + value)
+ : (section_sp->GetFileAddress() + value))))
++num_loaded_sections;
}
}
@@ -352,7 +358,7 @@ bool ObjectFileXCOFF::SetLoadAddress(Target &target, lldb::addr_t value,
}
bool ObjectFileXCOFF::SetLoadAddressByType(Target &target, lldb::addr_t value,
- bool value_is_offset, int type_id) {
+ bool value_is_offset, int type_id) {
bool changed = false;
ModuleSP module_sp = GetModule();
if (module_sp) {
@@ -366,13 +372,15 @@ bool ObjectFileXCOFF::SetLoadAddressByType(Target &target, lldb::addr_t value,
// Iterate through the object file sections to find all of the sections
// that have SHF_ALLOC in their flag bits.
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
- if (type_id == 1 && section_sp && strcmp(section_sp->GetName().AsCString(), ".text") == 0) {
+ if (type_id == 1 && section_sp &&
+ strcmp(section_sp->GetName().AsCString(), ".text") == 0) {
if (!section_sp->IsThreadSpecific()) {
if (target.GetSectionLoadList().SetSectionLoadAddress(
section_sp, section_sp->GetFileOffset() + value))
++num_loaded_sections;
}
- } else if (type_id == 2 && section_sp && strcmp(section_sp->GetName().AsCString(), ".data") == 0) {
+ } else if (type_id == 2 && section_sp &&
+ strcmp(section_sp->GetName().AsCString(), ".data") == 0) {
if (!section_sp->IsThreadSpecific()) {
if (target.GetSectionLoadList().SetSectionLoadAddress(
section_sp, section_sp->GetFileAddress() + value))
@@ -386,13 +394,9 @@ bool ObjectFileXCOFF::SetLoadAddressByType(Target &target, lldb::addr_t value,
return changed;
}
-ByteOrder ObjectFileXCOFF::GetByteOrder() const {
- return eByteOrderBig;
-}
+ByteOrder ObjectFileXCOFF::GetByteOrder() const { return eByteOrderBig; }
-bool ObjectFileXCOFF::IsExecutable() const {
- return true;
-}
+bool ObjectFileXCOFF::IsExecutable() const { return true; }
uint32_t ObjectFileXCOFF::GetAddressByteSize() const {
if (m_xcoff_header.magic == XCOFF::XCOFF64)
@@ -406,7 +410,8 @@ AddressClass ObjectFileXCOFF::GetAddressClass(addr_t file_addr) {
return AddressClass::eUnknown;
}
-lldb::SymbolType ObjectFileXCOFF::MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
+lldb::SymbolType
+ObjectFileXCOFF::MapSymbolType(llvm::object::SymbolRef::Type sym_type) {
if (sym_type == llvm::object::SymbolRef::ST_Function)
return lldb::eSymbolTypeCode;
else if (sym_type == llvm::object::SymbolRef::ST_Data)
@@ -433,7 +438,8 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
const uint32_t symbol_offset = offset;
symbol.value = symtab_data.GetU64(&offset);
symbol.offset = symtab_data.GetU32(&offset);
- Expected<StringRef> symbol_name_or_err = m_binary->getStringTableEntry(symbol.offset);
+ Expected<StringRef> symbol_name_or_err =
+ m_binary->getStringTableEntry(symbol.offset);
if (!symbol_name_or_err) {
consumeError(symbol_name_or_err.takeError());
return;
@@ -445,7 +451,8 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
symbol.storage = symtab_data.GetU8(&offset);
symbol.naux = symtab_data.GetU8(&offset);
// Allow C_HIDEXT TOC symbol, and check others.
- if (symbol.storage == XCOFF::C_HIDEXT && strcmp(symbol_name.c_str(), "TOC") != 0) {
+ if (symbol.storage == XCOFF::C_HIDEXT &&
+ strcmp(symbol_name.c_str(), "TOC") != 0) {
if (symbol.naux == 0)
continue;
if (symbol.naux > 1) {
@@ -467,7 +474,8 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
symbol_aux.pad = symtab_data.GetU8(&offset);
symbol_aux.aux_type = symtab_data.GetU8(&offset);
offset -= symbol.naux * symbol_size;
- if (symbol_aux.storage_mapping_class != XCOFF::XMC_PR || symbol_aux.aux_type != XCOFF::AUX_CSECT) {
+ if (symbol_aux.storage_mapping_class != XCOFF::XMC_PR ||
+ symbol_aux.aux_type != XCOFF::AUX_CSECT) {
i += symbol.naux;
offset += symbol.naux * symbol_size;
continue;
@@ -475,13 +483,17 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
}
// Remove the dot prefix for demangle
if (symbol_name_str.size() > 1 && symbol_name_str.data()[0] == '.') {
- symbols[sidx].GetMangled().SetValue(ConstString(symbol_name.c_str() + 1));
+ symbols[sidx].GetMangled().SetValue(
+ ConstString(symbol_name.c_str() + 1));
} else {
symbols[sidx].GetMangled().SetValue(ConstString(symbol_name.c_str()));
}
if ((int16_t)symbol.sect >= 1) {
- Address symbol_addr(sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1)),
- (symbol.value - sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1))->GetFileAddress()));
+ Address symbol_addr(
+ sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1)),
+ (symbol.value -
+ sect_list->GetSectionAtIndex((size_t)(symbol.sect - 1))
+ ->GetFileAddress()));
symbols[sidx].GetAddressRef() = symbol_addr;
Expected<llvm::object::SymbolRef::Type> sym_type_or_err = SI->getType();
@@ -502,9 +514,7 @@ void ObjectFileXCOFF::ParseSymtab(Symtab &lldb_symtab) {
}
}
-bool ObjectFileXCOFF::IsStripped() {
- return false;
-}
+bool ObjectFileXCOFF::IsStripped() { return false; }
void ObjectFileXCOFF::CreateSections(SectionList &unified_section_list) {
if (m_sections_up)
@@ -528,12 +538,14 @@ void ObjectFileXCOFF::CreateSections(SectionList &unified_section_list) {
const_sect_name, // Name of this section
section_type,
m_sect_headers[idx].vmaddr, // File VM address == addresses as
- // they are found in the object file
- m_sect_headers[idx].size, // VM size in bytes of this section
- m_sect_headers[idx].offset, // Offset to the data for this section in the file
- m_sect_headers[idx].size, // Size in bytes of this section as found in the file
- 0, // FIXME: alignment
- m_sect_headers[idx].flags)); // Flags for this section
+ // they are found in the object file
+ m_sect_headers[idx].size, // VM size in bytes of this section
+ m_sect_headers[idx]
+ .offset, // Offset to the data for this section in the file
+ m_sect_headers[idx]
+ .size, // Size in bytes of this section as found in the file
+ 0, // FIXME: alignment
+ m_sect_headers[idx].flags)); // Flags for this section
// FIXME
uint32_t permissions = 0;
@@ -558,7 +570,10 @@ llvm::StringRef ObjectFileXCOFF::GetSectionName(const section_header_t §) {
if (!to_integer(hdr_name, stroff, 10))
return "";
lldb::offset_t string_file_offset =
- m_xcoff_header.symoff + (m_xcoff_header.nsyms * static_cast<lldb::offset_t>(XCOFF::SymbolTableEntrySize)) + stroff;
+ m_xcoff_header.symoff +
+ (m_xcoff_header.nsyms *
+ static_cast<lldb::offset_t>(XCOFF::SymbolTableEntrySize)) +
+ stroff;
if (const char *name = m_data.GetCStr(&string_file_offset))
return name;
return "";
@@ -567,7 +582,7 @@ llvm::StringRef ObjectFileXCOFF::GetSectionName(const section_header_t §) {
}
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)
@@ -576,11 +591,11 @@ SectionType ObjectFileXCOFF::GetSectionType(llvm::StringRef sect_name,
return eSectionTypeZeroFill;
if (sect.flags & XCOFF::STYP_DWARF) {
SectionType section_type =
- llvm::StringSwitch<SectionType>(sect_name)
- .Case(".dwinfo", eSectionTypeDWARFDebugInfo)
- .Case(".dwline", eSectionTypeDWARFDebugLine)
- .Case(".dwabrev", eSectionTypeDWARFDebugAbbrev)
- .Default(eSectionTypeInvalid);
+ llvm::StringSwitch<SectionType>(sect_name)
+ .Case(".dwinfo", eSectionTypeDWARFDebugInfo)
+ .Case(".dwline", eSectionTypeDWARFDebugLine)
+ .Case(".dwabrev", eSectionTypeDWARFDebugAbbrev)
+ .Default(eSectionTypeInvalid);
if (section_type != eSectionTypeInvalid)
return section_type;
@@ -588,21 +603,17 @@ SectionType ObjectFileXCOFF::GetSectionType(llvm::StringRef sect_name,
return eSectionTypeOther;
}
-void ObjectFileXCOFF::Dump(Stream *s) {
-}
+void ObjectFileXCOFF::Dump(Stream *s) {}
ArchSpec ObjectFileXCOFF::GetArchitecture() {
- ArchSpec arch_spec = ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
+ ArchSpec arch_spec =
+ ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE);
return arch_spec;
}
-UUID ObjectFileXCOFF::GetUUID() {
- return UUID();
-}
+UUID ObjectFileXCOFF::GetUUID() { return UUID(); }
-std::optional<FileSpec> ObjectFileXCOFF::GetDebugLink() {
- return std::nullopt;
-}
+std::optional<FileSpec> ObjectFileXCOFF::GetDebugLink() { return std::nullopt; }
uint32_t ObjectFileXCOFF::ParseDependentModules() {
ModuleSP module_sp(GetModule());
@@ -703,10 +714,10 @@ lldb_private::Address ObjectFileXCOFF::GetEntryPointAddress() {
SectionList *section_list = GetSectionList();
addr_t vm_addr = m_xcoff_aux_header.EntryPointAddr;
- SectionSP section_sp(
- section_list->FindSectionContainingFileAddress(vm_addr));
+ SectionSP section_sp(section_list->FindSectionContainingFileAddress(vm_addr));
if (section_sp) {
- lldb::offset_t offset_ptr = section_sp->GetFileOffset() + (vm_addr - section_sp->GetFileAddress());
+ lldb::offset_t offset_ptr =
+ section_sp->GetFileOffset() + (vm_addr - section_sp->GetFileAddress());
vm_addr = m_data.GetU64(&offset_ptr);
}
@@ -731,18 +742,14 @@ ObjectFile::Type ObjectFileXCOFF::CalculateType() {
return eTypeUnknown;
}
-ObjectFile::Strata ObjectFileXCOFF::CalculateStrata() {
- return eStrataUnknown;
-}
+ObjectFile::Strata ObjectFileXCOFF::CalculateStrata() { return eStrataUnknown; }
-llvm::StringRef
-ObjectFileXCOFF::StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const {
+llvm::StringRef ObjectFileXCOFF::StripLinkerSymbolAnnotations(
+ llvm::StringRef symbol_name) const {
return llvm::StringRef();
}
-void ObjectFileXCOFF::RelocateSection(lldb_private::Section *section)
-{
-}
+void ObjectFileXCOFF::RelocateSection(lldb_private::Section *section) {}
std::vector<ObjectFile::LoadableData>
ObjectFileXCOFF::GetLoadableData(Target &target) {
@@ -752,29 +759,31 @@ ObjectFileXCOFF::GetLoadableData(Target &target) {
lldb::WritableDataBufferSP
ObjectFileXCOFF::MapFileDataWritable(const FileSpec &file, uint64_t Size,
- uint64_t Offset) {
+ uint64_t Offset) {
return FileSystem::Instance().CreateWritableDataBuffer(file.GetPath(), Size,
Offset);
}
ObjectFileXCOFF::ObjectFileXCOFF(const lldb::ModuleSP &module_sp,
- DataBufferSP data_sp, lldb::offset_t data_offset,
- const FileSpec *file, lldb::offset_t file_offset,
- lldb::offset_t length)
+ DataBufferSP data_sp,
+ lldb::offset_t data_offset,
+ const FileSpec *file,
+ lldb::offset_t file_offset,
+ lldb::offset_t length)
: ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
- m_xcoff_header(), m_sect_headers(), m_deps_filespec(), m_deps_base_members(),
- m_entry_point_address() {
+ m_xcoff_header(), m_sect_headers(), m_deps_filespec(),
+ m_deps_base_members(), m_entry_point_address() {
::memset(&m_xcoff_header, 0, sizeof(m_xcoff_header));
if (file)
m_file = *file;
}
ObjectFileXCOFF::ObjectFileXCOFF(const lldb::ModuleSP &module_sp,
- DataBufferSP header_data_sp,
- const lldb::ProcessSP &process_sp,
- addr_t header_addr)
+ DataBufferSP header_data_sp,
+ const lldb::ProcessSP &process_sp,
+ addr_t header_addr)
: ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
- m_xcoff_header(), m_sect_headers(), m_deps_filespec(), m_deps_base_members(),
- m_entry_point_address() {
+ m_xcoff_header(), m_sect_headers(), m_deps_filespec(),
+ m_deps_base_members(), m_entry_point_address() {
::memset(&m_xcoff_header, 0, sizeof(m_xcoff_header));
}
diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
index 5a12d16886..2cb73394a0 100644
--- a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
+++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h
@@ -1,4 +1,5 @@
-//===-- ObjectFileXCOFF.h --------------------------------------- -*- C++ -*-===//
+//===-- ObjectFileXCOFF.h --------------------------------------- -*- C++
+//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -76,7 +77,7 @@ public:
bool value_is_offset) override;
bool SetLoadAddressByType(lldb_private::Target &target, lldb::addr_t value,
- bool value_is_offset, int type_id) override;
+ bool value_is_offset, int type_id) override;
lldb::ByteOrder GetByteOrder() const override;
@@ -123,15 +124,15 @@ public:
lldb_private::DataExtractor ReadImageData(uint32_t offset, size_t size);
ObjectFileXCOFF(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
- lldb::offset_t data_offset, const lldb_private::FileSpec *file,
- lldb::offset_t offset, lldb::offset_t length);
+ lldb::offset_t data_offset,
+ const lldb_private::FileSpec *file, lldb::offset_t offset,
+ lldb::offset_t length);
ObjectFileXCOFF(const lldb::ModuleSP &module_sp,
- lldb::DataBufferSP header_data_sp,
- const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
+ lldb::DataBufferSP header_data_sp,
+ const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
protected:
-
typedef struct xcoff_header {
uint16_t magic;
uint16_t nsects;
@@ -209,8 +210,8 @@ protected:
} xcoff_sym_csect_aux_entry_t;
static bool ParseXCOFFHeader(lldb_private::DataExtractor &data,
- lldb::offset_t *offset_ptr,
- xcoff_header_t &xcoff_header);
+ lldb::offset_t *offset_ptr,
+ xcoff_header_t &xcoff_header);
bool ParseXCOFFOptionalHeader(lldb_private::DataExtractor &data,
lldb::offset_t *offset_ptr);
bool ParseSectionHeaders(uint32_t offset);
diff --git a/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp b/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp
index b6b08b73be..85e8866cee 100644
--- a/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp
+++ b/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp
@@ -43,7 +43,6 @@ LLDB_PLUGIN_DEFINE(PlatformAIX)
static uint32_t g_initialize_count = 0;
-
PlatformSP PlatformAIX::CreateInstance(bool force, const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
@@ -283,17 +282,17 @@ static lldb::UnwindPlanSP GetAArch64TrapHanlderUnwindPlan(ConstString name) {
lldb::UnwindPlanSP
PlatformAIX::GetTrapHandlerUnwindPlan(const llvm::Triple &triple,
- ConstString name) {
+ ConstString name) {
if (triple.isAArch64())
return GetAArch64TrapHanlderUnwindPlan(name);
return {};
}
-MmapArgList PlatformAIX::GetMmapArgumentList(const ArchSpec &arch,
- addr_t addr, addr_t length,
- unsigned prot, unsigned flags,
- addr_t fd, addr_t offset) {
+MmapArgList PlatformAIX::GetMmapArgumentList(const ArchSpec &arch, addr_t addr,
+ addr_t length, unsigned prot,
+ unsigned flags, addr_t fd,
+ addr_t offset) {
#if defined(__AIX__)
unsigned flags_platform = MAP_VARIABLE | MAP_PRIVATE | MAP_ANONYMOUS;
#else
@@ -349,13 +348,14 @@ CompilerType PlatformAIX::GetSiginfoType(const llvm::Triple &triple) {
nullptr, OptionalClangModuleID(), lldb::eAccessPublic, "",
llvm::to_underlying(clang::TagTypeKind::Union), lldb::eLanguageTypeC);
ast->StartTagDeclarationDefinition(sigfault_bounds_type);
- ast->AddFieldToRecordType(sigfault_bounds_type, "_addr_bnd",
+ ast->AddFieldToRecordType(
+ sigfault_bounds_type, "_addr_bnd",
ast->CreateStructForIdentifier(ConstString(),
{
{"_lower", voidp_type},
{"_upper", voidp_type},
}),
- lldb::eAccessPublic, 0);
+ lldb::eAccessPublic, 0);
ast->AddFieldToRecordType(sigfault_bounds_type, "_pkey", uint_type,
lldb::eAccessPublic, 0);
ast->CompleteTagDeclarationDefinition(sigfault_bounds_type);
diff --git a/lldb/source/Plugins/Platform/AIX/PlatformAIX.h b/lldb/source/Plugins/Platform/AIX/PlatformAIX.h
index 3ae8089a48..fe183e6bce 100644
--- a/lldb/source/Plugins/Platform/AIX/PlatformAIX.h
+++ b/lldb/source/Plugins/Platform/AIX/PlatformAIX.h
@@ -68,7 +68,7 @@ private:
std::unique_ptr<TypeSystemClang> m_type_system_up;
};
-} // namespace platform_AIX
+} // namespace platform_aix
} // namespace lldb_private
#endif // LLDB_SOURCE_PLUGINS_PLATFORM_AIX_PLATFORMAIX_H
diff --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
index 882f20d30a..555c7cba0d 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
@@ -22,18 +22,18 @@
#include "NativeThreadAIX.h"
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-//#include "Plugins/Process/Utility/LinuxProcMaps.h"
-//#include "Procfs.h"
+// #include "Plugins/Process/Utility/LinuxProcMaps.h"
+// #include "Procfs.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostProcess.h"
#include "lldb/Host/ProcessLaunchInfo.h"
#include "lldb/Host/PseudoTerminal.h"
#include "lldb/Host/ThreadLauncher.h"
-#include "lldb/Host/common/NativeRegisterContext.h"
#include "lldb/Host/aix/Ptrace.h"
-//#include "lldb/Host/linux/Host.h"
-//#include "lldb/Host/linux/Uio.h"
+#include "lldb/Host/common/NativeRegisterContext.h"
+// #include "lldb/Host/linux/Host.h"
+// #include "lldb/Host/linux/Uio.h"
#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"
@@ -50,15 +50,15 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Threading.h"
-#include <sys/reg.h>
-#include <sys/ptrace.h>
#include <sys/ldr.h>
+#include <sys/ptrace.h>
+#include <sys/reg.h>
#include <sys/socket.h>
-//#include <sys/syscall.h>
+// #include <sys/syscall.h>
+#include <sys/mman.h>
#include <sys/types.h>
#include <sys/user.h>
#include <sys/wait.h>
-#include <sys/mman.h>
#ifdef __aarch64__
#include <asm/hwcap.h>
@@ -196,7 +196,8 @@ static void PtraceDisplayBytes(int &req, void *data, size_t data_size) {
LLDB_LOGV(log, "PTRACE_SETREGSET {0}", buf.GetData());
break;
}
- default: {}
+ default: {
+ }
}
}
@@ -274,7 +275,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);
@@ -304,17 +305,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,
@@ -323,15 +324,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();
@@ -343,8 +344,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() {
@@ -435,8 +436,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
@@ -450,9 +451,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);
@@ -479,8 +480,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()));
@@ -493,8 +493,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.
@@ -510,7 +509,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
@@ -546,9 +545,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());
@@ -599,7 +597,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);
@@ -614,7 +612,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();
@@ -692,8 +690,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.
@@ -705,12 +703,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
@@ -762,9 +760,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);
@@ -959,7 +955,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.
@@ -1105,7 +1101,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(),
@@ -1162,10 +1158,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()));
@@ -1185,8 +1181,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();
@@ -1233,8 +1229,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)
@@ -1288,8 +1284,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)
@@ -1365,7 +1361,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
@@ -1403,7 +1399,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;
@@ -1413,7 +1409,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;
@@ -1431,7 +1428,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;
@@ -1439,8 +1436,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;
@@ -1453,9 +1451,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) {
@@ -1493,11 +1491,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);
@@ -1512,7 +1508,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);
@@ -1524,8 +1520,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()) {
@@ -1540,7 +1535,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;
@@ -1560,7 +1555,7 @@ Status NativeProcessAIX::GetLoadedModuleFileSpec(const char *module_path,
}
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();
@@ -1568,7 +1563,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();
}
@@ -1586,7 +1582,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());
@@ -1720,8 +1716,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;
@@ -1741,7 +1737,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);
@@ -1785,7 +1782,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));
@@ -1825,7 +1822,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));
@@ -2042,7 +2039,7 @@ Expected<json::Value> NativeProcessAIX::TraceGetState(StringRef type) {
return NativeProcessProtocol::TraceGetState(type);
}
-Expected<std::vector<uint8_t>> NativeProcessAIX::TraceGetBinaryData(
- const TraceGetBinaryDataRequest &request) {
+Expected<std::vector<uint8_t>>
+NativeProcessAIX::TraceGetBinaryData(const TraceGetBinaryDataRequest &request) {
return NativeProcessProtocol::TraceGetBinaryData(request);
}
diff --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
index bdb6f7c500..5185abe1eb 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
@@ -14,16 +14,16 @@
#include "lldb/Host/Debug.h"
#include "lldb/Host/HostThread.h"
+#include "lldb/Host/aix/Support.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/lldb-types.h"
-#include "llvm/ADT/SmallPtrSet.h"
-#include "lldb/Host/aix/Support.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "NativeThreadAIX.h"
-#include "lldb/Host/common/NativeProcessProtocol.h"
#include "Plugins/Process/Utility/NativeProcessSoftwareSingleStep.h"
+#include "lldb/Host/common/NativeProcessProtocol.h"
namespace lldb_private {
class Status;
@@ -38,24 +38,22 @@ namespace process_aix {
///
/// Changes in the inferior process state are broadcasted.
class NativeProcessAIX : public NativeProcessProtocol,
- private NativeProcessSoftwareSingleStep {
+ private NativeProcessSoftwareSingleStep {
public:
class Manager : public NativeProcessProtocol::Manager {
public:
- Manager(MainLoop &mainloop);
+ Manager(MainLoop &mainloop);
llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Launch(ProcessLaunchInfo &launch_info,
- NativeDelegate &native_delegate) override;
+ NativeDelegate &native_delegate) override;
llvm::Expected<std::unique_ptr<NativeProcessProtocol>>
Attach(lldb::pid_t pid, NativeDelegate &native_delegate) override;
Extension GetSupportedExtensions() const override;
- void AddProcess(NativeProcessAIX &process) {
- m_processes.insert(&process);
- }
+ void AddProcess(NativeProcessAIX &process) { m_processes.insert(&process); }
void RemoveProcess(NativeProcessAIX &process) {
m_processes.erase(&process);
@@ -72,7 +70,7 @@ public:
// Threads (events) which haven't been claimed by any process.
llvm::DenseSet<::pid_t> m_unowned_threads;
- void SigchldHandler();
+ void SigchldHandler();
};
// NativeProcessProtocol Interface
@@ -189,8 +187,8 @@ private:
// Private Instance Methods
NativeProcessAIX(::pid_t pid, int terminal_fd, NativeDelegate &delegate,
- const ArchSpec &arch, Manager &manager,
- llvm::ArrayRef<::pid_t> tids);
+ const ArchSpec &arch, Manager &manager,
+ llvm::ArrayRef<::pid_t> tids);
// Returns a list of process threads that we have attached to.
static llvm::Expected<std::vector<::pid_t>> Attach(::pid_t pid);
@@ -273,8 +271,7 @@ private:
Status PopulateMemoryRegionCache();
// Handle a clone()-like event.
- bool MonitorClone(NativeThreadAIX &parent, lldb::pid_t child_pid,
- int event);
+ bool MonitorClone(NativeThreadAIX &parent, lldb::pid_t child_pid, int event);
};
} // namespace process_aix
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
index 0859f9501c..409bfe2cd4 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.cpp
@@ -24,7 +24,7 @@ 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("register %" PRIu32 " not found", reg_index);
@@ -35,7 +35,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;
@@ -91,45 +91,43 @@ NativeRegisterContextAIX::WriteRegisterRaw(uint32_t reg_index,
}
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 +150,6 @@ Status NativeRegisterContextAIX::DoWriteRegisterValue(
void *buf = reinterpret_cast<void *>(value.GetAsUInt64());
LLDB_LOG(log, "{0}: {1}", reg_name, buf);
- return NativeProcessAIX::PtraceWrapper(
- PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
+ return NativeProcessAIX::PtraceWrapper(PTRACE_POKEUSER, m_thread.GetID(),
+ reinterpret_cast<void *>(offset), buf);
}
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
index 9c2a326856..df755824a2 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX.h
@@ -28,10 +28,10 @@ public:
// variant should be compiled into the final executable.
static std::unique_ptr<NativeRegisterContextAIX>
CreateHostNativeRegisterContextAIX(const ArchSpec &target_arch,
- NativeThreadAIX &native_thread);
+ NativeThreadAIX &native_thread);
// Invalidates cached values in register context data structures
- virtual void InvalidateAllRegisters(){}
+ virtual void InvalidateAllRegisters() {}
struct SyscallData {
/// The syscall instruction. If the architecture uses software
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.cpp
index 1996373791..c2afc3bb3c 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,8 +244,9 @@ 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");
@@ -467,30 +469,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 +536,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 +585,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 +626,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 +641,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 +653,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 +732,9 @@ Status NativeRegisterContextAIX_ppc64::WriteHardwareDebugRegs() {
if ((m_hwp_regs[i].control & 1) == 0)
continue;
- error = NativeProcessAIX::PtraceWrapper(PT_WATCH, m_thread.GetID(), (void *)m_hwp_regs[i].address, nullptr, 8, &ret);
+ error = NativeProcessAIX::PtraceWrapper(PT_WATCH, m_thread.GetID(),
+ (void *)m_hwp_regs[i].address,
+ nullptr, 8, &ret);
if (error.Fail())
return error;
diff --git a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h
index a29f786f23..74641710d8 100644
--- a/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h
+++ b/lldb/source/Plugins/Process/AIX/NativeRegisterContextAIX_ppc64.h
@@ -29,7 +29,7 @@ class NativeProcessAIX;
class NativeRegisterContextAIX_ppc64 : public NativeRegisterContextAIX {
public:
NativeRegisterContextAIX_ppc64(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread);
+ NativeThreadProtocol &native_thread);
uint32_t GetRegisterSetCount() const override;
diff --git a/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
index e07daccdff..8172e082dc 100644
--- a/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
@@ -25,9 +25,9 @@
#include "Plugins/Process/POSIX/CrashReason.h"
-#include <sys/types.h>
-#include <sys/ptrace.h>
#include <signal.h>
+#include <sys/ptrace.h>
+#include <sys/types.h>
#if 0
#include <sys/syscall.h>
@@ -89,10 +89,9 @@ void LogThreadStopInfo(Log &log, const ThreadStopInfo &stop_info,
static_cast<uint32_t>(stop_info.reason));
}
}
-}
+} // namespace
-NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process,
- lldb::tid_t tid)
+NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
m_stop_info(),
m_reg_context_up(
@@ -112,7 +111,7 @@ std::string NativeThreadAIX::GetName() {
lldb::StateType NativeThreadAIX::GetState() { return m_state; }
bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
- std::string &description) {
+ std::string &description) {
Log *log = GetLog(LLDBLog::Thread);
description.clear();
@@ -151,7 +150,7 @@ bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
}
Status NativeThreadAIX::SetWatchpoint(lldb::addr_t addr, size_t size,
- uint32_t watch_flags, bool hardware) {
+ uint32_t watch_flags, bool hardware) {
if (!hardware)
return Status("not implemented");
if (m_state == eStateLaunching)
@@ -178,8 +177,7 @@ Status NativeThreadAIX::RemoveWatchpoint(lldb::addr_t addr) {
return Status("Clearing hardware watchpoint failed.");
}
-Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr,
- size_t size) {
+Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) {
if (m_state == eStateLaunching)
return Status();
@@ -249,7 +247,7 @@ Status NativeThreadAIX::Resume(uint32_t signo) {
data = signo;
return NativeProcessAIX::PtraceWrapper(PT_CONTINUE, GetID(), nullptr,
- reinterpret_cast<void *>(data));
+ reinterpret_cast<void *>(data));
}
Status NativeThreadAIX::SingleStep(uint32_t signo) {
@@ -400,7 +398,7 @@ void NativeThreadAIX::SetStoppedByWatchpoint(uint32_t wp_index) {
* find the base address of the load/store instruction and append it in the
* stop-info
* packet.
- */
+ */
ostr << " " << m_reg_context_up->GetWatchpointHitAddress(wp_index);
m_stop_description = ostr.str();
@@ -448,8 +446,7 @@ void NativeThreadAIX::SetStoppedWithNoReason() {
m_stop_info.signo = 0;
}
-void NativeThreadAIX::SetStoppedByProcessorTrace(
- llvm::StringRef description) {
+void NativeThreadAIX::SetStoppedByProcessorTrace(llvm::StringRef description) {
SetStopped();
m_stop_info.reason = StopReason::eStopReasonProcessorTrace;
@@ -482,8 +479,7 @@ Status NativeThreadAIX::RequestStop() {
errno = 0;
if (::kill(pid, SIGSTOP) != 0) {
err.SetErrorToErrno();
- LLDB_LOGF(log,
- "NativeThreadAIX::%s kill(%" PRIu64 ", SIGSTOP) failed: %s",
+ LLDB_LOGF(log, "NativeThreadAIX::%s kill(%" PRIu64 ", SIGSTOP) failed: %s",
__FUNCTION__, pid, err.AsCString());
}
return err;
diff --git a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
index db271357d7..9760e30b71 100644
--- a/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
+++ b/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
@@ -65,7 +65,7 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
if (toc_list.GetContextAtIndex(i, tocSC)) {
if (tocSC.module_sp == sc.module_sp) {
if (tocSC.GetAddressRange(eSymbolContextSymbol, 0, false,
- toc_range)) {
+ toc_range)) {
break;
}
}
@@ -123,10 +123,9 @@ bool lldb_private::InferiorCallMmap(Process *process, addr_t &allocated_addr,
process->GetTarget().GetPlatform()->GetMmapArgumentList(
arch, addr, length, prot_arg, flags, fd, offset);
#if defined(__AIX__)
- lldb::ThreadPlanSP call_plan_sp(
- new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(),
- toc_range.GetBaseAddress(),
- void_ptr_type, args, options));
+ lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallFunction(
+ *thread, mmap_range.GetBaseAddress(), toc_range.GetBaseAddress(),
+ void_ptr_type, args, options));
#else
lldb::ThreadPlanSP call_plan_sp(
new ThreadPlanCallFunction(*thread, mmap_range.GetBaseAddress(),
diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
index d9b41d5951..8f8b6a159b 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.cpp
@@ -23,7 +23,7 @@
static const lldb_private::RegisterInfo *
GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
switch (target_arch.GetMachine()) {
- //HH
+ // HH
case llvm::Triple::ppc64:
case llvm::Triple::ppc64le:
return g_register_infos_ppc64le;
@@ -36,7 +36,7 @@ GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
static uint32_t
GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch) {
switch (target_arch.GetMachine()) {
- //HitchHike
+ // HitchHike
case llvm::Triple::ppc64:
case llvm::Triple::ppc64le:
return static_cast<uint32_t>(sizeof(g_register_infos_ppc64le) /
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 17926f8e4a..d9ef3d7813 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1713,8 +1713,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];
@@ -1722,12 +1721,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.SetErrorString("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 1a51a52d9d..f368581fa8 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);
@@ -3013,7 +3014,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);
@@ -3024,7 +3026,8 @@ GDBRemoteCommunicationServerLLGS::Handle_qLDXINFO(StringExtractorGDBRemote &pack
#if defined(__AIX__)
// FIXME: buffer size
struct ld_xinfo info[64];
- if (ptrace64(PT_LDXINFO, m_current_process->GetID(), (long long)&(info[0]), sizeof(info), nullptr) != 0) {
+ if (ptrace64(PT_LDXINFO, m_current_process->GetID(), (long long)&(info[0]),
+ sizeof(info), nullptr) != 0) {
return SendErrorResponse(0xff);
}
StreamGDBRemote response;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 6af66699c3..5888d44de3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -932,7 +932,7 @@ const DWARFDebugAranges &DWARFUnit::GetFunctionAranges() {
}
/* AIX-NOTE - TODO: Removed conflicting code due to merge conflicts
- * Refer Patches: 27,28,29,30,35 and 76
+ * Refer Patches: 27,28,29,30,35 and 76
* and modify the code accordingly. */
bool UGLY_FLAG_FOR_AIX __attribute__((weak)) = false;
@@ -1016,7 +1016,7 @@ uint32_t DWARFUnit::GetHeaderByteSize() const {
switch (m_header.getUnitType()) {
case llvm::dwarf::DW_UT_compile:
if (UGLY_FLAG_FOR_AIX)
- return 11 + 4/*GetDWARFSizeOfOffset*/;
+ return 11 + 4 /*GetDWARFSizeOfOffset*/;
else
return GetVersion() < 5 ? 11 : 12;
case llvm::dwarf::DW_UT_partial:
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp
index 57f42ea56c..2de4f10e4c 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1525,7 +1525,8 @@ RegisterContextUnwind::SavedLocationForRegister(
UnwindLLDB::RegisterLocation::eRegisterInLiveRegisterContext;
new_regloc.location.register_number = regnum.GetAsKind(eRegisterKindLLDB);
#ifdef __AIX__
- if (UGLY_HACK_NULL_TOPFRAME && new_regloc.location.register_number == 0x20) {
+ if (UGLY_HACK_NULL_TOPFRAME &&
+ new_regloc.location.register_number == 0x20) {
new_regloc.location.register_number = 0x24;
}
#endif
@@ -2398,12 +2399,11 @@ bool RegisterContextUnwind::ReadLR(addr_t &lr) {
// through a NULL pointer -- we want to be able to unwind past that frame
// to help find the bug.
- ProcessSP process_sp (m_thread.GetProcess());
- if (process_sp)
- {
- ABI *abi = process_sp->GetABI().get();
- if (abi)
- lr = abi->FixCodeAddress(lr);
+ ProcessSP process_sp(m_thread.GetProcess());
+ if (process_sp) {
+ ABI *abi = process_sp->GetABI().get();
+ if (abi)
+ lr = abi->FixCodeAddress(lr);
}
return !(m_all_registers_available == false &&
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index 0926579ea2..3730e04e43 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -129,8 +129,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction(
ThreadPlanCallFunction::ThreadPlanCallFunction(
Thread &thread, const Address &function, const Address &toc,
- const CompilerType &return_type,
- llvm::ArrayRef<addr_t> args, const EvaluateExpressionOptions &options)
+ const CompilerType &return_type, llvm::ArrayRef<addr_t> args,
+ const EvaluateExpressionOptions &options)
: ThreadPlan(ThreadPlan::eKindCallFunction, "Call function plan", thread,
eVoteNoOpinion, eVoteNoOpinion),
m_valid(false), m_stop_other_threads(options.GetStopOthers()),
diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index ac91183a27..85bb85044e 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -14,7 +14,6 @@
#include "lldb/lldb-defines.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/BinaryFormat/COFF.h"
-#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/BinaryFormat/XCOFF.h"
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index f7eaf56738..ca350a569a 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -639,7 +639,8 @@ void sigwinch_handler(int signo) {
}
void sigint_handler(int signo) {
-#if defined(_WIN32) || defined(__AIX__) // Restore handler as it is not persistent on Windows
+#if defined(_WIN32) || \
+ defined(__AIX__) // Restore handler as it is not persistent on Windows
signal(SIGINT, sigint_handler);
#endif
static std::atomic_flag g_interrupt_sent = ATOMIC_FLAG_INIT;
diff --git a/lldb/unittests/Host/FileSystemTest.cpp b/lldb/unittests/Host/FileSystemTest.cpp
index 89d0f5b871..2685b396b6 100644
--- a/lldb/unittests/Host/FileSystemTest.cpp
+++ b/lldb/unittests/Host/FileSystemTest.cpp
@@ -58,8 +58,8 @@ public:
return std::error_code(ENOENT, std::generic_category());
return I->second;
}
- ErrorOr<std::unique_ptr<vfs::File>>
- openFileForRead(const Twine &Path, bool IsText) override {
+ ErrorOr<std::unique_ptr<vfs::File>> openFileForRead(const Twine &Path,
+ bool IsText) override {
auto S = status(Path);
if (S)
return std::unique_ptr<vfs::File>(new DummyFile{*S});
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index 9c96df1bbd..3a52563393 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -274,11 +274,10 @@ Error DWARFUnitHeader::extract(DWARFContext &Context,
FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
} else {
if (UGLY_FLAG_FOR_AIX) {
- AbbrOffset = debug_info.getRelocatedValue(
- 8, offset_ptr, nullptr, &Err);
+ AbbrOffset = debug_info.getRelocatedValue(8, offset_ptr, nullptr, &Err);
} else {
- AbbrOffset = debug_info.getRelocatedValue(
- FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
+ AbbrOffset = debug_info.getRelocatedValue(
+ FormParams.getDwarfOffsetByteSize(), offset_ptr, nullptr, &Err);
}
FormParams.AddrSize = debug_info.getU8(offset_ptr, &Err);
// Fake a unit type based on the section type. This isn't perfect,
``````````
</details>
https://github.com/llvm/llvm-project/pull/102601
More information about the cfe-commits
mailing list