diff options
author | Tatyana Krasnukha <tatyana@synopsys.com> | 2021-02-01 22:24:30 +0300 |
---|---|---|
committer | Tatyana Krasnukha <tatyana@synopsys.com> | 2021-02-08 15:09:08 +0300 |
commit | a39bcbca92e169baeb8b2c55dff90141ddd53888 (patch) | |
tree | 20a1cd1a5cc22268f29ff47eb9d0a505f31c3e4c /lldb | |
parent | f89f6d1e5d7d9cefd9e1d4c7a17afb53245a1fa8 (diff) | |
download | llvm-a39bcbca92e169baeb8b2c55dff90141ddd53888.zip llvm-a39bcbca92e169baeb8b2c55dff90141ddd53888.tar.gz llvm-a39bcbca92e169baeb8b2c55dff90141ddd53888.tar.bz2 |
[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.
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index b16ce68..1294b60 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() { |