diff --git a/lldb/include/lldb/Target/ExecutionContext.h b/lldb/include/lldb/Target/ExecutionContext.h index a0b064a51cec4..f105e38fa69aa 100644 --- a/lldb/include/lldb/Target/ExecutionContext.h +++ b/lldb/include/lldb/Target/ExecutionContext.h @@ -592,9 +592,9 @@ struct StoppedExecutionContext : ExecutionContext { } /// Clears this context, unlocking the ProcessRunLock and returning the - /// locked API lock. Like after a move operation, this object is no longer - /// usable. - [[nodiscard]] std::unique_lock Destroy(); + /// locked API lock, allowing callers to resume the process. Similar to + /// a move operation, this object is no longer usable. + [[nodiscard]] std::unique_lock AllowResume(); private: std::unique_lock m_api_lock; diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index b07611d388fb6..ec68b2a4b6f31 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -525,7 +525,7 @@ static Status ResumeNewPlan(StoppedExecutionContext exe_ctx, process->GetThreadList().SetSelectedThreadByID(thread->GetID()); // Release the run lock but keep the API lock. - std::unique_lock api_lock = exe_ctx.Destroy(); + std::unique_lock api_lock = exe_ctx.AllowResume(); if (process->GetTarget().GetDebugger().GetAsyncExecution()) return process->Resume(); return process->ResumeSynchronous(nullptr); diff --git a/lldb/source/Target/ExecutionContext.cpp b/lldb/source/Target/ExecutionContext.cpp index 7dc847e097bf8..9d232e420f71c 100644 --- a/lldb/source/Target/ExecutionContext.cpp +++ b/lldb/source/Target/ExecutionContext.cpp @@ -138,12 +138,12 @@ lldb_private::GetStoppedExecutionContext( const ExecutionContextRef *exe_ctx_ref_ptr) { if (!exe_ctx_ref_ptr) return llvm::createStringError( - "ExecutionContext created with an empty ExecutionContextRef"); + "StoppedExecutionContext created with an empty ExecutionContextRef"); lldb::TargetSP target_sp = exe_ctx_ref_ptr->GetTargetSP(); if (!target_sp) return llvm::createStringError( - "ExecutionContext created with a null target"); + "StoppedExecutionContext created with a null target"); auto api_lock = std::unique_lock(target_sp->GetAPIMutex()); @@ -151,12 +151,12 @@ lldb_private::GetStoppedExecutionContext( auto process_sp = exe_ctx_ref_ptr->GetProcessSP(); if (!process_sp) return llvm::createStringError( - "ExecutionContext created with a null process"); + "StoppedExecutionContext created with a null process"); ProcessRunLock::ProcessRunLocker stop_locker; if (!stop_locker.TryLock(&process_sp->GetRunLock())) return llvm::createStringError( - "attempted to create an ExecutionContext with a running process"); + "attempted to create a StoppedExecutionContext with a running process"); auto thread_sp = exe_ctx_ref_ptr->GetThreadSP(); auto frame_sp = exe_ctx_ref_ptr->GetFrameSP(); @@ -164,7 +164,7 @@ lldb_private::GetStoppedExecutionContext( std::move(api_lock), std::move(stop_locker)); } -std::unique_lock StoppedExecutionContext::Destroy() { +std::unique_lock StoppedExecutionContext::AllowResume() { Clear(); m_stop_locker = ProcessRunLock::ProcessRunLocker(); return std::move(m_api_lock);