[Lldb-commits] [lldb] Convert the StackFrameList mutex to a shared mutex. (PR #117252)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 10 07:54:27 PST 2024
================
@@ -119,6 +120,7 @@ bool StackFrameList::DecrementCurrentInlinedDepth() {
uint32_t current_inlined_depth = GetCurrentInlinedDepth();
if (current_inlined_depth != UINT32_MAX) {
if (current_inlined_depth > 0) {
+ std::lock_guard<std::mutex> guard(m_inlined_depth_mutex);
----------------
labath wrote:
I'm also very suspicious of code like this. It may be enough to make thread sanitizer happy (as there to longer a *data* race on the variable), but I doubt that it makes the code surrounding this this function race-free. Like, if there are multiple callers of this function they could both conclude that `current_inlined_depth` is greater than zero, and then both decrement (and overflow) it. And if there can't be multiple parallel callers, then what's the mutex for?
At the very least, I think the mutex should cover the whole function, but maybe this even needs synchronization at a higher level. Also, I know this is somehow related to the mutex switch in `ResetCurrentInlinedDepth`, but is there any way this could be a separate patch?
https://github.com/llvm/llvm-project/pull/117252
More information about the lldb-commits
mailing list