[Lldb-commits] [lldb] [lldb] Improve locking in PathMappingLists (NFC) (PR #114576)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 6 12:38:08 PST 2024


================
@@ -264,34 +288,35 @@ PathMappingList::FindFile(const FileSpec &orig_spec) const {
 
 bool PathMappingList::Replace(llvm::StringRef path, llvm::StringRef new_path,
                               bool notify) {
-  std::lock_guard<std::recursive_mutex> lock(m_mutex);
-  uint32_t idx = FindIndexForPath(path);
-  if (idx < m_pairs.size()) {
+  {
+    std::lock_guard<std::mutex> lock(m_pairs_mutex);
+    uint32_t idx = FindIndexForPath(path);
----------------
kastiglione wrote:

@JDevlieghere  It seems these two lines lead to deadlock. `FindIndexForPath` attempts to lock `m_pairs_mutex` too, but can't.

https://github.com/llvm/llvm-project/pull/114576


More information about the lldb-commits mailing list