Unify the ExecutionContextScope computation in Materializer.

This is an NFC cleanup for Clang, and a bugfix for the Swift
branch. In swift-lldb one target may have multiple scratch
TypeSystems, so it is important to pick the one that belongs to the
current frame, rather than the one for the current target.

<rdar://problem/65001402>
This commit is contained in:
Adrian Prantl 2020-07-08 14:35:02 -07:00
parent 1bfdf7c7e3
commit 3728133d3f
1 changed files with 12 additions and 5 deletions

View File

@ -785,7 +785,9 @@ public:
const lldb::addr_t load_addr = process_address + m_offset;
ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope();
ExecutionContextScope *exe_scope = frame_sp.get();
if (!exe_scope)
exe_scope = map.GetBestExecutionContextScope();
llvm::Optional<uint64_t> byte_size = m_type.GetByteSize(exe_scope);
if (!byte_size) {
@ -835,7 +837,9 @@ public:
lldb::addr_t frame_bottom, Status &err) override {
err.Clear();
ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope();
ExecutionContextScope *exe_scope = frame_sp.get();
if (!exe_scope)
exe_scope = map.GetBestExecutionContextScope();
if (!exe_scope) {
err.SetErrorString("Couldn't dematerialize a result variable: invalid "
@ -1061,7 +1065,9 @@ public:
const Address sym_address = m_symbol.GetAddress();
ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope();
ExecutionContextScope *exe_scope = frame_sp.get();
if (!exe_scope)
exe_scope = map.GetBestExecutionContextScope();
lldb::TargetSP target_sp;
@ -1342,7 +1348,6 @@ Materializer::DematerializerSP
Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, Status &error) {
ExecutionContextScope *exe_scope = frame_sp.get();
if (!exe_scope)
exe_scope = map.GetBestExecutionContextScope();
@ -1393,7 +1398,9 @@ void Materializer::Dematerializer::Dematerialize(Status &error,
if (thread_sp)
frame_sp = thread_sp->GetFrameWithStackID(m_stack_id);
ExecutionContextScope *exe_scope = m_map->GetBestExecutionContextScope();
ExecutionContextScope *exe_scope = frame_sp.get();
if (!exe_scope)
exe_scope = m_map->GetBestExecutionContextScope();
if (!IsValid()) {
error.SetErrorToGenericError();