llvm / llvm/llvm-project

[lldb] Multiple SBDebugger should be safe to use from different threads

Open
#197,792 3 comments 0 reactions 1 assignee Claimed by @JDevlieghere View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

LLDB was designed to support multiple SBDebugger instances being used concurrently by different threads. The thread safety guarantee doesn't extend to LLDB's internal objects (such as SBTarget, SBProcess, etc) which are **not** individually thread-safe. In other words, multiple debuggers from multiple threads is safe as long as each debugger (and the objects it hands out) are owned and used by exactly one thread at a time. If you need to call into one debugger from multiple threads, you must serialize access yourself (e.g., with a mutex).

I have an (internal) reproducer that pressure tests this premise and shows that this is not currently the case. I'm using this issue to track the various issues that I'm uncovering that should get us to the situation described above.

rdar://151779712

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.