@@ -784,7 +784,9 @@ class EntityResultVariable : public Materializer::Entity {
784784
785785 const lldb::addr_t load_addr = process_address + m_offset;
786786
787- ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope ();
787+ ExecutionContextScope *exe_scope = frame_sp.get ();
788+ if (!exe_scope)
789+ exe_scope = map.GetBestExecutionContextScope ();
788790
789791 llvm::Optional<uint64_t > byte_size = m_type.GetByteSize (exe_scope);
790792 if (!byte_size) {
@@ -834,7 +836,9 @@ class EntityResultVariable : public Materializer::Entity {
834836 lldb::addr_t frame_bottom, Status &err) override {
835837 err.Clear ();
836838
837- ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope ();
839+ ExecutionContextScope *exe_scope = frame_sp.get ();
840+ if (!exe_scope)
841+ exe_scope = map.GetBestExecutionContextScope ();
838842
839843 if (!exe_scope) {
840844 err.SetErrorString (" Couldn't dematerialize a result variable: invalid "
@@ -1062,7 +1066,9 @@ class EntitySymbol : public Materializer::Entity {
10621066
10631067 const Address sym_address = m_symbol.GetAddress ();
10641068
1065- ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope ();
1069+ ExecutionContextScope *exe_scope = frame_sp.get ();
1070+ if (!exe_scope)
1071+ exe_scope = map.GetBestExecutionContextScope ();
10661072
10671073 lldb::TargetSP target_sp;
10681074
@@ -1346,7 +1352,6 @@ Materializer::DematerializerSP
13461352Materializer::Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
13471353 lldb::addr_t process_address, Status &error) {
13481354 ExecutionContextScope *exe_scope = frame_sp.get ();
1349-
13501355 if (!exe_scope)
13511356 exe_scope = map.GetBestExecutionContextScope ();
13521357
@@ -1397,7 +1402,9 @@ void Materializer::Dematerializer::Dematerialize(Status &error,
13971402 if (thread_sp)
13981403 frame_sp = thread_sp->GetFrameWithStackID (m_stack_id);
13991404
1400- ExecutionContextScope *exe_scope = m_map->GetBestExecutionContextScope ();
1405+ ExecutionContextScope *exe_scope = frame_sp.get ();
1406+ if (!exe_scope)
1407+ exe_scope = m_map->GetBestExecutionContextScope ();
14011408
14021409 if (!IsValid ()) {
14031410 error.SetErrorToGenericError ();
0 commit comments