[all-commits] [llvm/llvm-project] 862a31: [lldb] Tighten lock in Language::ForEach

Alex via All-commits all-commits at lists.llvm.org
Tue Aug 31 15:47:49 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 862a311301f51214d405eefd5bc4aa7289241f86
      https://github.com/llvm/llvm-project/commit/862a311301f51214d405eefd5bc4aa7289241f86
  Author: Alex Langford <apl at fb.com>
  Date:   2021-08-31 (Tue, 31 Aug 2021)

  Changed paths:
    M lldb/source/Target/Language.cpp

  Log Message:
  -----------
  [lldb] Tighten lock in Language::ForEach

It is easy to accidentally introduce a deadlock by having the callback
passed to Language::ForEach also attempt to acquire the same lock. It
is easy enough to disallow the callback from calling anything in
Language directly, but it may happen through a series of other
function/method calls.

The solution I am proposing is to tighten the lock in Language::ForEach
so that it is only held as we gather the currently loaded language
plugins. We store them in a vector and then iterate through them with
the callback so that the callback can't introduce a deadlock.

Differential Revision: https://reviews.llvm.org/D109013




More information about the All-commits mailing list