[Lldb-commits] [PATCH] D79308: [lldb-server] Reset stop reason of all threads when resuming

Jaroslav Sevcik via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 4 05:18:19 PDT 2020


jarin added a comment.

In D79308#2017348 <https://reviews.llvm.org/D79308#2017348>, @labath wrote:

> The test setup here seems unnecessarily complex. Wouldn't an inferior like this work better?
>
>   void thread1() {
>     pseudo_barrier_wait(g_barrier); // See other tests how this works.
>     g_foo = 0; // break_here
>   }
>   int main() {
>     pseudo_barrier_init(g_barrier1, 2);
>     std::thread t1(thread1);
>     pseudo_barrier_wait(g_barrier);
>     for (int i = 0; i<10000; ++i) g_bar = i; // empty loop to have something to step over
>     t1.join();
>   }
>
>
> That way you always know only one thread will hit a breakpoint, and and you can just pick the "other" thread as the target for stepping.


Yeah, I considered something like that, but then I thought it would be better if the "other" thread only runs code that we completely control. In my patch, the "other" thread is guaranteed to be in thread_func after we hit the breakpoint. In your suggested inferior, it could be still in pseudo_barrier_wait. If you feel stepping in external code is safe, I am happy to rewrite the test to the simpler version.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79308/new/

https://reviews.llvm.org/D79308





More information about the lldb-commits mailing list