devnexen created this revision. devnexen added reviewers: dim, jbeich. devnexen created this object with visibility "All Users". Herald added subscribers: lldb-commits, JDevlieghere, emaste. Herald added a project: LLDB. devnexen added a comment.
With this I do not get segfault anymore. @dim I just looked up the patch on FreeBSD, if this approach is preferred, I ll go along. - For reference https://reviews.llvm.org/rL365761 - Plan is to backport to 9.x version Repository: rLLDB LLDB https://reviews.llvm.org/D68762 Files: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp Index: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp =================================================================== --- lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp @@ -730,10 +730,12 @@ } // Finally, start monitoring the child process for change in state. + if (m_monitor_thread) + m_monitor_thread->Reset(); 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 && !m_monitor_thread->IsJoinable()) { error.SetErrorToGenericError(); error.SetErrorString("Process launch failed."); return; @@ -771,7 +773,7 @@ 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 && !m_monitor_thread->IsJoinable()) { error.SetErrorToGenericError(); error.SetErrorString("Process attach failed."); return; @@ -784,9 +786,11 @@ 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 && m_operation_thread->IsJoinable()) return; + if (m_operation_thread) + m_operation_thread->Reset(); m_operation_thread = ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args); if (!m_operation_thread)
Index: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp =================================================================== --- lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp @@ -730,10 +730,12 @@ } // Finally, start monitoring the child process for change in state. + if (m_monitor_thread) + m_monitor_thread->Reset(); 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 && !m_monitor_thread->IsJoinable()) { error.SetErrorToGenericError(); error.SetErrorString("Process launch failed."); return; @@ -771,7 +773,7 @@ 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 && !m_monitor_thread->IsJoinable()) { error.SetErrorToGenericError(); error.SetErrorString("Process attach failed."); return; @@ -784,9 +786,11 @@ 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 && m_operation_thread->IsJoinable()) return; + if (m_operation_thread) + m_operation_thread->Reset(); m_operation_thread = ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args); if (!m_operation_thread)
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits