diff options
Diffstat (limited to 'lldb/source/Host/common')
-rw-r--r-- | lldb/source/Host/common/Host.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/common/HostProcess.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Host/common/MonitoringProcessLauncher.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Host/common/ProcessLaunchInfo.cpp | 5 |
4 files changed, 14 insertions, 5 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index be206406e93..3ba9ab7f21f 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -99,7 +99,7 @@ struct MonitorInfo { static thread_result_t MonitorChildProcessThreadFunction(void *arg); -HostThread Host::StartMonitoringChildProcess( +llvm::Expected<HostThread> Host::StartMonitoringChildProcess( const Host::MonitorChildProcessCallback &callback, lldb::pid_t pid, bool monitor_signals) { MonitorInfo *info_ptr = new MonitorInfo(); @@ -112,7 +112,7 @@ HostThread Host::StartMonitoringChildProcess( ::snprintf(thread_name, sizeof(thread_name), "<lldb.host.wait4(pid=%" PRIu64 ")>", pid); return ThreadLauncher::LaunchThread( - thread_name, MonitorChildProcessThreadFunction, info_ptr, nullptr); + thread_name, MonitorChildProcessThreadFunction, info_ptr, 0); } #ifndef __linux__ diff --git a/lldb/source/Host/common/HostProcess.cpp b/lldb/source/Host/common/HostProcess.cpp index d8f71af5e65..e180687551f 100644 --- a/lldb/source/Host/common/HostProcess.cpp +++ b/lldb/source/Host/common/HostProcess.cpp @@ -32,7 +32,7 @@ lldb::pid_t HostProcess::GetProcessId() const { bool HostProcess::IsRunning() const { return m_native_process->IsRunning(); } -HostThread +llvm::Expected<HostThread> HostProcess::StartMonitoring(const Host::MonitorChildProcessCallback &callback, bool monitor_signals) { return m_native_process->StartMonitoring(callback, monitor_signals); diff --git a/lldb/source/Host/common/MonitoringProcessLauncher.cpp b/lldb/source/Host/common/MonitoringProcessLauncher.cpp index 2ee69353e19..55e9f69a089 100644 --- a/lldb/source/Host/common/MonitoringProcessLauncher.cpp +++ b/lldb/source/Host/common/MonitoringProcessLauncher.cpp @@ -53,8 +53,12 @@ MonitoringProcessLauncher::LaunchProcess(const ProcessLaunchInfo &launch_info, Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); assert(launch_info.GetMonitorProcessCallback()); - process.StartMonitoring(launch_info.GetMonitorProcessCallback(), - launch_info.GetMonitorSignals()); + llvm::Expected<HostThread> maybe_thread = + process.StartMonitoring(launch_info.GetMonitorProcessCallback(), + launch_info.GetMonitorSignals()); + if (!maybe_thread) + error.SetErrorStringWithFormatv("failed to launch host thread: {}", + llvm::toString(maybe_thread.takeError())); if (log) log->PutCString("started monitoring child process."); } else { diff --git a/lldb/source/Host/common/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp index ac8a41bf883..266b4676399 100644 --- a/lldb/source/Host/common/ProcessLaunchInfo.cpp +++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp @@ -188,8 +188,13 @@ bool ProcessLaunchInfo::NoOpMonitorCallback(lldb::pid_t pid, bool exited, int si bool ProcessLaunchInfo::MonitorProcess() const { if (m_monitor_callback && ProcessIDIsValid()) { + llvm::Expected<HostThread> maybe_thread = Host::StartMonitoringChildProcess(m_monitor_callback, GetProcessID(), m_monitor_signals); + if (!maybe_thread) + LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), + "failed to launch host thread: {}", + llvm::toString(maybe_thread.takeError())); return true; } return false; |