[all-commits] [llvm/llvm-project] 8f8e2b: [lldb] Improve locking in PathMappingLists (NFC) (...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Mon Nov 4 11:55:33 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f8e2b732635f03dc646a3c98db0b58a051745b8
      https://github.com/llvm/llvm-project/commit/8f8e2b732635f03dc646a3c98db0b58a051745b8
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2024-11-04 (Mon, 04 Nov 2024)

  Changed paths:
    M lldb/include/lldb/Target/PathMappingList.h
    M lldb/source/Target/PathMappingList.cpp

  Log Message:
  -----------
  [lldb] Improve locking in PathMappingLists (NFC) (#114576)

In [D148380](https://reviews.llvm.org/D148380), Alex added locking to
PathMappingLists. The current implementation runs the callback under the
lock, which I don't believe is necessary. As far as I can tell, no users
of the callback are relying on the list not having been modified until
the callback is handled.

This patch implements my suggestion to unlock the mutex before the
callback. I also switched to a non-recursive mutex as I don't believe
the recursive property is needed. To make the class fully thread safe, I
did have to introduce another mutex to protect the callback members.

The motivation for this change is #114507. Specifically,
Target::SetExecutableModule calls Target::GetOrCreateModule, which
potentially performs path remapping, which in turns has a callback to
Target::SetExecutableModule.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list