[Lldb-commits] [lldb] [lldb] Guard SBFrame/SBThread methods against running processes (PR #152020)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 5 11:32:27 PDT 2025


================
@@ -125,17 +125,21 @@ ExecutionContext::ExecutionContext(const ExecutionContextRef *exe_ctx_ref_ptr,
   }
 }
 
-ExecutionContext::ExecutionContext(const ExecutionContextRef *exe_ctx_ref_ptr,
-                                   std::unique_lock<std::recursive_mutex> &lock)
+ExecutionContext::ExecutionContext(
+    const ExecutionContextRef *exe_ctx_ref_ptr,
+    std::unique_lock<std::recursive_mutex> &lock,
+    ProcessRunLock::ProcessRunLocker &stop_locker)
     : m_target_sp(), m_process_sp(), m_thread_sp(), m_frame_sp() {
   if (exe_ctx_ref_ptr) {
     m_target_sp = exe_ctx_ref_ptr->GetTargetSP();
     if (m_target_sp) {
       lock = std::unique_lock<std::recursive_mutex>(m_target_sp->GetAPIMutex());
 
       m_process_sp = exe_ctx_ref_ptr->GetProcessSP();
-      m_thread_sp = exe_ctx_ref_ptr->GetThreadSP();
-      m_frame_sp = exe_ctx_ref_ptr->GetFrameSP();
+      if (m_process_sp && stop_locker.TryLock(&m_process_sp->GetRunLock())) {
----------------
felipepiovezan wrote:

I've updated the entire constructor based on the general feedback in this review.

https://github.com/llvm/llvm-project/pull/152020


More information about the lldb-commits mailing list