Skip to content

Commit c416034

Browse files
[lldb][NFC] Address follow up comments in ExecutionContext (llvm#153110)
The PR llvm#152020 got merged by accident. This commit addresses some follow up review comments.
1 parent 3f6c0e6 commit c416034

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lldb/include/lldb/Target/ExecutionContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,9 @@ struct StoppedExecutionContext : ExecutionContext {
592592
}
593593

594594
/// Clears this context, unlocking the ProcessRunLock and returning the
595-
/// locked API lock. Like after a move operation, this object is no longer
596-
/// usable.
597-
[[nodiscard]] std::unique_lock<std::recursive_mutex> Destroy();
595+
/// locked API lock, allowing callers to resume the process. Similar to
596+
/// a move operation, this object is no longer usable.
597+
[[nodiscard]] std::unique_lock<std::recursive_mutex> AllowResume();
598598

599599
private:
600600
std::unique_lock<std::recursive_mutex> m_api_lock;

lldb/source/API/SBThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static Status ResumeNewPlan(StoppedExecutionContext exe_ctx,
525525
process->GetThreadList().SetSelectedThreadByID(thread->GetID());
526526

527527
// Release the run lock but keep the API lock.
528-
std::unique_lock<std::recursive_mutex> api_lock = exe_ctx.Destroy();
528+
std::unique_lock<std::recursive_mutex> api_lock = exe_ctx.AllowResume();
529529
if (process->GetTarget().GetDebugger().GetAsyncExecution())
530530
return process->Resume();
531531
return process->ResumeSynchronous(nullptr);

lldb/source/Target/ExecutionContext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,33 +138,33 @@ lldb_private::GetStoppedExecutionContext(
138138
const ExecutionContextRef *exe_ctx_ref_ptr) {
139139
if (!exe_ctx_ref_ptr)
140140
return llvm::createStringError(
141-
"ExecutionContext created with an empty ExecutionContextRef");
141+
"StoppedExecutionContext created with an empty ExecutionContextRef");
142142

143143
lldb::TargetSP target_sp = exe_ctx_ref_ptr->GetTargetSP();
144144
if (!target_sp)
145145
return llvm::createStringError(
146-
"ExecutionContext created with a null target");
146+
"StoppedExecutionContext created with a null target");
147147

148148
auto api_lock =
149149
std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
150150

151151
auto process_sp = exe_ctx_ref_ptr->GetProcessSP();
152152
if (!process_sp)
153153
return llvm::createStringError(
154-
"ExecutionContext created with a null process");
154+
"StoppedExecutionContext created with a null process");
155155

156156
ProcessRunLock::ProcessRunLocker stop_locker;
157157
if (!stop_locker.TryLock(&process_sp->GetRunLock()))
158158
return llvm::createStringError(
159-
"attempted to create an ExecutionContext with a running process");
159+
"attempted to create a StoppedExecutionContext with a running process");
160160

161161
auto thread_sp = exe_ctx_ref_ptr->GetThreadSP();
162162
auto frame_sp = exe_ctx_ref_ptr->GetFrameSP();
163163
return StoppedExecutionContext(target_sp, process_sp, thread_sp, frame_sp,
164164
std::move(api_lock), std::move(stop_locker));
165165
}
166166

167-
std::unique_lock<std::recursive_mutex> StoppedExecutionContext::Destroy() {
167+
std::unique_lock<std::recursive_mutex> StoppedExecutionContext::AllowResume() {
168168
Clear();
169169
m_stop_locker = ProcessRunLock::ProcessRunLocker();
170170
return std::move(m_api_lock);

0 commit comments

Comments
 (0)