[Lldb-commits] [PATCH] D116372: [lldb-server/linux] Fix waitpid for multithreaded forks

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 29 11:14:49 PST 2021


mgorny added a comment.

Thank you a lot for doing this. I love how the code becomes simpler, and the cost doesn't seem much.



================
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1909
+             wait_status);
+    tid_events.try_emplace(thread_up->GetID(), wait_status);
+  }
----------------
Hmm, I'm a bit confused here. Why would the key already exist? I mean, you start with empty `tid_events` and catch only one event for every thread, correct?


================
Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1918
+    } else {
+      // This can happen if one of the events is an main thread exit.
+      LLDB_LOG(log, "... but the thread has disappeared");
----------------
Are we talking about some kind of race here? Or some thread that appears in `m_threads` but is not returned by `GetThreadByID()`?

I was wondering if you could use thread pointers as keys.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116372



More information about the lldb-commits mailing list