================
@@ -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;
----------------
DavidSpickett wrote:
Either return the error without modification (assuming there's a Status
constructor from llvm::Error), or, if the error back from PTraceWrapper can be
formatted, add that to your "Kill failed" message.
https://github.com/llvm/llvm-project/pull/169454
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits