Skip to content

Disable loading scalars as addresses when materializing an entity variable [master-rebranch] #1637

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

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
20 changes: 5 additions & 15 deletions lldb/source/Expression/Materializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,20 +413,14 @@ class EntityVariable : public Materializer::Entity {
public:
EntityVariable(lldb::VariableSP &variable_sp)
: Entity(), m_variable_sp(variable_sp), m_is_reference(false),
m_is_generic(false), m_temporary_allocation(LLDB_INVALID_ADDRESS),
m_temporary_allocation(LLDB_INVALID_ADDRESS),
m_temporary_allocation_size(0) {
// Hard-coding to maximum size of a pointer since all variables are
// materialized by reference
m_size = 8;
m_alignment = 8;
m_is_reference =
m_variable_sp->GetType()->GetForwardCompilerType().IsReferenceType();
#ifdef LLDB_ENABLE_SWIFT
m_is_generic = SwiftASTContext::IsGenericType(
m_variable_sp->GetType()->GetForwardCompilerType());
#else // !LLDB_ENABLE_SWIFT
m_is_generic = false;
#endif // LLDB_ENABLE_SWIFT
}

void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
Expand Down Expand Up @@ -495,13 +489,10 @@ class EntityVariable : public Materializer::Entity {
}
} else {
AddressType address_type = eAddressTypeInvalid;
const bool is_dynamic_class_type =
m_is_generic &&
(valobj_type.GetTypeClass() == lldb::eTypeClassClass);
const bool scalar_is_load_address = m_is_generic; // this is the only
// time we're dealing
// with dynamic values

const bool scalar_is_load_address = false;
lldb::addr_t addr_of_valobj =
valobj_sp->GetAddressOf(scalar_is_load_address, &address_type);

// if the dynamic type is a class, bypass the GetAddressOf() optimization
// as it doesn't do the right thing
lldb::addr_t addr_of_valobj =
Expand Down Expand Up @@ -808,7 +799,6 @@ class EntityVariable : public Materializer::Entity {
private:
lldb::VariableSP m_variable_sp;
bool m_is_reference;
bool m_is_generic;
lldb::addr_t m_temporary_allocation;
size_t m_temporary_allocation_size;
lldb::DataBufferSP m_original_data;
Expand Down