Author: stella.stamenova Date: Mon Jul 8 15:09:08 2019 New Revision: 365400
URL: http://llvm.org/viewvc/llvm-project?rev=365400&view=rev Log: [lldb, windows] When StartMonitoring fails, return a proper error This is possible now that the function returns an llvm::Expected Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=365400&r1=365399&r2=365400&view=diff ============================================================================== --- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original) +++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Mon Jul 8 15:09:08 2019 @@ -82,20 +82,21 @@ bool HostProcessWindows::IsRunning() con llvm::Expected<HostThread> HostProcessWindows::StartMonitoring( const Host::MonitorChildProcessCallback &callback, bool monitor_signals) { - HostThread monitor_thread; MonitorInfo *info = new MonitorInfo; info->callback = callback; // Since the life of this HostProcessWindows instance and the life of the // process may be different, duplicate the handle so that the monitor thread // can have ownership over its own copy of the handle. - HostThread result; if (::DuplicateHandle(GetCurrentProcess(), m_process, GetCurrentProcess(), - &info->process_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) - result = ThreadLauncher::LaunchThread("ChildProcessMonitor", - HostProcessWindows::MonitorThread, - info); - return result; + &info->process_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) { + return ThreadLauncher::LaunchThread("ChildProcessMonitor", + HostProcessWindows::MonitorThread, + info); + } else { + DWORD err = GetLastError(); + return llvm::errorCodeToError(std::error_code(err, std::system_category())); + } } lldb::thread_result_t HostProcessWindows::MonitorThread(void *thread_arg) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits