/// Creating related types.
/// \{
- CompilerType GetArrayElementType(uint64_t *stride = nullptr) const;
+ CompilerType GetArrayElementType(ExecutionContextScope *exe_scope,
+ uint64_t *stride = nullptr) const;
CompilerType GetArrayType(uint64_t size) const;
/// \}
bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset,
- size_t data_byte_size, Scalar &value) const;
+ size_t data_byte_size, Scalar &value,
+ ExecutionContextScope *exe_scope) const;
void Clear() {
m_type = nullptr;
m_type_system = nullptr;
// Type instances. They can store a weak pointer to the Module;
lldb::ModuleSP GetModule();
- void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name);
+ void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name,
+ ExecutionContextScope *exe_scope);
SymbolFile *GetSymbolFile() { return m_symbol_file; }
const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
ConstString GetName();
- llvm::Optional<uint64_t> GetByteSize();
+ llvm::Optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope);
uint32_t GetNumChildren(bool omit_empty_base_classes);
// Creating related types
- virtual CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
- uint64_t *stride) = 0;
+ virtual CompilerType
+ GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride,
+ ExecutionContextScope *exe_scope) = 0;
virtual CompilerType GetArrayType(lldb::opaque_compiler_type_t type,
uint64_t size);
return LLDB_RECORD_RESULT(SBType());
CompilerType canonical_type =
m_opaque_sp->GetCompilerType(true).GetCanonicalType();
- return LLDB_RECORD_RESULT(
- SBType(TypeImplSP(new TypeImpl(canonical_type.GetArrayElementType()))));
+ return LLDB_RECORD_RESULT(SBType(
+ TypeImplSP(new TypeImpl(canonical_type.GetArrayElementType(nullptr)))));
}
SBType SBType::GetArrayType(uint64_t size) {
return 0;
}
-static size_t LookupTypeInModule(CommandInterpreter &interpreter, Stream &strm,
+static size_t LookupTypeInModule(Target *target,
+ CommandInterpreter &interpreter, Stream &strm,
Module *module, const char *name_cstr,
bool name_is_regex) {
TypeList type_list;
// Resolve the clang type so that any forward references to types
// that haven't yet been parsed will get parsed.
type_sp->GetFullCompilerType();
- type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
+ type_sp->GetDescription(&strm, eDescriptionLevelFull, true, target);
// Print all typedef chains
TypeSP typedef_type_sp(type_sp);
TypeSP typedefed_type_sp(typedef_type_sp->GetTypedefType());
strm.Printf(" typedef '%s': ",
typedef_type_sp->GetName().GetCString());
typedefed_type_sp->GetFullCompilerType();
- typedefed_type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
+ typedefed_type_sp->GetDescription(&strm, eDescriptionLevelFull, true,
+ target);
typedef_type_sp = typedefed_type_sp;
typedefed_type_sp = typedef_type_sp->GetTypedefType();
}
return type_list.GetSize();
}
-static size_t LookupTypeHere(CommandInterpreter &interpreter, Stream &strm,
- Module &module, const char *name_cstr,
- bool name_is_regex) {
+static size_t LookupTypeHere(Target *target, CommandInterpreter &interpreter,
+ Stream &strm, Module &module,
+ const char *name_cstr, bool name_is_regex) {
TypeList type_list;
const uint32_t max_num_matches = UINT32_MAX;
bool name_is_fully_qualified = false;
// Resolve the clang type so that any forward references to types that
// haven't yet been parsed will get parsed.
type_sp->GetFullCompilerType();
- type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
- // Print all typedef chains
+ type_sp->GetDescription(&strm, eDescriptionLevelFull, true, target);
+ // Print all typedef chains.
TypeSP typedef_type_sp(type_sp);
TypeSP typedefed_type_sp(typedef_type_sp->GetTypedefType());
while (typedefed_type_sp) {
strm.Printf(" typedef '%s': ",
typedef_type_sp->GetName().GetCString());
typedefed_type_sp->GetFullCompilerType();
- typedefed_type_sp->GetDescription(&strm, eDescriptionLevelFull, true);
+ typedefed_type_sp->GetDescription(&strm, eDescriptionLevelFull, true,
+ target);
typedef_type_sp = typedefed_type_sp;
typedefed_type_sp = typedef_type_sp->GetTypedefType();
}
return false;
case eLookupTypeType:
if (!m_options.m_str.empty()) {
- if (LookupTypeHere(m_interpreter, result.GetOutputStream(),
- *sym_ctx.module_sp, m_options.m_str.c_str(),
- m_options.m_use_regex)) {
+ if (LookupTypeHere(&GetSelectedTarget(), m_interpreter,
+ result.GetOutputStream(), *sym_ctx.module_sp,
+ m_options.m_str.c_str(), m_options.m_use_regex)) {
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
case eLookupTypeType:
if (!m_options.m_str.empty()) {
- if (LookupTypeInModule(m_interpreter, result.GetOutputStream(), module,
- m_options.m_str.c_str(),
- m_options.m_use_regex)) {
+ if (LookupTypeInModule(
+ &GetSelectedTarget(), m_interpreter, result.GetOutputStream(),
+ module, m_options.m_str.c_str(), m_options.m_use_regex)) {
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
Status error(GetValueAsData(exe_ctx, data, nullptr));
if (error.Success()) {
Scalar scalar;
- if (compiler_type.GetValueAsScalar(data, 0, data.GetByteSize(),
- scalar)) {
+ if (compiler_type.GetValueAsScalar(
+ data, 0, data.GetByteSize(), scalar,
+ exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)) {
m_value = scalar;
m_value_type = eValueTypeScalar;
} else {
}
uint64_t ValueObjectMemory::GetByteSize() {
+ ExecutionContext exe_ctx(GetExecutionContextRef());
if (m_type_sp)
- return m_type_sp->GetByteSize().getValueOr(0);
- return m_compiler_type.GetByteSize(nullptr).getValueOr(0);
+ return m_type_sp->GetByteSize(exe_ctx.GetBestExecutionContextScope())
+ .getValueOr(0);
+ return m_compiler_type.GetByteSize(exe_ctx.GetBestExecutionContextScope())
+ .getValueOr(0);
}
lldb::ValueType ValueObjectMemory::GetValueType() const {
// stripped.
uint64_t array_size;
if (compiler_type.IsArrayType(nullptr, &array_size, nullptr)) {
- CompilerType element_type = compiler_type.GetArrayElementType();
+ ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
+ CompilerType element_type = compiler_type.GetArrayElementType(
+ exe_ctx.GetBestExecutionContextScope());
if (element_type.IsTypedefType()) {
// Get the stripped element type and compute the stripped array type
// from it.
return;
}
- if (data.GetByteSize() < m_variable_sp->GetType()->GetByteSize()) {
+ if (data.GetByteSize() < m_variable_sp->GetType()->GetByteSize(scope)) {
if (data.GetByteSize() == 0 &&
!m_variable_sp->LocationExpression().IsValid()) {
err.SetErrorStringWithFormat("the variable '%s' has no location, "
"size of variable %s (%" PRIu64
") is larger than the ValueObject's size (%" PRIu64 ")",
m_variable_sp->GetName().AsCString(),
- m_variable_sp->GetType()->GetByteSize().getValueOr(0),
+ m_variable_sp->GetType()->GetByteSize(scope).getValueOr(0),
data.GetByteSize());
}
return;
uint32_t &NGRN, // NGRN (see ABI documentation)
uint32_t &NSRN, // NSRN (see ABI documentation)
DataExtractor &data) {
- llvm::Optional<uint64_t> byte_size = value_type.GetByteSize(nullptr);
+ llvm::Optional<uint64_t> byte_size =
+ value_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
if (!byte_size || *byte_size == 0)
return false;
if (NSRN < 8 && (8 - NSRN) >= homogeneous_count) {
if (!base_type)
return false;
- llvm::Optional<uint64_t> base_byte_size = base_type.GetByteSize(nullptr);
+ llvm::Optional<uint64_t> base_byte_size =
+ base_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
if (!base_byte_size)
return false;
uint32_t data_offset = 0;
return return_valobj_sp;
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
uint32_t &NGRN, // NGRN (see ABI documentation)
uint32_t &NSRN, // NSRN (see ABI documentation)
DataExtractor &data) {
- llvm::Optional<uint64_t> byte_size = value_type.GetByteSize(nullptr);
+ llvm::Optional<uint64_t> byte_size =
+ value_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
if (byte_size || *byte_size == 0)
return false;
if (NSRN < 8 && (8 - NSRN) >= homogeneous_count) {
if (!base_type)
return false;
- llvm::Optional<uint64_t> base_byte_size = base_type.GetByteSize(nullptr);
+ llvm::Optional<uint64_t> base_byte_size =
+ base_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
if (!base_byte_size)
return false;
uint32_t data_offset = 0;
return return_valobj_sp;
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
const uint32_t type_flags = compiler_type.GetTypeInfo();
// Integer return type.
if (type_flags & eTypeIsInteger) {
- const size_t byte_size = compiler_type.GetByteSize(nullptr).getValueOr(0);
+ const size_t byte_size = compiler_type.GetByteSize(&thread).getValueOr(0);
auto raw_value = ReadRawValue(reg_ctx, byte_size);
const bool is_signed = (type_flags & eTypeIsSigned) != 0;
if (compiler_type.IsFloatingPointType(float_count, is_complex) &&
1 == float_count && !is_complex) {
- const size_t byte_size = compiler_type.GetByteSize(nullptr).getValueOr(0);
+ const size_t byte_size = compiler_type.GetByteSize(&thread).getValueOr(0);
auto raw_value = ReadRawValue(reg_ctx, byte_size);
if (!SetSizedFloat(value.GetScalar(), raw_value, byte_size))
if (homogeneous_count > 0 && homogeneous_count <= 4) {
llvm::Optional<uint64_t> base_byte_size =
- base_type.GetByteSize(nullptr);
+ base_type.GetByteSize(&thread);
if (base_type.IsVectorType(nullptr, nullptr)) {
if (base_byte_size &&
(*base_byte_size == 8 || *base_byte_size == 16)) {
if (base_type.IsFloatingPointType(float_count, is_complex)) {
llvm::Optional<uint64_t> base_byte_size =
- base_type.GetByteSize(nullptr);
+ base_type.GetByteSize(&thread);
if (float_count == 2 && is_complex) {
if (index != 0 && base_byte_size &&
vfp_byte_size != *base_byte_size)
const ArchSpec target_arch = target->GetArchitecture();
ByteOrder target_byte_order = target_arch.GetByteOrder();
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr);
return_compiler_type.GetFieldAtIndex(
idx, name, &field_bit_offset, nullptr, nullptr);
llvm::Optional<uint64_t> field_byte_width =
- field_compiler_type.GetByteSize(nullptr);
+ field_compiler_type.GetByteSize(&thread);
if (!field_byte_width)
return return_valobj_sp;
CompilerType field_compiler_type = return_compiler_type.GetFieldAtIndex(
idx, name, &field_bit_offset, nullptr, nullptr);
llvm::Optional<uint64_t> field_byte_width =
- field_compiler_type.GetByteSize(nullptr);
+ field_compiler_type.GetByteSize(&thread);
// if we don't know the size of the field (e.g. invalid type), just
// bail out
// Extract the register context so we can read arguments from registers
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *f1_info = reg_ctx->GetRegisterInfoByName("f1", 0);
RegisterValue f1_value;
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *altivec_reg = reg_ctx->GetRegisterInfoByName("v2", 0);
if (altivec_reg) {
ReturnValueExtractor(Thread &thread, CompilerType &type,
RegisterContext *reg_ctx, ProcessSP process_sp)
: m_thread(thread), m_type(type),
- m_byte_size(m_type.GetByteSize(nullptr).getValueOr(0)),
+ m_byte_size(m_type.GetByteSize(&thread).getValueOr(0)),
m_data_up(new DataBufferHeap(m_byte_size, 0)), m_reg_ctx(reg_ctx),
m_process_sp(process_sp), m_byte_order(process_sp->GetByteOrder()),
m_addr_size(
DataExtractor de(&raw_data, sizeof(raw_data), m_byte_order, m_addr_size);
offset_t offset = 0;
- llvm::Optional<uint64_t> byte_size = type.GetByteSize(nullptr);
+ llvm::Optional<uint64_t> byte_size = type.GetByteSize(m_process_sp.get());
if (!byte_size)
return {};
switch (*byte_size) {
CompilerType elem_type;
if (m_type.IsHomogeneousAggregate(&elem_type)) {
uint32_t type_flags = elem_type.GetTypeInfo();
- llvm::Optional<uint64_t> elem_size = elem_type.GetByteSize(nullptr);
+ llvm::Optional<uint64_t> elem_size =
+ elem_type.GetByteSize(m_process_sp.get());
if (!elem_size)
return {};
if (type_flags & eTypeIsComplex || !(type_flags & eTypeIsFloat)) {
if (type_flags & eTypeIsInteger) {
// Extract the register context so we can read arguments from registers.
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *f0_info = reg_ctx->GetRegisterInfoByName("f0", 0);
RegisterValue f0_value;
{
value.SetValueType(Value::eValueTypeScalar);
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
bool success = false;
} else if (type_flags & eTypeIsVector) // 'Packed'
{
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *vec_reg = reg_ctx->GetRegisterInfoByName("xmm0", 0);
if (vec_reg == nullptr)
// Extract the register context so we can read arguments from registers
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *xmm0_info =
reg_ctx->GetRegisterInfoByName("xmm0", 0);
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *altivec_reg =
reg_ctx->GetRegisterInfoByName("xmm0", 0);
if (type_flags & eTypeIsInteger) {
// Extract the register context so we can read arguments from registers
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (!byte_size)
return return_valobj_sp;
uint64_t raw_value = thread.GetRegisterContext()->ReadRegisterAsUnsigned(
// Don't handle complex yet.
} else {
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size <= sizeof(long double)) {
const RegisterInfo *xmm0_info =
reg_ctx->GetRegisterInfoByName("xmm0", 0);
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
llvm::Optional<uint64_t> byte_size =
- return_compiler_type.GetByteSize(nullptr);
+ return_compiler_type.GetByteSize(&thread);
if (byte_size && *byte_size > 0) {
const RegisterInfo *xmm_reg =
reg_ctx->GetRegisterInfoByName("xmm0", 0);
}
lldb::TargetSP target_sp(m_execution_unit.GetTarget());
- lldb_private::ExecutionContext exe_ctx(target_sp, true);
- llvm::Optional<uint64_t> bit_size =
- m_result_type.GetBitSize(exe_ctx.GetBestExecutionContextScope());
+ llvm::Optional<uint64_t> bit_size = m_result_type.GetBitSize(target_sp.get());
if (!bit_size) {
lldb_private::StreamString type_desc_stream;
m_result_type.DumpTypeDescription(&type_desc_stream);
m_result_name = lldb_private::ConstString("$RESULT_NAME");
LLDB_LOG(log, "Creating a new result global: \"{0}\" with size {1}",
- m_result_name, m_result_type.GetByteSize(nullptr).getValueOr(0));
+ m_result_name,
+ m_result_type.GetByteSize(target_sp.get()).getValueOr(0));
// Construct a new result global and set up its metadata
value_type = global_variable->getType();
}
- llvm::Optional<uint64_t> value_size = compiler_type.GetByteSize(nullptr);
+ auto *target = m_execution_unit.GetTarget().get();
+ llvm::Optional<uint64_t> value_size = compiler_type.GetByteSize(target);
if (!value_size)
return false;
- llvm::Optional<size_t> opt_alignment = compiler_type.GetTypeBitAlign(nullptr);
+ llvm::Optional<size_t> opt_alignment =
+ compiler_type.GetTypeBitAlign(target);
if (!opt_alignment)
return false;
lldb::offset_t value_alignment = (*opt_alignment + 7ull) / 8ull;
GetClangASTImporter().RequireCompleteType(ClangUtil::GetQualType(type));
SymbolFileDWARF *dwarf = die.GetDWARF();
- TypeSP type_sp(new Type(
- die.GetID(), dwarf, pcm_type_sp->GetName(), pcm_type_sp->GetByteSize(),
- nullptr, LLDB_INVALID_UID, Type::eEncodingInvalid,
- &pcm_type_sp->GetDeclaration(), type, Type::ResolveState::Forward,
- TypePayloadClang(GetOwningClangModule(die))));
+ TypeSP type_sp(new Type(die.GetID(), dwarf, pcm_type_sp->GetName(),
+ pcm_type_sp->GetByteSize(nullptr), nullptr,
+ LLDB_INVALID_UID, Type::eEncodingInvalid,
+ &pcm_type_sp->GetDeclaration(), type,
+ Type::ResolveState::Forward,
+ TypePayloadClang(GetOwningClangModule(die))));
dwarf->GetTypeList().Insert(type_sp);
dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
bool is_signed = false;
enumerator_clang_type.IsIntegerType(is_signed);
ParseChildEnumerators(clang_type, is_signed,
- type_sp->GetByteSize().getValueOr(0), die);
+ type_sp->GetByteSize(nullptr).getValueOr(0), die);
}
TypeSystemClang::CompleteTagDeclarationDefinition(clang_type);
} else {
attrs.bit_stride = array_info->bit_stride;
}
if (attrs.byte_stride == 0 && attrs.bit_stride == 0)
- attrs.byte_stride = element_type->GetByteSize().getValueOr(0);
+ attrs.byte_stride = element_type->GetByteSize(nullptr).getValueOr(0);
CompilerType array_element_type = element_type->GetForwardCompilerType();
CompleteType(array_element_type);
if (!layout_info.field_offsets.empty() || !layout_info.base_offsets.empty() ||
!layout_info.vbase_offsets.empty()) {
if (type)
- layout_info.bit_size = type->GetByteSize().getValueOr(0) * 8;
+ layout_info.bit_size = type->GetByteSize(nullptr).getValueOr(0) * 8;
if (layout_info.bit_size == 0)
layout_info.bit_size =
die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8;
bool is_signed = false;
clang_type.IsIntegerType(is_signed);
ParseChildEnumerators(clang_type, is_signed,
- type->GetByteSize().getValueOr(0), die);
+ type->GetByteSize(nullptr).getValueOr(0), die);
}
TypeSystemClang::CompleteTagDeclarationDefinition(clang_type);
}
this_field_info.bit_offset = data_bit_offset;
} else {
if (!byte_size)
- byte_size = member_type->GetByteSize();
+ byte_size = member_type->GetByteSize(nullptr);
ObjectFile *objfile = die.GetDWARF()->GetObjectFile();
if (objfile->GetByteOrder() == eByteOrderLittle) {
lldb::addr_t byte_size = 1;
if (var_sp->GetType())
byte_size =
- var_sp->GetType()->GetByteSize().getValueOr(0);
+ var_sp->GetType()->GetByteSize(nullptr).getValueOr(0);
m_global_aranges_up->Append(GlobalVariableMap::Entry(
file_addr, byte_size, var_sp.get()));
}
new SymbolFileType(*this, GetUID(type_die_form.Reference())));
if (const_value.Form() && type_sp && type_sp->GetType())
- location.UpdateValue(const_value.Unsigned(),
- type_sp->GetType()->GetByteSize().getValueOr(0),
- die.GetCU()->GetAddressByteSize());
+ location.UpdateValue(
+ const_value.Unsigned(),
+ type_sp->GetType()->GetByteSize(nullptr).getValueOr(0),
+ die.GetCU()->GetAddressByteSize());
var_sp = std::make_shared<Variable>(
die.GetID(), name, mangled, type_sp, scope, symbol_context_scope,
lldb::TypeSP modified_type = GetOrCreateType(mr.ModifiedType);
return std::make_shared<Type>(toOpaqueUid(type_id), this, ConstString(name),
- modified_type->GetByteSize(), nullptr,
+ modified_type->GetByteSize(nullptr), nullptr,
LLDB_INVALID_UID, Type::eEncodingIsUID, decl,
ct, Type::ResolveState::Full);
}
return std::make_shared<lldb_private::Type>(
toOpaqueUid(type_id), this, ConstString(uname),
- underlying_type->GetByteSize(), nullptr, LLDB_INVALID_UID,
+ underlying_type->GetByteSize(nullptr), nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, ct,
lldb_private::Type::ResolveState::Forward);
}
Declaration decl;
return std::make_shared<lldb_private::Type>(
- toOpaqueUid(id), this, ConstString(udt.Name), target_type->GetByteSize(),
- nullptr, target_type->GetID(), lldb_private::Type::eEncodingIsTypedefUID,
- decl, target_type->GetForwardCompilerType(),
+ toOpaqueUid(id), this, ConstString(udt.Name),
+ target_type->GetByteSize(nullptr), nullptr, target_type->GetID(),
+ lldb_private::Type::eEncodingIsTypedefUID, decl,
+ target_type->GetForwardCompilerType(),
lldb_private::Type::ResolveState::Forward);
}
CompilerType
TypeSystemClang::GetArrayElementType(lldb::opaque_compiler_type_t type,
- uint64_t *stride) {
+ uint64_t *stride,
+ ExecutionContextScope *exe_scope) {
if (type) {
clang::QualType qual_type(GetQualType(type));
// TODO: the real stride will be >= this value.. find the real one!
if (stride)
- if (Optional<uint64_t> size = element_type.GetByteSize(nullptr))
+ if (Optional<uint64_t> size = element_type.GetByteSize(exe_scope))
*stride = *size;
return element_type;
uint32_t opaque_payload);
CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
- uint64_t *stride) override;
+ uint64_t *stride,
+ ExecutionContextScope *exe_scope) override;
CompilerType GetArrayType(lldb::opaque_compiler_type_t type,
uint64_t size) override;
// Creating related types
-CompilerType CompilerType::GetArrayElementType(uint64_t *stride) const {
+CompilerType CompilerType::GetArrayElementType(ExecutionContextScope *exe_scope,
+ uint64_t *stride) const {
if (IsValid()) {
- return m_type_system->GetArrayElementType(m_type, stride);
+ return m_type_system->GetArrayElementType(m_type, stride, exe_scope);
}
return CompilerType();
}
bool CompilerType::GetValueAsScalar(const lldb_private::DataExtractor &data,
lldb::offset_t data_byte_offset,
- size_t data_byte_size,
- Scalar &value) const {
+ size_t data_byte_size, Scalar &value,
+ ExecutionContextScope *exe_scope) const {
if (!IsValid())
return false;
if (encoding == lldb::eEncodingInvalid || count != 1)
return false;
- llvm::Optional<uint64_t> byte_size = GetByteSize(nullptr);
+ llvm::Optional<uint64_t> byte_size = GetByteSize(exe_scope);
if (!byte_size)
return false;
lldb::offset_t offset = data_byte_offset;
Type *func_type = function->GetType();
if (func_type) {
s->Indent(" FuncType: ");
- func_type->GetDescription(s, level, false);
+ func_type->GetDescription(s, level, false, target);
s->EOL();
}
}
}
void Type::GetDescription(Stream *s, lldb::DescriptionLevel level,
- bool show_name) {
+ bool show_name, ExecutionContextScope *exe_scope) {
*s << "id = " << (const UserID &)*this;
// Call the name accessor to make sure we resolve the type name
}
// Call the get byte size accesor so we resolve our byte size
- if (GetByteSize())
+ if (GetByteSize(exe_scope))
s->Printf(", byte-size = %" PRIu64, m_byte_size);
bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
m_decl.Dump(s, show_fullpaths);
GetForwardCompilerType().DumpValue(
exe_ctx, s, format == lldb::eFormatDefault ? GetFormat() : format, data,
- data_byte_offset, GetByteSize().getValueOr(0),
+ data_byte_offset,
+ GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)
+ .getValueOr(0),
0, // Bitfield bit size
0, // Bitfield bit offset
show_types, show_summary, verbose, 0);
return m_encoding_type;
}
-llvm::Optional<uint64_t> Type::GetByteSize() {
+llvm::Optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
if (m_byte_size_has_value)
return m_byte_size;
case eEncodingIsTypedefUID: {
Type *encoding_type = GetEncodingType();
if (encoding_type)
- if (llvm::Optional<uint64_t> size = encoding_type->GetByteSize()) {
+ if (llvm::Optional<uint64_t> size = encoding_type->GetByteSize(exe_scope)) {
m_byte_size = *size;
m_byte_size_has_value = true;
return m_byte_size;
}
if (llvm::Optional<uint64_t> size =
- GetLayoutCompilerType().GetByteSize(nullptr)) {
+ GetLayoutCompilerType().GetByteSize(exe_scope)) {
m_byte_size = *size;
m_byte_size_has_value = true;
return m_byte_size;
return false;
}
- const uint64_t byte_size = GetByteSize().getValueOr(0);
+ const uint64_t byte_size =
+ GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)
+ .getValueOr(0);
if (data.GetByteSize() < byte_size) {
lldb::DataBufferSP data_sp(new DataBufferHeap(byte_size, '\0'));
data.SetData(data_sp);