[Lldb-commits] [PATCH] D129012: [lldb] [test] Improve stability of llgs vCont-threads tests

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 6 06:34:32 PDT 2022


mgorny marked an inline comment as done.
mgorny added a comment.

In D129012#3631985 <https://reviews.llvm.org/D129012#3631985>, @labath wrote:

> I can also imagine a setup where most of the verification happens inside the inferior. Like, each time a thread gets to run it increments a variable specific to that thread. Once that number crosses some threshold, it check the variables of the other threads, and verifies that one of them has the number zero, and the number of the other thread is reasonably high (> 10% of the threshold or something).

I suppose this would be possible but tbh I think it'd be more complex than the current solution.



================
Comment at: lldb/test/API/tools/lldb-server/vCont-threads/main.cpp:32
+                  get_thread_id());
+    write(STDOUT_FILENO, buf, strlen(buf));
+
----------------
labath wrote:
> I am not sure if `write` is an (atomic) system call on windows. Maybe just put a mutex around the printf call? In this setup, I think it would be sufficient to write this once, and then spend the rest of the time making sure the other suspended thread gets a chance to run (if it is not suspended for whatever reason).
For some reason, I've assumed we're avoiding mutexes. However, this certainly makes sense, as well as removing duplicate writes. I've also noticed we had a race condition between starting prints and SIGSTOP, so I've fixed that too. Now the main thread is always resumed.


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

https://reviews.llvm.org/D129012



More information about the lldb-commits mailing list