Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify the ExecutionContextScope computation in Materializer. #1431

Merged
Merged
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
17 changes: 12 additions & 5 deletions lldb/source/Expression/Materializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,9 @@ class EntityResultVariable : public Materializer::Entity {

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) {
Expand Down Expand Up @@ -834,7 +836,9 @@ class EntityResultVariable : public Materializer::Entity {
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 "
Expand Down Expand Up @@ -1062,7 +1066,9 @@ class EntitySymbol : public Materializer::Entity {

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;

Expand Down Expand Up @@ -1346,7 +1352,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();

Expand Down Expand Up @@ -1397,7 +1402,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();
Expand Down