[Lldb-commits] [lldb] [lldb] Guard SBFrame/SBThread methods against running processes (PR #152020)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 4 16:57:33 PDT 2025
================
@@ -233,6 +233,10 @@ class LLDB_API SBFrame {
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp);
+ /// Return an SBValue with an error message warning that the process is not
+ /// currently stopped.
----------------
jimingham wrote:
At the SB API level, if you are getting the ExecutionContext from an ExecutionContextRef represented by a Target, Process, Thread or Frame you should also hold the API mutex. There are some cases where we don't actually require a process. For instance SBTarget::CreateValueFromAddress can work on either a live process that's stopped or to look at static data on a non-running target. But those seem like they are in the minority, and in that case, for instance, you could easily do:
if (!process || stop_locker.IsLocked())
so that wouldn't be particularly awkward.
I can't think of a good reason why you would want to drop the API lock before the stop lock or vice versa. There's the one place where Felipe swaps the stop_locker originally set for another, so long as this doesn't make that particularly awkward, this seems doable.
https://github.com/llvm/llvm-project/pull/152020
More information about the lldb-commits
mailing list