[lldb/Process/Windows] Attempting to kill exited/detached process in not an error

The lldb test-suite on Windows reports a 'CLEANUP ERROR' when attempting to kill
an exited/detached process. This change makes ProcessWindows consistent with
the other processes which only log the error. After this change a number of
'CLEANUP ERROR' messages are now removed.

Differential Revision: https://reviews.llvm.org/D84957
This commit is contained in:
Tatyana Krasnukha 2020-07-30 20:13:23 +03:00
parent c3339e3e92
commit e97c693bb0
1 changed files with 13 additions and 15 deletions

View File

@ -227,22 +227,20 @@ Status ProcessDebugger::DestroyProcess(const lldb::StateType state) {
debugger_thread = m_session_data->m_debugger; debugger_thread = m_session_data->m_debugger;
} }
Status error; if (state == eStateExited || state == eStateDetached) {
if (state != eStateExited && state != eStateDetached) { LLDB_LOG(log, "warning: cannot destroy process {0} while state = {1}.",
LLDB_LOG( GetDebuggedProcessId(), state);
log, "Shutting down process {0}.", return Status();
debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
error = debugger_thread->StopDebugging(true);
// By the time StopDebugging returns, there is no more debugger thread, so
// we can be assured that no other thread will race for the session data.
m_session_data.reset();
} else {
error.SetErrorStringWithFormat("cannot destroy process %" PRIx64
" while state = %d",
GetDebuggedProcessId(), state);
LLDB_LOG(log, "error: {0}", error);
} }
LLDB_LOG(log, "Shutting down process {0}.",
debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
auto error = debugger_thread->StopDebugging(true);
// By the time StopDebugging returns, there is no more debugger thread, so
// we can be assured that no other thread will race for the session data.
m_session_data.reset();
return error; return error;
} }