29 GenericBitsetFrontEnd(
ValueObject &valobj, StdLib stdlib);
41 llvm::StringRef GetDataContainerMemberName();
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();
69llvm::StringRef GenericBitsetFrontEnd::GetDataContainerMemberName() {
70 static constexpr llvm::StringLiteral s_libcxx_case(
"__first_");
71 static constexpr llvm::StringLiteral s_libstdcpp_case(
"_M_w");
75 case StdLib::LibStdcpp:
76 return s_libstdcpp_case;
78 llvm_unreachable(
"Unknown StdLib enum");
81bool GenericBitsetFrontEnd::Update() {
85 TargetSP target_sp = m_backend.GetTargetSP();
91 if (
auto arg = m_backend.GetCompilerType().GetIntegralTemplateArgument(0))
92 size = arg->value.getLimitedValue();
96 m_backend.GetChildMemberWithName(GetDataContainerMemberName()).get();
100ValueObjectSP GenericBitsetFrontEnd::GetChildAtIndex(
size_t idx) {
101 if (idx >= m_elements.size() || !m_first)
105 return m_elements[idx];
111 if (m_first->GetCompilerType().IsArrayType(&type)) {
112 std::optional<uint64_t> bit_size =
114 if (!bit_size || *bit_size == 0)
116 chunk = m_first->GetChildAtIndex(idx / *bit_size);
118 type = m_first->GetCompilerType();
119 chunk = m_first->GetSP();
124 std::optional<uint64_t> bit_size =
126 if (!bit_size || *bit_size == 0)
128 size_t chunk_idx = idx % *bit_size;
129 uint8_t value = !!(chunk->GetValueAsUnsigned(0) & (uint64_t(1) << chunk_idx));
130 DataExtractor data(&value,
sizeof(value), m_byte_order, m_byte_size);
132 m_elements[idx] = CreateValueObjectFromData(llvm::formatv(
"[{0}]", idx).str(),
133 data, ctx, m_bool_type);
135 return m_elements[idx];
141 return new GenericBitsetFrontEnd(*valobj_sp,
142 GenericBitsetFrontEnd::StdLib::LibStdcpp);
149 return new GenericBitsetFrontEnd(*valobj_sp,
150 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.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Target > TargetSP