uint32_t AddSymbol (const Symbol &symbol_sp, Error &err);
uint32_t AddRegister (const RegisterInfo ®ister_info, Error &err);
- uint32_t GetStructAlignment ();
+ uint32_t GetStructAlignment ()
+ {
+ return m_struct_alignment;
+ }
+
+ uint32_t GetStructByteSize ()
+ {
+ return m_current_offset;
+ }
class Entity
{
if (m_parser_vars->m_materializer)
{
+ uint32_t offset = 0;
+
Error err;
if (is_persistent_variable)
{
- m_parser_vars->m_materializer->AddPersistentVariable(var_sp, err);
+ offset = m_parser_vars->m_materializer->AddPersistentVariable(var_sp, err);
}
else
{
if (const lldb_private::Symbol *sym = parser_vars->m_lldb_sym)
- m_parser_vars->m_materializer->AddSymbol(*sym, err);
+ offset = m_parser_vars->m_materializer->AddSymbol(*sym, err);
else if (const RegisterInfo *reg_info = var_sp->GetRegisterInfo())
- m_parser_vars->m_materializer->AddRegister(*reg_info, err);
+ offset = m_parser_vars->m_materializer->AddRegister(*reg_info, err);
else if (parser_vars->m_lldb_var)
- m_parser_vars->m_materializer->AddVariable(parser_vars->m_lldb_var, err);
+ offset = m_parser_vars->m_materializer->AddVariable(parser_vars->m_lldb_var, err);
}
+
+ if (!err.Success())
+ return false;
+
+ if (log)
+ log->Printf("Placed at 0x%llx", (unsigned long long)offset);
+
+ jit_vars->m_offset = offset; // TODO DoStructLayout() should not change this.
}
return true;
if (m_struct_vars->m_struct_laid_out)
return true;
+ if (m_parser_vars->m_materializer)
+ {
+ m_struct_vars->m_struct_alignment = m_parser_vars->m_materializer->GetStructAlignment();
+ m_struct_vars->m_struct_size = m_parser_vars->m_materializer->GetStructByteSize();
+ m_struct_vars->m_struct_laid_out = true;
+ return true;
+ }
+
off_t cursor = 0;
m_struct_vars->m_struct_alignment = 0;
uint32_t ret;
- if (!m_current_offset)
+ if (m_current_offset == 0)
m_struct_alignment = alignment;
if (m_current_offset % alignment)
Entity(),
m_variable_sp(variable_sp)
{
- Type *type = variable_sp->GetType();
-
- assert(type);
-
- if (type)
- {
- ClangASTType clang_type(type->GetClangAST(),
- type->GetClangLayoutType());
-
- SetSizeAndAlignmentFromType(clang_type);
- }
+ // Hard-coding to maximum size of a pointer since all varaibles are materialized by reference
+ m_size = 8;
+ m_alignment = 8;
}
virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err)