[Lldb-commits] [lldb] [lldb] Emit a progress event from the source manager (PR #165802)
Igor Kudrin via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 25 19:04:33 PDT 2026
igorkudrin wrote:
Hi @JDevlieghere, this patch causes `lldb` to hang in a deadlock when it tries to read a file that does not exist:
```
> echo "int main(){}" > test.c
> clang -g test.c -o test.out
> rm test.c
> lldb test.out
(lldb) br set -p "any"
```
Here are the essential steps of the call chain that lead to the deadlock:
* `SearchFilter::DoModuleIteration()` iterates over modules with an iterator created by `m_target_sp->GetImages().Modules()`, which holds the `m_modules_mutex` mutex.
* `BreakpointResolverFileRegex::SearchCallback()` calls `SourceManager::FindLinesMatchingRegex()`, which creates a new `SourceManager::File`.
* `SourceManager::File::CommonInitializer()` calls `CommonInitializerImpl()` asynchronously, i.e. in a background thread.
* If the file does not exist, `SourceManager::File::CommonInitializerImpl()` may end up calling `target_sp->GetImages().ResolveSymbolContextForFilePath()` or `target_sp->GetImages().FindSourceFile(file_spec, new_spec)` which lock the same mutex.
Could you take a look?
https://github.com/llvm/llvm-project/pull/165802
More information about the lldb-commits
mailing list