15#include "llvm/ADT/STLExtras.h"
16#include "llvm/Support/ConvertUTF.h"
17#include "llvm/Support/WindowsError.h"
26 HANDLE process_handle;
60 if (!::GetExitCodeProcess(
m_process, &code))
63 return (code == STILL_ACTIVE);
68 HANDLE process_handle) {
71 ::WaitForSingleObject(process_handle, INFINITE);
72 ::GetExitCodeProcess(process_handle, &exit_code);
73 callback(::GetProcessId(process_handle), 0, exit_code);
74 ::CloseHandle(process_handle);
80 HANDLE process_handle;
85 if (::DuplicateHandle(GetCurrentProcess(),
m_process, GetCurrentProcess(),
86 &process_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) {
88 "ChildProcessMonitor", [callback, process_handle] {
92 return llvm::errorCodeToError(llvm::mapWindowsError(GetLastError()));
static llvm::raw_ostream & error(Stream &strm)
static lldb::thread_result_t MonitorThread(const Host::MonitorChildProcessCallback &callback, HANDLE process_handle)
lldb::process_t m_process
void SetOwnsHandle(bool owns)
Status Terminate() override
lldb::pid_t GetProcessId() const override
bool IsRunning() const override
virtual llvm::Expected< HostThread > StartMonitoring(const Host::MonitorChildProcessCallback &callback) override
std::function< void(lldb::pid_t pid, int signal, int status)> MonitorChildProcessCallback
static llvm::Expected< HostThread > LaunchThread(llvm::StringRef name, std::function< lldb::thread_result_t()> thread_function, size_t min_stack_byte_size=0)
#define LLDB_INVALID_PROCESS
A class that represents a running process on the host machine.
@ eErrorTypeWin32
Standard Win32 error codes.