[Lldb-commits] [lldb] r335132 - Make sure TestNumThreads works with libc++
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 20 07:54:34 PDT 2018
Author: labath
Date: Wed Jun 20 07:54:34 2018
New Revision: 335132
URL: http://llvm.org/viewvc/llvm-project?rev=335132&view=rev
Log:
Make sure TestNumThreads works with libc++
The problem was that with libc++ the std::unique_lock declaration was
completely inlined, so there was no line table entry in the main.cpp
file to set a breakpoint on. Therefore, the breakpoint got moved to the
next line, but that meant the test would deadlock as the thread would
stop with the lock already held.
I fix that issue by adding a dummy statement before the std::unique_lock
line to anchor the breakpoint.
I think this should fix the issue because of which this test was
disabled on darwin, but someone should verify that before enabling it.
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py?rev=335132&r1=335131&r2=335132&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py Wed Jun 20 07:54:34 2018
@@ -16,13 +16,14 @@ import lldbsuite.test.lldbutil as lldbut
class NumberOfThreadsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line numbers for our break points.
self.thread3_notify_all_line = line_number('main.cpp', '// Set thread3 break point on notify_all at this line.')
- self.thread3_before_lock_line = line_number('main.cpp', '// Set thread3 break point on lock at this line.')
+ self.thread3_before_lock_line = line_number('main.cpp', '// thread3-before-lock')
def test_number_of_threads(self):
"""Test number of threads."""
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp?rev=335132&r1=335131&r2=335132&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp Wed Jun 20 07:54:34 2018
@@ -12,7 +12,10 @@ void *
thread3(void *input)
{
pseudo_barrier_wait(thread3_barrier);
- std::unique_lock<std::mutex> lock(mutex); // Set thread3 break point on lock at this line.
+
+ int dummy = 47; // thread3-before-lock
+
+ std::unique_lock<std::mutex> lock(mutex);
cond.notify_all(); // Set thread3 break point on notify_all at this line.
return NULL;
}
More information about the lldb-commits
mailing list