[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 24 02:40:48 PDT 2017


labath added a comment.

Thanks for writing the test. We just need to make sure it runs in a stable manner.



================
Comment at: packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py:91
+        # thread3 function. All of these threads should show as one stack.
+        self.expect("thread backtrace unique",
+                    "Backtrace with unique stack shown correctly",
----------------
I am afraid this is going to be very flaky. There's no guarantee that the threads will have had enough time to block in the `lock` call by the time you reach the breakpoint. The simplest solution would be to insert a sufficiently long  (a couple of seconds) sleep in the inferior, but smarter positions are possible as well. For example, we could iterate through all SBThreads in the process and manually issue a Continue on all of them who haven't hit our predefined breakpoints yet.


================
Comment at: packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp:52
     thread_1.join();
-    thread_3.join();
+    std::for_each(thread_3s.begin(),
+                  thread_3s.end(),
----------------
I'd find `for(auto &t: thread_3s) t.join()` more understandable than this.


https://reviews.llvm.org/D33426





More information about the lldb-commits mailing list