[Lldb-commits] [lldb] a39bcbc - [lldb] Debugger: reuse ExecutionContextRef to create ExecutionContext from Target
Tatyana Krasnukha via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 8 04:13:01 PST 2021
Author: Tatyana Krasnukha
Date: 2021-02-08T15:09:08+03:00
New Revision: a39bcbca92e169baeb8b2c55dff90141ddd53888
URL: https://github.com/llvm/llvm-project/commit/a39bcbca92e169baeb8b2c55dff90141ddd53888
DIFF: https://github.com/llvm/llvm-project/commit/a39bcbca92e169baeb8b2c55dff90141ddd53888.diff
LOG: [lldb] Debugger: reuse ExecutionContextRef to create ExecutionContext from Target
The Debugger didn't take the Process's run lock, that causes deadlocks and races
after applying https://reviews.llvm.org/D92164 revision. Since ExecutionContextRef
does the same job correctly, Debugger::GetSelectedExecutionContext just can use it
to build execution context upon the selected target.
Added:
Modified:
lldb/source/Core/Debugger.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index b16ce68c2fd2..1294b600c611 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -816,24 +816,9 @@ void Debugger::SaveInputTerminalState() {
void Debugger::RestoreInputTerminalState() { m_terminal_state.Restore(); }
ExecutionContext Debugger::GetSelectedExecutionContext() {
- ExecutionContext exe_ctx;
- TargetSP target_sp(GetSelectedTarget());
- exe_ctx.SetTargetSP(target_sp);
-
- if (target_sp) {
- ProcessSP process_sp(target_sp->GetProcessSP());
- exe_ctx.SetProcessSP(process_sp);
- if (process_sp && !process_sp->IsRunning()) {
- ThreadSP thread_sp(process_sp->GetThreadList().GetSelectedThread());
- if (thread_sp) {
- exe_ctx.SetThreadSP(thread_sp);
- exe_ctx.SetFrameSP(thread_sp->GetSelectedFrame());
- if (exe_ctx.GetFramePtr() == nullptr)
- exe_ctx.SetFrameSP(thread_sp->GetStackFrameAtIndex(0));
- }
- }
- }
- return exe_ctx;
+ bool adopt_selected = true;
+ ExecutionContextRef exe_ctx_ref(GetSelectedTarget().get(), adopt_selected);
+ return ExecutionContext(exe_ctx_ref);
}
void Debugger::DispatchInputInterrupt() {
More information about the lldb-commits
mailing list