[Lldb-commits] [lldb] [lldb][AIX] Added base files for NativeProcess Support for AIX (PR #118160)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 29 23:45:26 PST 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 e874c8fc27bbc0e340691d5b5d01c7a1bd365890 3462b9263d4f268a89baf4b956b8dc851858fe0a --extensions h,cpp -- lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
index a8d5448323..28f5623853 100644
--- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
+++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp
@@ -7,16 +7,6 @@
//===----------------------------------------------------------------------===//
#include "NativeProcessAIX.h"
-#include <cerrno>
-#include <cstdint>
-#include <cstring>
-#include <unistd.h>
-#include <fstream>
-#include <mutex>
-#include <optional>
-#include <sstream>
-#include <string>
-#include <unordered_map>
#include "NativeThreadAIX.h"
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
#include "lldb/Host/Host.h"
@@ -33,6 +23,16 @@
#include "llvm/Support/Errno.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
+#include <cerrno>
+#include <cstdint>
+#include <cstring>
+#include <fstream>
+#include <mutex>
+#include <optional>
+#include <sstream>
+#include <string>
+#include <unistd.h>
+#include <unordered_map>
using namespace lldb;
using namespace lldb_private;
@@ -74,7 +74,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);
Status status;
@@ -102,13 +102,13 @@ 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());
+ }
- // 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,
@@ -117,21 +117,21 @@ 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();
- 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));
}
NativeProcessAIX::Extension
@@ -144,18 +144,16 @@ NativeProcessAIX::Manager::GetSupportedExtensions() const {
return supported;
}
-void NativeProcessAIX::Manager::SigchldHandler() {
-}
+void NativeProcessAIX::Manager::SigchldHandler() {}
-void NativeProcessAIX::Manager::CollectThread(::pid_t tid) {
-}
+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);
@@ -182,15 +180,11 @@ llvm::Expected<std::vector<::pid_t>> NativeProcessAIX::Attach(::pid_t pid) {
}
void NativeProcessAIX::MonitorSIGTRAP(const WaitStatus status,
- NativeThreadAIX &thread) {
-}
+ NativeThreadAIX &thread) {}
-void NativeProcessAIX::MonitorBreakpoint(NativeThreadAIX &thread) {
-}
+void NativeProcessAIX::MonitorBreakpoint(NativeThreadAIX &thread) {}
-bool NativeProcessAIX::SupportHardwareSingleStepping() const {
- return false;
-}
+bool NativeProcessAIX::SupportHardwareSingleStepping() const { return false; }
Status NativeProcessAIX::Resume(const ResumeActionList &resume_actions) {
return Status();
@@ -211,9 +205,7 @@ Status NativeProcessAIX::Signal(int signo) {
return error;
}
-Status NativeProcessAIX::Interrupt() {
- return Status();
-}
+Status NativeProcessAIX::Interrupt() { return Status(); }
Status NativeProcessAIX::Kill() {
Status error;
@@ -221,7 +213,7 @@ Status NativeProcessAIX::Kill() {
}
Status NativeProcessAIX::SetBreakpoint(lldb::addr_t addr, uint32_t size,
- bool hardware) {
+ bool hardware) {
if (hardware)
return SetHardwareBreakpoint(addr, size);
else
@@ -249,9 +241,8 @@ Status NativeProcessAIX::Detach(lldb::tid_t tid) {
// 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;
return error;
}
-
diff --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.h
index 2c07ba420d..6f7479923c 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 "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,7 +38,7 @@ 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:
@@ -46,16 +46,14 @@ public:
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);
@@ -102,7 +100,7 @@ public:
void *data = nullptr, size_t data_size = 0,
long *result = nullptr);
-// Wrapper for ptrace to catch errors and log calls. Note that ptrace sets
+ // Wrapper for ptrace to catch errors and log calls. Note that ptrace sets
private:
Manager &m_manager;
@@ -112,8 +110,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);
@@ -125,7 +123,6 @@ private:
Status Detach(lldb::tid_t tid);
void SigchldHandler();
-
};
} // namespace process_aix
``````````
</details>
https://github.com/llvm/llvm-project/pull/118160
More information about the lldb-commits
mailing list