[Lldb-commits] [lldb] [lldb][plugin] Clear in same thread as set (PR #139252)
Jacques Pienaar via lldb-commits
lldb-commits at lists.llvm.org
Sun May 11 22:27:10 PDT 2025
https://github.com/jpienaar updated https://github.com/llvm/llvm-project/pull/139252
>From c5ffbd84f8b68bae2112e8cec68803cefe571a72 Mon Sep 17 00:00:00 2001
From: Jacques Pienaar <jpienaar at google.com>
Date: Fri, 9 May 2025 05:23:00 -0700
Subject: [PATCH 1/2] [lldb][plugin] Clear in same thread as set
Here we were initializing & locking a mutex in a thread, while releasing it in the parent which may/often turned out to be a different thread (shared_mutex::unlock_shared is undefined behavior if called from a thread that doesn't hold the lock).
I'm not quite sure what the expectation is here as the variable is never used, so instead I've just reset in same thread as which it was set to ensure its freed in thread holding lock.
---
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 523820874752a..0f0226ea9650c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -121,6 +121,7 @@ void ManualDWARFIndex::Index() {
units_to_index.size());
for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) {
clear_cu_dies[idx] = unit->ExtractDIEsScoped();
+ ckear_cu_duex[idx].reset();
});
// Now index all DWARF unit in parallel.
>From 5f5b8dc0deae4f63ddb83e0dfab96ab3a9e0cc80 Mon Sep 17 00:00:00 2001
From: Jacques Pienaar <jpienaar at google.com>
Date: Fri, 9 May 2025 08:15:26 -0700
Subject: [PATCH 2/2] Fix typo
---
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 0f0226ea9650c..6139d005b4f2e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -121,7 +121,7 @@ void ManualDWARFIndex::Index() {
units_to_index.size());
for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) {
clear_cu_dies[idx] = unit->ExtractDIEsScoped();
- ckear_cu_duex[idx].reset();
+ ckear_cu_dies[idx].reset();
});
// Now index all DWARF unit in parallel.
More information about the lldb-commits
mailing list