Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lldb/include/lldb/Target/ExecutionContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::recursive_mutex> 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<std::recursive_mutex> AllowResume();

private:
std::unique_lock<std::recursive_mutex> m_api_lock;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/API/SBThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::recursive_mutex> api_lock = exe_ctx.Destroy();
std::unique_lock<std::recursive_mutex> api_lock = exe_ctx.AllowResume();
if (process->GetTarget().GetDebugger().GetAsyncExecution())
return process->Resume();
return process->ResumeSynchronous(nullptr);
Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Target/ExecutionContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,33 @@ 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<std::recursive_mutex>(target_sp->GetAPIMutex());

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();
return StoppedExecutionContext(target_sp, process_sp, thread_sp, frame_sp,
std::move(api_lock), std::move(stop_locker));
}

std::unique_lock<std::recursive_mutex> StoppedExecutionContext::Destroy() {
std::unique_lock<std::recursive_mutex> StoppedExecutionContext::AllowResume() {
Clear();
m_stop_locker = ProcessRunLock::ProcessRunLocker();
return std::move(m_api_lock);
Expand Down
Loading