[Lldb-commits] [lldb] r365761 - [LLDB] Fix FreeBSD build.
David Carlier via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 11 05:21:04 PDT 2019
Author: devnexen
Date: Thu Jul 11 05:21:04 2019
New Revision: 365761
URL: http://llvm.org/viewvc/llvm-project?rev=365761&view=rev
Log:
[LLDB] Fix FreeBSD build.
To align with the LaunchThread change.
Reviewers: MaskRay, mgorny
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D64398
Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp?rev=365761&r1=365760&r2=365761&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Thu Jul 11 05:21:04 2019
@@ -708,7 +708,7 @@ ProcessMonitor::ProcessMonitor(
const lldb_private::ProcessLaunchInfo & /* launch_info */,
lldb_private::Status &error)
: m_process(static_cast<ProcessFreeBSD *>(process)),
- m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), m_operation(0) {
+ m_operation_thread(nullptr), m_monitor_thread(nullptr), m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), m_operation(0) {
using namespace std::placeholders;
std::unique_ptr<LaunchArgs> args(
@@ -738,7 +738,7 @@ ProcessMonitor::ProcessMonitor(
m_monitor_thread = Host::StartMonitoringChildProcess(
std::bind(&ProcessMonitor::MonitorCallback, this, _1, _2, _3, _4),
GetPID(), true);
- if (!m_monitor_thread.IsJoinable()) {
+ if (!m_monitor_thread->IsJoinable()) {
error.SetErrorToGenericError();
error.SetErrorString("Process launch failed.");
return;
@@ -747,8 +747,8 @@ ProcessMonitor::ProcessMonitor(
ProcessMonitor::ProcessMonitor(ProcessFreeBSD *process, lldb::pid_t pid,
lldb_private::Status &error)
- : m_process(static_cast<ProcessFreeBSD *>(process)), m_pid(pid),
- m_terminal_fd(-1), m_operation(0) {
+ : m_process(static_cast<ProcessFreeBSD *>(process)),
+ m_operation_thread(nullptr), m_monitor_thread(nullptr), m_pid(pid), m_terminal_fd(-1), m_operation(0) {
using namespace std::placeholders;
sem_init(&m_operation_pending, 0, 0);
@@ -776,7 +776,7 @@ ProcessMonitor::ProcessMonitor(ProcessFr
m_monitor_thread = Host::StartMonitoringChildProcess(
std::bind(&ProcessMonitor::MonitorCallback, this, _1, _2, _3, _4),
GetPID(), true);
- if (!m_monitor_thread.IsJoinable()) {
+ if (!m_monitor_thread->IsJoinable()) {
error.SetErrorToGenericError();
error.SetErrorString("Process attach failed.");
return;
@@ -789,11 +789,13 @@ ProcessMonitor::~ProcessMonitor() { Stop
void ProcessMonitor::StartLaunchOpThread(LaunchArgs *args, Status &error) {
static const char *g_thread_name = "lldb.process.freebsd.operation";
- if (m_operation_thread.IsJoinable())
+ if (m_operation_thread->IsJoinable())
return;
m_operation_thread =
- ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args, &error);
+ ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args);
+ if (!m_operation_thread)
+ error = m_operation_thread.takeError();
}
void *ProcessMonitor::LaunchOpThread(void *arg) {
@@ -955,11 +957,14 @@ void ProcessMonitor::StartAttachOpThread
lldb_private::Status &error) {
static const char *g_thread_name = "lldb.process.freebsd.operation";
- if (m_operation_thread.IsJoinable())
+ if (m_operation_thread->IsJoinable())
return;
m_operation_thread =
- ThreadLauncher::LaunchThread(g_thread_name, AttachOpThread, args, &error);
+ ThreadLauncher::LaunchThread(g_thread_name, AttachOpThread, args);
+
+ if (!m_operation_thread)
+ error = m_operation_thread.takeError();
}
void *ProcessMonitor::AttachOpThread(void *arg) {
@@ -1379,10 +1384,10 @@ bool ProcessMonitor::DupDescriptor(const
}
void ProcessMonitor::StopMonitoringChildProcess() {
- if (m_monitor_thread.IsJoinable()) {
- m_monitor_thread.Cancel();
- m_monitor_thread.Join(nullptr);
- m_monitor_thread.Reset();
+ if (m_monitor_thread->IsJoinable()) {
+ m_monitor_thread->Cancel();
+ m_monitor_thread->Join(nullptr);
+ m_monitor_thread->Reset();
}
}
@@ -1417,10 +1422,10 @@ void ProcessMonitor::StopMonitor() {
bool ProcessMonitor::WaitForInitialTIDStop(lldb::tid_t tid) { return true; }
void ProcessMonitor::StopOpThread() {
- if (!m_operation_thread.IsJoinable())
+ if (!m_operation_thread->IsJoinable())
return;
- m_operation_thread.Cancel();
- m_operation_thread.Join(nullptr);
- m_operation_thread.Reset();
+ m_operation_thread->Cancel();
+ m_operation_thread->Join(nullptr);
+ m_operation_thread->Reset();
}
Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h?rev=365761&r1=365760&r2=365761&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.h Thu Jul 11 05:21:04 2019
@@ -183,8 +183,8 @@ public:
private:
ProcessFreeBSD *m_process;
- lldb_private::HostThread m_operation_thread;
- lldb_private::HostThread m_monitor_thread;
+ llvm::Expected<lldb_private::HostThread> m_operation_thread;
+ llvm::Expected<lldb_private::HostThread> m_monitor_thread;
lldb::pid_t m_pid;
int m_terminal_fd;
More information about the lldb-commits
mailing list