summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host')
-rw-r--r--lldb/source/Host/common/Host.cpp4
-rw-r--r--lldb/source/Host/common/HostProcess.cpp2
-rw-r--r--lldb/source/Host/common/MonitoringProcessLauncher.cpp8
-rw-r--r--lldb/source/Host/common/ProcessLaunchInfo.cpp5
-rw-r--r--lldb/source/Host/posix/HostProcessPosix.cpp2
5 files changed, 15 insertions, 6 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;
diff --git a/lldb/source/Host/posix/HostProcessPosix.cpp b/lldb/source/Host/posix/HostProcessPosix.cpp
index 725f59d7512..cc187d44246 100644
--- a/lldb/source/Host/posix/HostProcessPosix.cpp
+++ b/lldb/source/Host/posix/HostProcessPosix.cpp
@@ -87,7 +87,7 @@ bool HostProcessPosix::IsRunning() const {
return error.Success();
}
-HostThread HostProcessPosix::StartMonitoring(
+llvm::Expected<HostThread> HostProcessPosix::StartMonitoring(
const Host::MonitorChildProcessCallback &callback, bool monitor_signals) {
return Host::StartMonitoringChildProcess(callback, m_process,
monitor_signals);
OpenPOWER on IntegriCloud