https://github.com/DhruvSrivastavaX created https://github.com/llvm/llvm-project/pull/169454
This PR is in reference to porting LLDB on AIX. Link to discussions on llvm [discourse](https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640) and [github](https://github.com/llvm/llvm-project/issues/101657). The complete changes for porting are present in this draft PR: - https://github.com/llvm/llvm-project/pull/102601 Description: Extending Kill and SigchldHandler for NativeProcessAIX. >From e142b765cc8a847016cb0cc15f161e94e0fd236a Mon Sep 17 00:00:00 2001 From: DhruvSrivastavaX <[email protected]> Date: Mon, 24 Nov 2025 22:44:35 -0600 Subject: [PATCH] Added Kill() implementation --- .../Plugins/Process/AIX/NativeProcessAIX.cpp | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp index cd5e3458e60e8..7f3dbbff18ea2 100644 --- a/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp +++ b/lldb/source/Plugins/Process/AIX/NativeProcessAIX.cpp @@ -137,6 +137,12 @@ void NativeProcessAIX::Manager::SigchldHandler() { auto wait_result = WaitPid(); if (!wait_result) return; + lldb::pid_t pid = wait_result->first; + WaitStatus status = wait_result->second; + + llvm::any_of(m_processes, [&](NativeProcessAIX *process) { + return process->TryHandleWaitStatus(pid, status); + }); } } @@ -187,7 +193,41 @@ Status NativeProcessAIX::Signal(int signo) { return Status("unsupported"); } Status NativeProcessAIX::Interrupt() { return Status("unsupported"); } -Status NativeProcessAIX::Kill() { return Status("unsupported"); } +Status NativeProcessAIX::Kill() { + + Log *log = GetLog(POSIXLog::Process); + LLDB_LOG(log, "pid {0}", GetID()); + + Status error; + + switch (m_state) { + case StateType::eStateInvalid: + case StateType::eStateExited: + case StateType::eStateCrashed: + case StateType::eStateDetached: + case StateType::eStateUnloaded: + // Nothing to do - the process is already dead. + LLDB_LOG(log, "ignored for PID {0} due to current state: {1}", GetID(), + m_state); + return error; + + case StateType::eStateConnected: + case StateType::eStateAttaching: + case StateType::eStateLaunching: + case StateType::eStateStopped: + case StateType::eStateRunning: + case StateType::eStateStepping: + case StateType::eStateSuspended: + // We can try to kill a process in these states. + break; + } + + llvm::Error result = + (PtraceWrapper(PT_KILL, GetID(), nullptr, nullptr, 0)).takeError(); + if (!result) + error.FromErrorString("Kill failed"); + return error; +} Status NativeProcessAIX::ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) { @@ -237,6 +277,7 @@ llvm::Expected<int> NativeProcessAIX::PtraceWrapper(int req, lldb::pid_t pid, switch (req) { case PT_ATTACH: case PT_DETACH: + case PT_KILL: ret = ptrace64(req, pid, 0, 0, nullptr); break; default: _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
