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()) {
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 "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()) {
527 "trying to create a temporary region for %s but one exists",
533 if (data.
GetByteSize() == 0 && !LocationExpressionIsValid()) {
535 "it may have been optimized out",
539 "size of variable %s (%" PRIu64
540 ") is larger than the ValueObject's size (%" PRIu64
")",
541 GetName().AsCString(), GetByteSize(scope).value_or(0),
547 std::optional<size_t> opt_bit_align = GetTypeBitAlign(scope);
548 if (!opt_bit_align) {
554 size_t byte_align = (*opt_bit_align + 7) / 8;
557 const bool zero_memory =
false;
559 m_temporary_allocation = map.
Malloc(
561 lldb::ePermissionsReadable | lldb::ePermissionsWritable,
566 m_original_data = std::make_shared<DataBufferHeap>(data.
GetDataStart(),
571 "couldn't allocate a temporary region for %s: %s",
583 "couldn't write to the temporary region for %s: %s",
588 Status pointer_write_error;
591 pointer_write_error);
593 if (!pointer_write_error.
Success()) {
595 "couldn't write the address of the temporary region for %s: %s",
607 const lldb::addr_t load_addr = process_address + m_offset;
610 "EntityVariable::Dematerialize [address = 0x%" PRIx64
611 ", m_variable_sp = %s]",
612 (uint64_t)load_addr,
GetName().AsCString());
625 "couldn't get a value object for variable %s",
635 valobj_sp->
GetByteSize().value_or(0), extract_error);
637 if (!extract_error.
Success()) {
643 bool actually_write =
true;
645 if (m_original_data) {
646 if ((data.
GetByteSize() == m_original_data->GetByteSize()) &&
647 !memcmp(m_original_data->GetBytes(), data.
GetDataStart(),
649 actually_write =
false;
655 if (actually_write) {
656 valobj_sp->SetData(data, set_error);
660 "couldn't write the new contents of %s back into the variable",
668 map.
Free(m_temporary_allocation, free_error);
672 "couldn't free the temporary region for %s: %s",
677 m_original_data.reset();
679 m_temporary_allocation_size = 0;
687 const lldb::addr_t load_addr = process_address + m_offset;
688 dump_stream.
Printf(
"0x%" PRIx64
": EntityVariable\n", load_addr);
695 dump_stream.
Printf(
"Pointer:\n");
702 dump_stream.
Printf(
" <could not be read>\n");
719 dump_stream.
Printf(
"Points to process memory:\n");
721 dump_stream.
Printf(
"Temporary allocation:\n");
725 dump_stream.
Printf(
" <could not be be found>\n");
730 m_temporary_allocation_size, err);
733 dump_stream.
Printf(
" <could not be read>\n");
749 map.
Free(m_temporary_allocation, free_error);
752 m_temporary_allocation_size = 0;
778 virtual std::optional<uint64_t>
789 virtual std::optional<size_t>
793 bool m_is_reference =
false;
795 size_t m_temporary_allocation_size = 0;
809 m_variable_sp->GetType()->GetForwardCompilerType().IsReferenceType();
815 assert(m_variable_sp !=
nullptr);
819 std::optional<uint64_t>
821 return m_variable_sp->GetType()->GetByteSize(scope);
825 return m_variable_sp->LocationExpressionList().IsValid();
828 std::optional<size_t>
830 return m_variable_sp->GetType()->GetLayoutCompilerType().GetTypeBitAlign(
846 : m_name(name), m_valobj_provider(std::move(provider)) {
847 assert(m_valobj_provider);
857 m_is_reference = m_valobj_sp->GetCompilerType().IsReferenceType();
862 std::optional<uint64_t>
865 return m_valobj_sp->GetCompilerType().GetByteSize(scope);
872 return m_valobj_sp->GetError().Success();
877 std::optional<size_t>
880 return m_valobj_sp->GetCompilerType().GetTypeBitAlign(scope);
893 *iter = std::make_unique<EntityVariable>(variable_sp);
895 (*iter)->SetOffset(ret);
902 assert(valobj_provider);
904 *iter = std::make_unique<EntityValueObject>(name, std::move(valobj_provider));
906 (*iter)->SetOffset(ret);
915 : Entity(), m_type(type), m_is_program_reference(is_program_reference),
916 m_keep_in_memory(keep_in_memory), m_delegate(delegate) {
925 if (!m_is_program_reference) {
927 err.
SetErrorString(
"Trying to create a temporary region for the result "
932 const lldb::addr_t load_addr = process_address + m_offset;
938 std::optional<uint64_t> byte_size = m_type.GetByteSize(exe_scope);
941 m_type.GetTypeName().AsCString());
945 std::optional<size_t> opt_bit_align = m_type.GetTypeBitAlign(exe_scope);
946 if (!opt_bit_align) {
948 m_type.GetTypeName().AsCString());
952 size_t byte_align = (*opt_bit_align + 7) / 8;
955 const bool zero_memory =
true;
957 m_temporary_allocation = map.
Malloc(
958 *byte_size, byte_align,
959 lldb::ePermissionsReadable | lldb::ePermissionsWritable,
961 m_temporary_allocation_size = *byte_size;
965 "couldn't allocate a temporary region for the result: %s",
970 Status pointer_write_error;
973 pointer_write_error);
975 if (!pointer_write_error.
Success()) {
977 "temporary region for the result: %s",
993 err.
SetErrorString(
"Couldn't dematerialize a result variable: invalid "
994 "execution context scope");
1000 const lldb::addr_t load_addr = process_address + m_offset;
1005 err.
SetErrorString(
"Couldn't dematerialize a result variable: couldn't "
1006 "read its address");
1013 err.
SetErrorString(
"Couldn't dematerialize a result variable: no target");
1017 auto type_system_or_err =
1018 target_sp->GetScratchTypeSystemForLanguage(m_type.GetMinimumLanguage());
1020 if (
auto error = type_system_or_err.takeError()) {
1022 "couldn't get the corresponding type "
1024 llvm::toString(std::move(
error)).c_str());
1027 auto ts = *type_system_or_err;
1030 "couldn't corresponding type system is "
1035 ts->GetPersistentExpressionState();
1037 if (!persistent_state) {
1039 "corresponding type system doesn't handle persistent "
1045 ? m_delegate->GetName()
1053 "failed to make persistent variable %s",
1062 m_delegate->DidDematerialize(ret);
1066 (m_is_program_reference && process_sp && process_sp->CanJIT() &&
1067 !(address >= frame_bottom && address < frame_top));
1069 if (can_persist && m_keep_in_memory) {
1075 ret->ValueUpdated();
1077 const size_t pvar_byte_size = ret->GetByteSize().value_or(0);
1078 uint8_t *pvar_data = ret->GetValueBytes();
1080 map.
ReadMemory(pvar_data, address, pvar_byte_size, read_error);
1084 "Couldn't dematerialize a result variable: couldn't read its memory");
1088 if (!can_persist || !m_keep_in_memory) {
1093 map.
Free(m_temporary_allocation, free_error);
1100 m_temporary_allocation_size = 0;
1104 Log *log)
override {
1107 const lldb::addr_t load_addr = process_address + m_offset;
1109 dump_stream.
Printf(
"0x%" PRIx64
": EntityResultVariable\n", load_addr);
1116 dump_stream.
Printf(
"Pointer:\n");
1123 dump_stream.
Printf(
" <could not be read>\n");
1140 dump_stream.
Printf(
"Points to process memory:\n");
1142 dump_stream.
Printf(
"Temporary allocation:\n");
1146 dump_stream.
Printf(
" <could not be be found>\n");
1151 m_temporary_allocation_size, err);
1154 dump_stream.
Printf(
" <could not be read>\n");
1170 map.
Free(m_temporary_allocation, free_error);
1174 m_temporary_allocation_size = 0;
1183 size_t m_temporary_allocation_size = 0;
1188 bool is_program_reference,
1189 bool keep_in_memory,
1193 *iter = std::make_unique<EntityResultVariable>(type, is_program_reference,
1194 keep_in_memory, delegate);
1196 (*iter)->SetOffset(ret);
1210 Log *log =
GetLog(LLDBLog::Expressions);
1212 const lldb::addr_t load_addr = process_address + m_offset;
1216 "EntitySymbol::Materialize [address = 0x%" PRIx64
1218 (uint64_t)load_addr, m_symbol.GetName().AsCString());
1221 const Address sym_address = m_symbol.GetAddress();
1234 "couldn't resolve symbol %s because there is no target",
1235 m_symbol.GetName().AsCString());
1244 Status pointer_write_error;
1248 if (!pointer_write_error.
Success()) {
1250 "couldn't write the address of symbol %s: %s",
1251 m_symbol.GetName().AsCString(), pointer_write_error.
AsCString());
1259 Log *log =
GetLog(LLDBLog::Expressions);
1261 const lldb::addr_t load_addr = process_address + m_offset;
1265 "EntitySymbol::Dematerialize [address = 0x%" PRIx64
1267 (uint64_t)load_addr, m_symbol.GetName().AsCString());
1274 Log *log)
override {
1279 const lldb::addr_t load_addr = process_address + m_offset;
1281 dump_stream.
Printf(
"0x%" PRIx64
": EntitySymbol (%s)\n", load_addr,
1282 m_symbol.GetName().AsCString());
1285 dump_stream.
Printf(
"Pointer:\n");
1292 dump_stream.
Printf(
" <could not be read>\n");
1312 *iter = std::make_unique<EntitySymbol>(symbol_sp);
1314 (*iter)->SetOffset(ret);
1321 : Entity(), m_register_info(register_info) {
1323 m_size = m_register_info.byte_size;
1324 m_alignment = m_register_info.byte_size;
1329 Log *log =
GetLog(LLDBLog::Expressions);
1331 const lldb::addr_t load_addr = process_address + m_offset;
1335 "EntityRegister::Materialize [address = 0x%" PRIx64
1336 ", m_register_info = %s]",
1337 (uint64_t)load_addr, m_register_info.name);
1342 if (!frame_sp.get()) {
1344 "couldn't materialize register %s without a stack frame",
1345 m_register_info.name);
1351 if (!reg_context_sp->ReadRegister(&m_register_info, reg_value)) {
1353 m_register_info.name);
1359 if (!reg_value.
GetData(register_data)) {
1361 m_register_info.name);
1365 if (register_data.
GetByteSize() != m_register_info.byte_size) {
1367 "data for register %s had size %llu but we expected %llu",
1368 m_register_info.name, (
unsigned long long)register_data.
GetByteSize(),
1369 (
unsigned long long)m_register_info.byte_size);
1373 m_register_contents = std::make_shared<DataBufferHeap>(
1383 "couldn't write the contents of register %s: %s",
1384 m_register_info.name, write_error.
AsCString());
1392 Log *log =
GetLog(LLDBLog::Expressions);
1394 const lldb::addr_t load_addr = process_address + m_offset;
1398 "EntityRegister::Dematerialize [address = 0x%" PRIx64
1399 ", m_register_info = %s]",
1400 (uint64_t)load_addr, m_register_info.name);
1407 if (!frame_sp.get()) {
1409 "couldn't dematerialize register %s without a stack frame",
1410 m_register_info.name);
1416 map.
GetMemoryData(register_data, load_addr, m_register_info.byte_size,
1419 if (!extract_error.
Success()) {
1421 m_register_info.name,
1426 if (!memcmp(register_data.
GetDataStart(), m_register_contents->GetBytes(),
1431 m_register_contents.reset();
1435 m_register_contents.reset();
1440 if (!reg_context_sp->WriteRegister(&m_register_info, register_value)) {
1442 m_register_info.name);
1448 Log *log)
override {
1453 const lldb::addr_t load_addr = process_address + m_offset;
1455 dump_stream.
Printf(
"0x%" PRIx64
": EntityRegister (%s)\n", load_addr,
1456 m_register_info.name);
1459 dump_stream.
Printf(
"Value:\n");
1466 dump_stream.
Printf(
" <could not be read>\n");
1488 *iter = std::make_unique<EntityRegister>(register_info);
1490 (*iter)->SetOffset(ret);
1497 if (dematerializer_sp)
1498 dematerializer_sp->Wipe();
1510 if (dematerializer_sp) {
1511 error.SetErrorToGenericError();
1512 error.SetErrorString(
"Couldn't materialize: already materialized");
1519 error.SetErrorToGenericError();
1520 error.SetErrorString(
"Couldn't materialize: target doesn't exist");
1524 entity_up->Materialize(frame_sp, map, process_address,
error);
1526 if (!
error.Success())
1533 "Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64
1535 static_cast<void *
>(frame_sp.get()), process_address);
1537 entity_up->DumpToLog(map, process_address, log);
1552 frame_sp = thread_sp->GetFrameWithStackID(
m_stack_id);
1559 error.SetErrorToGenericError();
1560 error.SetErrorString(
"Couldn't dematerialize: invalid dematerializer");
1564 error.SetErrorToGenericError();
1565 error.SetErrorString(
"Couldn't dematerialize: target is gone");
1569 "Materializer::Dematerialize (frame_sp = %p, process_address "
1570 "= 0x%" PRIx64
") about to dematerialize:",
1578 frame_bottom,
error);
1580 if (!
error.Success())
1592 for (
EntityUP &entity_up : m_materializer->m_entities) {
1593 entity_up->Wipe(*m_map, m_process_address);
1596 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.
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
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.
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
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),...