29 GenericBitsetFrontEnd(
ValueObject &valobj, StdLib stdlib);
50 std::vector<ValueObjectSP> m_elements;
54 uint8_t m_byte_size = 0;
59GenericBitsetFrontEnd::GenericBitsetFrontEnd(
ValueObject &valobj, StdLib stdlib)
62 if (
auto target_sp = m_backend.GetTargetSP()) {
63 m_byte_order = target_sp->GetArchitecture().GetByteOrder();
64 m_byte_size = target_sp->GetArchitecture().GetAddressByteSize();
69ConstString GenericBitsetFrontEnd::GetDataContainerMemberName() {
73 case StdLib::LibStdcpp:
76 llvm_unreachable(
"Unknown StdLib enum");
79bool GenericBitsetFrontEnd::Update() {
83 TargetSP target_sp = m_backend.GetTargetSP();
89 if (
auto arg = m_backend.GetCompilerType().GetIntegralTemplateArgument(0))
90 size = arg->value.getLimitedValue();
92 m_elements.assign(size, ValueObjectSP());
93 m_first = m_backend.GetChildMemberWithName(GetDataContainerMemberName(),
true)
98ValueObjectSP GenericBitsetFrontEnd::GetChildAtIndex(
size_t idx) {
99 if (idx >= m_elements.size() || !m_first)
100 return ValueObjectSP();
103 return m_elements[idx];
109 if (m_first->GetCompilerType().IsArrayType(&type)) {
110 std::optional<uint64_t> bit_size =
112 if (!bit_size || *bit_size == 0)
114 chunk = m_first->GetChildAtIndex(idx / *bit_size,
true);
116 type = m_first->GetCompilerType();
117 chunk = m_first->GetSP();
122 std::optional<uint64_t> bit_size =
124 if (!bit_size || *bit_size == 0)
126 size_t chunk_idx = idx % *bit_size;
127 uint8_t value = !!(chunk->GetValueAsUnsigned(0) & (uint64_t(1) << chunk_idx));
128 DataExtractor data(&value,
sizeof(value), m_byte_order, m_byte_size);
130 m_elements[idx] = CreateValueObjectFromData(llvm::formatv(
"[{0}]", idx).str(),
131 data, ctx, m_bool_type);
133 return m_elements[idx];
139 return new GenericBitsetFrontEnd(*valobj_sp,
140 GenericBitsetFrontEnd::StdLib::LibStdcpp);
147 return new GenericBitsetFrontEnd(*valobj_sp,
148 GenericBitsetFrontEnd::StdLib::LibCxx);
Generic representation of a type in a programming language.
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
std::optional< uint64_t > GetBitSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bits.
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
virtual size_t CalculateNumChildren()=0
virtual bool MightHaveChildren()=0
virtual size_t GetIndexOfChildWithName(ConstString name)=0
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx)=0
CompilerType GetCompilerType()
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.