[Lldb-commits] [PATCH] D14201: Fix race during process detach

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 3 08:07:50 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL251932: Fix race during process detach (authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D14201?vs=38806&id=39068#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14201

Files:
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
  lldb/trunk/source/Target/Process.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
@@ -20,7 +20,6 @@
     @skipIfRemote
     @expectedFailureFreeBSD('llvm.org/pr19310')
     @expectedFailureWindows("llvm.org/pr24778")
-    @expectedFlakeyLinux('llvm.org/pr19310')
     def test_attach_continue_interrupt_detach(self):
         """Test attach/continue/interrupt/detach"""
         self.build()
Index: lldb/trunk/source/Target/Process.cpp
===================================================================
--- lldb/trunk/source/Target/Process.cpp
+++ lldb/trunk/source/Target/Process.cpp
@@ -1565,41 +1565,38 @@
                 // Don't call into the OperatingSystem to update the thread list if we are shutting down, since
                 // that may call back into the SBAPI's, requiring the API lock which is already held by whoever is
                 // shutting us down, causing a deadlock.
-                if (!m_destroy_in_process)
+                OperatingSystem *os = GetOperatingSystem ();
+                if (os && !m_destroy_in_process)
                 {
-                    OperatingSystem *os = GetOperatingSystem ();
-                    if (os)
-                    {
-                        // Clear any old backing threads where memory threads might have been
-                        // backed by actual threads from the lldb_private::Process subclass
-                        size_t num_old_threads = old_thread_list.GetSize(false);
-                        for (size_t i=0; i<num_old_threads; ++i)
-                            old_thread_list.GetThreadAtIndex(i, false)->ClearBackingThread();
-
-                        // Turn off dynamic types to ensure we don't run any expressions. Objective C
-                        // can run an expression to determine if a SBValue is a dynamic type or not
-                        // and we need to avoid this. OperatingSystem plug-ins can't run expressions
-                        // that require running code...
-
-                        Target &target = GetTarget();
-                        const lldb::DynamicValueType saved_prefer_dynamic = target.GetPreferDynamicValue ();
-                        if (saved_prefer_dynamic != lldb::eNoDynamicValues)
-                            target.SetPreferDynamicValue(lldb::eNoDynamicValues);
-
-                        // Now let the OperatingSystem plug-in update the thread list
-
-                        os->UpdateThreadList (old_thread_list,  // Old list full of threads created by OS plug-in
-                                              real_thread_list, // The actual thread list full of threads created by each lldb_private::Process subclass
-                                              new_thread_list); // The new thread list that we will show to the user that gets filled in
+                    // Clear any old backing threads where memory threads might have been
+                    // backed by actual threads from the lldb_private::Process subclass
+                    size_t num_old_threads = old_thread_list.GetSize(false);
+                    for (size_t i=0; i<num_old_threads; ++i)
+                        old_thread_list.GetThreadAtIndex(i, false)->ClearBackingThread();
+
+                    // Turn off dynamic types to ensure we don't run any expressions. Objective C
+                    // can run an expression to determine if a SBValue is a dynamic type or not
+                    // and we need to avoid this. OperatingSystem plug-ins can't run expressions
+                    // that require running code...
+
+                    Target &target = GetTarget();
+                    const lldb::DynamicValueType saved_prefer_dynamic = target.GetPreferDynamicValue ();
+                    if (saved_prefer_dynamic != lldb::eNoDynamicValues)
+                        target.SetPreferDynamicValue(lldb::eNoDynamicValues);
+
+                    // Now let the OperatingSystem plug-in update the thread list
+
+                    os->UpdateThreadList (old_thread_list,  // Old list full of threads created by OS plug-in
+                                          real_thread_list, // The actual thread list full of threads created by each lldb_private::Process subclass
+                                          new_thread_list); // The new thread list that we will show to the user that gets filled in
 
-                        if (saved_prefer_dynamic != lldb::eNoDynamicValues)
-                            target.SetPreferDynamicValue(saved_prefer_dynamic);
-                    }
-                    else
-                    {
-                        // No OS plug-in, the new thread list is the same as the real thread list
-                        new_thread_list = real_thread_list;
-                    }
+                    if (saved_prefer_dynamic != lldb::eNoDynamicValues)
+                        target.SetPreferDynamicValue(saved_prefer_dynamic);
+                }
+                else
+                {
+                    // No OS plug-in, the new thread list is the same as the real thread list
+                    new_thread_list = real_thread_list;
                 }
                 
                 m_thread_list_real.Update(real_thread_list);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14201.39068.patch
Type: text/x-patch
Size: 5517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151103/bdfd0262/attachment.bin>


More information about the lldb-commits mailing list