diff options
Diffstat (limited to 'lldb/source/Expression/Materializer.cpp')
-rw-r--r-- | lldb/source/Expression/Materializer.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index cd332484debbc..f33462053f22a 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -1,4 +1,4 @@ -//===-- Materializer.cpp ----------------------------------------*- C++ -*-===// +//===-- Materializer.cpp --------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -399,7 +399,8 @@ uint32_t Materializer::AddPersistentVariable( lldb::ExpressionVariableSP &persistent_variable_sp, PersistentVariableDelegate *delegate, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); - iter->reset(new EntityPersistentVariable(persistent_variable_sp, delegate)); + *iter = std::make_unique<EntityPersistentVariable>(persistent_variable_sp, + delegate); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; @@ -698,7 +699,7 @@ public: lldb::offset_t offset; - ptr = extractor.GetPointer(&offset); + ptr = extractor.GetAddress(&offset); dump_stream.PutChar('\n'); } @@ -752,7 +753,7 @@ private: uint32_t Materializer::AddVariable(lldb::VariableSP &variable_sp, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); - iter->reset(new EntityVariable(variable_sp)); + *iter = std::make_unique<EntityVariable>(variable_sp); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; @@ -784,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) { @@ -834,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 " @@ -881,11 +886,9 @@ public: return; } - ConstString name = - m_delegate - ? m_delegate->GetName() - : persistent_state->GetNextPersistentVariableName( - *target_sp, persistent_state->GetPersistentVariablePrefix()); + ConstString name = m_delegate + ? m_delegate->GetName() + : persistent_state->GetNextPersistentVariableName(); lldb::ExpressionVariableSP ret = persistent_state->CreatePersistentVariable( exe_scope, name, m_type, map.GetByteOrder(), map.GetAddressByteSize()); @@ -972,7 +975,7 @@ public: lldb::offset_t offset; - ptr = extractor.GetPointer(&offset); + ptr = extractor.GetAddress(&offset); dump_stream.PutChar('\n'); } @@ -1032,8 +1035,8 @@ uint32_t Materializer::AddResultVariable(const CompilerType &type, PersistentVariableDelegate *delegate, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); - iter->reset(new EntityResultVariable(type, is_program_reference, - keep_in_memory, delegate)); + *iter = std::make_unique<EntityResultVariable>(type, is_program_reference, + keep_in_memory, delegate); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; @@ -1062,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; @@ -1149,7 +1154,7 @@ private: uint32_t Materializer::AddSymbol(const Symbol &symbol_sp, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); - iter->reset(new EntitySymbol(symbol_sp)); + *iter = std::make_unique<EntitySymbol>(symbol_sp); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; @@ -1326,15 +1331,12 @@ private: uint32_t Materializer::AddRegister(const RegisterInfo ®ister_info, Status &err) { EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP()); - iter->reset(new EntityRegister(register_info)); + *iter = std::make_unique<EntityRegister>(register_info); uint32_t ret = AddStructMember(**iter); (*iter)->SetOffset(ret); return ret; } -Materializer::Materializer() - : m_dematerializer_wp(), m_current_offset(0), m_struct_alignment(8) {} - Materializer::~Materializer() { DematerializerSP dematerializer_sp = m_dematerializer_wp.lock(); @@ -1346,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(); @@ -1397,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(); |