[Lldb-commits] [PATCH] D68762: [LLDB] Fix when building with strict LLVM assertion checking on FreeBSD

David CARLIER via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 23:05:46 PDT 2019


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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68762.224253.patch
Type: text/x-patch
Size: 1627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191010/83e1ec26/attachment.bin>


More information about the lldb-commits mailing list