41 uint32_t size = entity.
GetSize();
63 : Entity(), m_persistent_variable_sp(persistent_variable_sp),
64 m_delegate(delegate) {
78 const bool zero_memory =
false;
81 m_persistent_variable_sp->GetByteSize().value_or(0), 8,
82 lldb::ePermissionsReadable | lldb::ePermissionsWritable,
85 if (!allocate_error.
Success()) {
87 "couldn't allocate a memory area to store %s: %s",
88 m_persistent_variable_sp->GetName().GetCString(),
93 LLDB_LOGF(log,
"Allocated %s (0x%" PRIx64
") successfully",
94 m_persistent_variable_sp->GetName().GetCString(), mem);
101 m_persistent_variable_sp->GetCompilerType(),
107 if (m_persistent_variable_sp->m_flags &
110 map.
Leak(mem, leak_error);
111 m_persistent_variable_sp->m_flags &=
119 map.
WriteMemory(mem, m_persistent_variable_sp->GetValueBytes(),
120 m_persistent_variable_sp->GetByteSize().value_or(0),
125 "couldn't write %s to the target: %s",
126 m_persistent_variable_sp->GetName().AsCString(),
140 m_persistent_variable_sp->m_live_sp.reset();
142 if (!deallocate_error.
Success()) {
144 "couldn't deallocate memory for %s: %s",
145 m_persistent_variable_sp->GetName().GetCString(),
154 const lldb::addr_t load_addr = process_address + m_offset;
158 "EntityPersistentVariable::Materialize [address = 0x%" PRIx64
159 ", m_name = %s, m_flags = 0x%hx]",
161 m_persistent_variable_sp->GetName().AsCString(),
162 m_persistent_variable_sp->m_flags);
165 if (m_persistent_variable_sp->m_flags &
167 MakeAllocation(map, err);
168 m_persistent_variable_sp->m_flags |=
175 if ((m_persistent_variable_sp->m_flags &
177 m_persistent_variable_sp->m_live_sp) ||
178 m_persistent_variable_sp->m_flags &
184 m_persistent_variable_sp->m_live_sp->GetValue().GetScalar(),
189 "couldn't write the location of %s to memory: %s",
190 m_persistent_variable_sp->GetName().AsCString(),
195 "no materialization happened for persistent variable %s",
196 m_persistent_variable_sp->GetName().AsCString());
206 const lldb::addr_t load_addr = process_address + m_offset;
210 "EntityPersistentVariable::Dematerialize [address = 0x%" PRIx64
211 ", m_name = %s, m_flags = 0x%hx]",
212 (uint64_t)process_address + m_offset,
213 m_persistent_variable_sp->GetName().AsCString(),
214 m_persistent_variable_sp->m_flags);
218 m_delegate->DidDematerialize(m_persistent_variable_sp);
221 if ((m_persistent_variable_sp->m_flags &
223 (m_persistent_variable_sp->m_flags &
225 if (m_persistent_variable_sp->m_flags &
227 !m_persistent_variable_sp->m_live_sp) {
239 "couldn't read the address of program-allocated variable %s: %s",
240 m_persistent_variable_sp->GetName().GetCString(),
247 m_persistent_variable_sp.get()->GetCompilerType(),
249 m_persistent_variable_sp->GetByteSize().value_or(0));
253 location <= frame_top) {
257 m_persistent_variable_sp->m_flags |=
259 m_persistent_variable_sp->m_flags |=
261 m_persistent_variable_sp->m_flags |=
263 m_persistent_variable_sp->m_flags &=
272 if (!m_persistent_variable_sp->m_live_sp) {
274 "couldn't find the memory area used to store %s",
275 m_persistent_variable_sp->GetName().GetCString());
279 if (m_persistent_variable_sp->m_live_sp->GetValue()
282 "the address of the memory area for %s is in an incorrect format",
283 m_persistent_variable_sp->GetName().GetCString());
287 if (m_persistent_variable_sp->m_flags &
289 m_persistent_variable_sp->m_flags &
291 LLDB_LOGF(log,
"Dematerializing %s from 0x%" PRIx64
" (size = %llu)",
292 m_persistent_variable_sp->GetName().GetCString(),
294 (
unsigned long long)m_persistent_variable_sp->GetByteSize()
299 m_persistent_variable_sp->ValueUpdated();
303 map.
ReadMemory(m_persistent_variable_sp->GetValueBytes(), mem,
304 m_persistent_variable_sp->GetByteSize().value_or(0),
309 "couldn't read the contents of %s from memory: %s",
310 m_persistent_variable_sp->GetName().GetCString(),
315 m_persistent_variable_sp->m_flags &=
320 "no dematerialization happened for persistent variable %s",
321 m_persistent_variable_sp->GetName().AsCString());
327 if (!process_sp || !process_sp->CanJIT()) {
331 m_persistent_variable_sp->m_flags |=
334 DestroyAllocation(map, err);
337 }
else if (m_persistent_variable_sp->m_flags &
339 !(m_persistent_variable_sp->m_flags &
341 DestroyAllocation(map, err);
353 const lldb::addr_t load_addr = process_address + m_offset;
355 dump_stream.
Printf(
"0x%" PRIx64
": EntityPersistentVariable (%s)\n",
357 m_persistent_variable_sp->GetName().AsCString());
360 dump_stream.
Printf(
"Pointer:\n");
367 dump_stream.
Printf(
" <could not be read>\n");
377 dump_stream.
Printf(
"Target:\n");
384 dump_stream.
Printf(
" <could not be read>\n");
386 DataBufferHeap data(m_persistent_variable_sp->GetByteSize().value_or(0),
390 m_persistent_variable_sp->GetByteSize().value_or(0),
394 dump_stream.
Printf(
" <could not be read>\n");
418 *iter = std::make_unique<EntityPersistentVariable>(persistent_variable_sp,
421 (*iter)->SetOffset(ret);
444 const lldb::addr_t load_addr = process_address + m_offset;
447 "EntityVariable::Materialize [address = 0x%" PRIx64
448 ", m_variable_sp = %s]",
449 (uint64_t)load_addr,
GetName().GetCString());
461 "couldn't get a value object for variable %s",
GetName().AsCString());
467 if (valobj_error.
Fail()) {
469 "couldn't get the value of variable %s: %s",
GetName().AsCString(),
474 if (m_is_reference) {
477 valobj_sp->GetData(valobj_extractor, extract_error);
479 if (!extract_error.
Success()) {
481 "couldn't read contents of reference variable %s: %s",
494 "couldn't write the contents of reference "
495 "variable %s to memory: %s",
501 const bool scalar_is_load_address =
false;
503 valobj_sp->GetAddressOf(scalar_is_load_address, &address_type);
510 "couldn't write the address of variable %s to memory: %s",
517 valobj_sp->GetData(data, extract_error);
518 if (!extract_error.
Success()) {
520 "couldn't get the value of %s: %s",
GetName().AsCString(),
527 "trying to create a temporary region for %s but one exists",
533 if (data.
GetByteSize() == 0 && !LocationExpressionIsValid()) {
535 "the variable '%s' has no location, "
536 "it may have been optimized out",
540 "size of variable %s (%" PRIu64
541 ") is larger than the ValueObject's size (%" PRIu64
")",
542 GetName().AsCString(), GetByteSize(scope).value_or(0),
548 std::optional<size_t> opt_bit_align = GetTypeBitAlign(scope);
549 if (!opt_bit_align) {
551 "can't get the type alignment for %s",
GetName().AsCString());
555 size_t byte_align = (*opt_bit_align + 7) / 8;
558 const bool zero_memory =
false;
560 m_temporary_allocation = map.
Malloc(
562 lldb::ePermissionsReadable | lldb::ePermissionsWritable,
567 m_original_data = std::make_shared<DataBufferHeap>(data.
GetDataStart(),
572 "couldn't allocate a temporary region for %s: %s",
584 "couldn't write to the temporary region for %s: %s",
589 Status pointer_write_error;
592 pointer_write_error);
594 if (!pointer_write_error.
Success()) {
596 "couldn't write the address of the temporary region for %s: %s",
608 const lldb::addr_t load_addr = process_address + m_offset;
611 "EntityVariable::Dematerialize [address = 0x%" PRIx64
612 ", m_variable_sp = %s]",
613 (uint64_t)load_addr,
GetName().AsCString());
626 "couldn't get a value object for variable %s",
636 valobj_sp->
GetByteSize().value_or(0), extract_error);
638 if (!extract_error.
Success()) {
640 "couldn't get the data for variable %s",
GetName().AsCString());
644 bool actually_write =
true;
646 if (m_original_data) {
647 if ((data.
GetByteSize() == m_original_data->GetByteSize()) &&
648 !memcmp(m_original_data->GetBytes(), data.
GetDataStart(),
650 actually_write =
false;
656 if (actually_write) {
657 valobj_sp->SetData(data, set_error);
661 "couldn't write the new contents of %s back into the variable",
669 map.
Free(m_temporary_allocation, free_error);
673 "couldn't free the temporary region for %s: %s",
678 m_original_data.reset();
680 m_temporary_allocation_size = 0;
688 const lldb::addr_t load_addr = process_address + m_offset;
689 dump_stream.
Printf(
"0x%" PRIx64
": EntityVariable\n", load_addr);
696 dump_stream.
Printf(
"Pointer:\n");
703 dump_stream.
Printf(
" <could not be read>\n");
720 dump_stream.
Printf(
"Points to process memory:\n");
722 dump_stream.
Printf(
"Temporary allocation:\n");
726 dump_stream.
Printf(
" <could not be be found>\n");
731 m_temporary_allocation_size, err);
734 dump_stream.
Printf(
" <could not be read>\n");
750 map.
Free(m_temporary_allocation, free_error);
753 m_temporary_allocation_size = 0;
779 virtual std::optional<uint64_t>
790 virtual std::optional<size_t>
794 bool m_is_reference =
false;
796 size_t m_temporary_allocation_size = 0;
810 m_variable_sp->GetType()->GetForwardCompilerType().IsReferenceType();
816 assert(m_variable_sp !=
nullptr);
820 std::optional<uint64_t>
822 return m_variable_sp->GetType()->GetByteSize(scope);
826 return m_variable_sp->LocationExpressionList().IsValid();
829 std::optional<size_t>
831 return m_variable_sp->GetType()->GetLayoutCompilerType().GetTypeBitAlign(
847 : m_name(name), m_valobj_provider(std::move(provider)) {
848 assert(m_valobj_provider);
858 m_is_reference = m_valobj_sp->GetCompilerType().IsReferenceType();
863 std::optional<uint64_t>
866 return m_valobj_sp->GetCompilerType().GetByteSize(scope);
873 return m_valobj_sp->GetError().Success();
878 std::optional<size_t>
881 return m_valobj_sp->GetCompilerType().GetTypeBitAlign(scope);
894 *iter = std::make_unique<EntityVariable>(variable_sp);
896 (*iter)->SetOffset(ret);
903 assert(valobj_provider);
905 *iter = std::make_unique<EntityValueObject>(name, std::move(valobj_provider));
907 (*iter)->SetOffset(ret);
916 : Entity(), m_type(type), m_is_program_reference(is_program_reference),
917 m_keep_in_memory(keep_in_memory), m_delegate(delegate) {
926 if (!m_is_program_reference) {
929 "Trying to create a temporary region for the result "
934 const lldb::addr_t load_addr = process_address + m_offset;
940 std::optional<uint64_t> byte_size = m_type.GetByteSize(exe_scope);
943 "can't get size of type \"%s\"", m_type.GetTypeName().AsCString());
947 std::optional<size_t> opt_bit_align = m_type.GetTypeBitAlign(exe_scope);
948 if (!opt_bit_align) {
950 "can't get the alignment of type \"%s\"",
951 m_type.GetTypeName().AsCString());
955 size_t byte_align = (*opt_bit_align + 7) / 8;
958 const bool zero_memory =
true;
960 m_temporary_allocation = map.
Malloc(
961 *byte_size, byte_align,
962 lldb::ePermissionsReadable | lldb::ePermissionsWritable,
964 m_temporary_allocation_size = *byte_size;
968 "couldn't allocate a temporary region for the result: %s",
973 Status pointer_write_error;
976 pointer_write_error);
978 if (!pointer_write_error.
Success()) {
980 "couldn't write the address of the "
981 "temporary region for the result: %s",
998 "Couldn't dematerialize a result variable: invalid "
999 "execution context scope");
1005 const lldb::addr_t load_addr = process_address + m_offset;
1011 "Couldn't dematerialize a result variable: couldn't "
1012 "read its address");
1020 "Couldn't dematerialize a result variable: no target");
1024 auto type_system_or_err =
1025 target_sp->GetScratchTypeSystemForLanguage(m_type.GetMinimumLanguage());
1027 if (
auto error = type_system_or_err.takeError()) {
1029 "Couldn't dematerialize a result variable: "
1030 "couldn't get the corresponding type "
1032 llvm::toString(std::move(
error)).c_str());
1035 auto ts = *type_system_or_err;
1038 "Couldn't dematerialize a result variable: "
1039 "couldn't corresponding type system is "
1044 ts->GetPersistentExpressionState();
1046 if (!persistent_state) {
1048 "Couldn't dematerialize a result variable: "
1049 "corresponding type system doesn't handle persistent "
1055 ? m_delegate->GetName()
1063 "couldn't dematerialize a result variable: "
1064 "failed to make persistent variable %s",
1073 m_delegate->DidDematerialize(ret);
1077 (m_is_program_reference && process_sp && process_sp->CanJIT() &&
1078 !(address >= frame_bottom && address < frame_top));
1080 if (can_persist && m_keep_in_memory) {
1086 ret->ValueUpdated();
1088 const size_t pvar_byte_size = ret->GetByteSize().value_or(0);
1089 uint8_t *pvar_data = ret->GetValueBytes();
1091 map.
ReadMemory(pvar_data, address, pvar_byte_size, read_error);
1095 "Couldn't dematerialize a result variable: couldn't read its memory");
1099 if (!can_persist || !m_keep_in_memory) {
1104 map.
Free(m_temporary_allocation, free_error);
1111 m_temporary_allocation_size = 0;
1115 Log *log)
override {
1118 const lldb::addr_t load_addr = process_address + m_offset;
1120 dump_stream.
Printf(
"0x%" PRIx64
": EntityResultVariable\n", load_addr);
1127 dump_stream.
Printf(
"Pointer:\n");
1134 dump_stream.
Printf(
" <could not be read>\n");
1151 dump_stream.
Printf(
"Points to process memory:\n");
1153 dump_stream.
Printf(
"Temporary allocation:\n");
1157 dump_stream.
Printf(
" <could not be be found>\n");
1162 m_temporary_allocation_size, err);
1165 dump_stream.
Printf(
" <could not be read>\n");
1181 map.
Free(m_temporary_allocation, free_error);
1185 m_temporary_allocation_size = 0;
1194 size_t m_temporary_allocation_size = 0;
1199 bool is_program_reference,
1200 bool keep_in_memory,
1204 *iter = std::make_unique<EntityResultVariable>(type, is_program_reference,
1205 keep_in_memory, delegate);
1207 (*iter)->SetOffset(ret);
1221 Log *log =
GetLog(LLDBLog::Expressions);
1223 const lldb::addr_t load_addr = process_address + m_offset;
1227 "EntitySymbol::Materialize [address = 0x%" PRIx64
1229 (uint64_t)load_addr, m_symbol.GetName().AsCString());
1232 const Address sym_address = m_symbol.GetAddress();
1245 "couldn't resolve symbol %s because there is no target",
1246 m_symbol.GetName().AsCString());
1255 Status pointer_write_error;
1259 if (!pointer_write_error.
Success()) {
1261 "couldn't write the address of symbol %s: %s",
1262 m_symbol.GetName().AsCString(), pointer_write_error.
AsCString());
1270 Log *log =
GetLog(LLDBLog::Expressions);
1272 const lldb::addr_t load_addr = process_address + m_offset;
1276 "EntitySymbol::Dematerialize [address = 0x%" PRIx64
1278 (uint64_t)load_addr, m_symbol.GetName().AsCString());
1285 Log *log)
override {
1290 const lldb::addr_t load_addr = process_address + m_offset;
1292 dump_stream.
Printf(
"0x%" PRIx64
": EntitySymbol (%s)\n", load_addr,
1293 m_symbol.GetName().AsCString());
1296 dump_stream.
Printf(
"Pointer:\n");
1303 dump_stream.
Printf(
" <could not be read>\n");
1323 *iter = std::make_unique<EntitySymbol>(symbol_sp);
1325 (*iter)->SetOffset(ret);
1332 : Entity(), m_register_info(register_info) {
1334 m_size = m_register_info.byte_size;
1335 m_alignment = m_register_info.byte_size;
1340 Log *log =
GetLog(LLDBLog::Expressions);
1342 const lldb::addr_t load_addr = process_address + m_offset;
1346 "EntityRegister::Materialize [address = 0x%" PRIx64
1347 ", m_register_info = %s]",
1348 (uint64_t)load_addr, m_register_info.name);
1353 if (!frame_sp.get()) {
1355 "couldn't materialize register %s without a stack frame",
1356 m_register_info.name);
1362 if (!reg_context_sp->ReadRegister(&m_register_info, reg_value)) {
1364 "couldn't read the value of register %s", m_register_info.name);
1370 if (!reg_value.
GetData(register_data)) {
1372 "couldn't get the data for register %s", m_register_info.name);
1376 if (register_data.
GetByteSize() != m_register_info.byte_size) {
1378 "data for register %s had size %llu but we expected %llu",
1379 m_register_info.name, (
unsigned long long)register_data.
GetByteSize(),
1380 (
unsigned long long)m_register_info.byte_size);
1384 m_register_contents = std::make_shared<DataBufferHeap>(
1394 "couldn't write the contents of register %s: %s",
1395 m_register_info.name, write_error.
AsCString());
1403 Log *log =
GetLog(LLDBLog::Expressions);
1405 const lldb::addr_t load_addr = process_address + m_offset;
1409 "EntityRegister::Dematerialize [address = 0x%" PRIx64
1410 ", m_register_info = %s]",
1411 (uint64_t)load_addr, m_register_info.name);
1418 if (!frame_sp.get()) {
1420 "couldn't dematerialize register %s without a stack frame",
1421 m_register_info.name);
1427 map.
GetMemoryData(register_data, load_addr, m_register_info.byte_size,
1430 if (!extract_error.
Success()) {
1432 "couldn't get the data for register %s: %s", m_register_info.name,
1437 if (!memcmp(register_data.
GetDataStart(), m_register_contents->GetBytes(),
1442 m_register_contents.reset();
1446 m_register_contents.reset();
1451 if (!reg_context_sp->WriteRegister(&m_register_info, register_value)) {
1453 "couldn't write the value of register %s", m_register_info.name);
1459 Log *log)
override {
1464 const lldb::addr_t load_addr = process_address + m_offset;
1466 dump_stream.
Printf(
"0x%" PRIx64
": EntityRegister (%s)\n", load_addr,
1467 m_register_info.name);
1470 dump_stream.
Printf(
"Value:\n");
1477 dump_stream.
Printf(
" <could not be read>\n");
1499 *iter = std::make_unique<EntityRegister>(register_info);
1501 (*iter)->SetOffset(ret);
1508 if (dematerializer_sp)
1509 dematerializer_sp->Wipe();
1521 if (dematerializer_sp) {
1535 entity_up->Materialize(frame_sp, map, process_address,
error);
1537 if (!
error.Success())
1544 "Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64
1546 static_cast<void *
>(frame_sp.get()), process_address);
1548 entity_up->DumpToLog(map, process_address, log);
1563 frame_sp = thread_sp->GetFrameWithStackID(
m_stack_id);
1571 "Couldn't dematerialize: invalid dematerializer");
1579 "Materializer::Dematerialize (frame_sp = %p, process_address "
1580 "= 0x%" PRIx64
") about to dematerialize:",
1588 frame_bottom,
error);
1590 if (!
error.Success())
1602 for (
EntityUP &entity_up : m_materializer->m_entities) {
1603 entity_up->Wipe(*m_map, m_process_address);
1606 m_materializer =
nullptr;
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
static constexpr uint32_t g_default_var_byte_size
static constexpr uint32_t g_default_var_alignment
static llvm::StringRef GetName(XcodeSDK::Type type)
Materializer::PersistentVariableDelegate * m_delegate
lldb::ExpressionVariableSP m_persistent_variable_sp
void DestroyAllocation(IRMemoryMap &map, Status &err)
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override
void MakeAllocation(IRMemoryMap &map, Status &err)
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override
void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address, Log *log) override
EntityPersistentVariable(lldb::ExpressionVariableSP &persistent_variable_sp, Materializer::PersistentVariableDelegate *delegate)
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override
void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address, Log *log) override
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override
RegisterInfo m_register_info
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override
lldb::DataBufferSP m_register_contents
EntityRegister(const RegisterInfo ®ister_info)
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override
void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address, Log *log) override
Materializer::PersistentVariableDelegate * m_delegate
bool m_is_program_reference
EntityResultVariable(const CompilerType &type, bool is_program_reference, bool keep_in_memory, Materializer::PersistentVariableDelegate *delegate)
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override
EntitySymbol(const Symbol &symbol)
void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address, Log *log) override
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override
Represents an Entity constructed from a VariableSP.
ConstString GetName() const override
ValueObjectProviderTy m_valobj_provider
lldb::ValueObjectSP m_valobj_sp
bool LocationExpressionIsValid() const override
Returns 'true' if the location expression associated with this variable is valid.
std::optional< size_t > GetTypeBitAlign(ExecutionContextScope *scope) const override
Returns alignment of the type associated with this variable in bits.
lldb::ValueObjectSP SetupValueObject(ExecutionContextScope *scope) override
Creates and returns ValueObject tied to this variable and prepares Entity for materialization.
std::optional< uint64_t > GetByteSize(ExecutionContextScope *scope) const override
Returns size in bytes of the type associated with this variable.
EntityValueObject(ConstString name, ValueObjectProviderTy provider)
Base class for materialization of Variables and ValueObjects.
lldb::DataBufferSP m_original_data
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err) override
virtual std::optional< uint64_t > GetByteSize(ExecutionContextScope *scope) const =0
Returns size in bytes of the type associated with this variable.
virtual ~EntityVariableBase()=default
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override
void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address, Log *log) override
virtual std::optional< size_t > GetTypeBitAlign(ExecutionContextScope *scope) const =0
Returns alignment of the type associated with this variable in bits.
virtual ConstString GetName() const =0
virtual bool LocationExpressionIsValid() const =0
Returns 'true' if the location expression associated with this variable is valid.
virtual lldb::ValueObjectSP SetupValueObject(ExecutionContextScope *scope)=0
Creates and returns ValueObject tied to this variable and prepares Entity for materialization.
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Status &err) override
Represents an Entity constructed from a VariableSP.
ConstString GetName() const override
std::optional< size_t > GetTypeBitAlign(ExecutionContextScope *scope) const override
Returns alignment of the type associated with this variable in bits.
lldb::ValueObjectSP SetupValueObject(ExecutionContextScope *scope) override
Creates and returns ValueObject tied to this variable and prepares Entity for materialization.
bool LocationExpressionIsValid() const override
Returns 'true' if the location expression associated with this variable is valid.
lldb::VariableSP m_variable_sp
Variable that this entity is based on.
std::optional< uint64_t > GetByteSize(ExecutionContextScope *scope) const override
Returns size in bytes of the type associated with this variable.
EntityVariable(lldb::VariableSP &variable_sp)
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
lldb::addr_t GetFileAddress() const
Get the file address.
Generic representation of a type in a programming language.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
virtual lldb::StackFrameSP CalculateStackFrame()=0
virtual lldb::ProcessSP CalculateProcess()=0
virtual lldb::TargetSP CalculateTarget()=0
lldb::ValueObjectSP m_live_sp
@ EVIsLLDBAllocated
This variable is resident in a location specifically allocated for it by LLDB in the target process.
@ EVNeedsFreezeDry
Copy from m_live_sp to m_frozen_sp during dematerialization.
@ EVNeedsAllocation
Space for this variable has yet to be allocated in the target process.
@ EVIsProgramReference
This variable is a reference to a (possibly invalid) area managed by the target program.
@ EVKeepInTarget
Keep the allocation after the expression is complete rather than freeze drying its contents and freei...
Encapsulates memory that may exist in the process but must also be available in the host process.
void Free(lldb::addr_t process_address, Status &error)
lldb::ByteOrder GetByteOrder()
void ReadPointerFromMemory(lldb::addr_t *address, lldb::addr_t process_address, Status &error)
ExecutionContextScope * GetBestExecutionContextScope() const
lldb::addr_t Malloc(size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, bool zero_memory, Status &error)
void GetMemoryData(DataExtractor &extractor, lldb::addr_t process_address, size_t size, Status &error)
void WritePointerToMemory(lldb::addr_t process_address, lldb::addr_t address, Status &error)
uint32_t GetAddressByteSize()
void WriteScalarToMemory(lldb::addr_t process_address, Scalar &scalar, size_t size, Status &error)
void Leak(lldb::addr_t process_address, Status &error)
void WriteMemory(lldb::addr_t process_address, const uint8_t *bytes, size_t size, Status &error)
void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size, Status &error)
@ eAllocationPolicyMirror
The intent is that this allocation exist both in the host and the process and have the same content i...
void PutString(llvm::StringRef str)
Materializer * m_materializer
void Dematerialize(Status &err, lldb::addr_t frame_top, lldb::addr_t frame_bottom)
lldb::ThreadWP m_thread_wp
lldb::addr_t m_process_address
virtual ~PersistentVariableDelegate()
PersistentVariableDelegate()
uint32_t AddResultVariable(const CompilerType &type, bool is_lvalue, bool keep_in_memory, PersistentVariableDelegate *delegate, Status &err)
uint32_t AddStructMember(Entity &entity)
std::unique_ptr< Entity > EntityUP
std::shared_ptr< Dematerializer > DematerializerSP
DematerializerSP Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Status &err)
uint32_t AddSymbol(const Symbol &symbol_sp, Status &err)
uint32_t AddRegister(const RegisterInfo ®ister_info, Status &err)
DematerializerWP m_dematerializer_wp
uint32_t AddValueObject(ConstString name, ValueObjectProviderTy valobj_provider, Status &err)
Create entity from supplied ValueObject and count it as a member of the materialized struct.
uint32_t AddPersistentVariable(lldb::ExpressionVariableSP &persistent_variable_sp, PersistentVariableDelegate *delegate, Status &err)
uint32_t AddVariable(lldb::VariableSP &variable_sp, Status &err)
uint32_t m_current_offset
uint32_t m_struct_alignment
virtual lldb::ExpressionVariableSP CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp)=0
virtual ConstString GetNextPersistentVariableName(bool is_error=false)=0
Return a new persistent variable name with the specified prefix.
bool GetData(DataExtractor &data) const
void Clear()
Clear the object state.
ValueType GetError() const
Access the error value.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
bool Success() const
Test for success condition.
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size, lldb::addr_t address=LLDB_INVALID_ADDRESS)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
void DumpHexBytes(Stream *s, const void *src, size_t src_len, uint32_t bytes_per_line, lldb::addr_t base_addr)
std::function< lldb::ValueObjectSP(ConstString, StackFrame *)> ValueObjectProviderTy
Functor that returns a ValueObjectSP for a variable given its name and the StackFrame of interest.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
Every register is described in detail including its name, alternate name (optional),...