29 GenericBitsetFrontEnd(
ValueObject &valobj, StdLib stdlib);
38 return m_elements.size();
43 llvm::StringRef GetDataContainerMemberName();
52 std::vector<ValueObjectSP> m_elements;
56 uint8_t m_byte_size = 0;
61GenericBitsetFrontEnd::GenericBitsetFrontEnd(
ValueObject &valobj, StdLib stdlib)
64 if (
auto target_sp = m_backend.GetTargetSP()) {
65 m_byte_order = target_sp->GetArchitecture().GetByteOrder();
66 m_byte_size = target_sp->GetArchitecture().GetAddressByteSize();
71llvm::StringRef GenericBitsetFrontEnd::GetDataContainerMemberName() {
72 static constexpr llvm::StringLiteral s_libcxx_case(
"__first_");
73 static constexpr llvm::StringLiteral s_libstdcpp_case(
"_M_w");
77 case StdLib::LibStdcpp:
78 return s_libstdcpp_case;
80 llvm_unreachable(
"Unknown StdLib enum");
87 TargetSP target_sp = m_backend.GetTargetSP();
93 if (
auto arg = m_backend.GetCompilerType().GetIntegralTemplateArgument(0))
94 size = arg->value.getLimitedValue();
98 m_backend.GetChildMemberWithName(GetDataContainerMemberName()).get();
102ValueObjectSP GenericBitsetFrontEnd::GetChildAtIndex(uint32_t idx) {
103 if (idx >= m_elements.size() || !m_first)
107 return m_elements[idx];
113 if (m_first->GetCompilerType().IsArrayType(&type)) {
114 std::optional<uint64_t> bit_size =
116 if (!bit_size || *bit_size == 0)
118 chunk = m_first->GetChildAtIndex(idx / *bit_size);
120 type = m_first->GetCompilerType();
121 chunk = m_first->GetSP();
126 std::optional<uint64_t> bit_size =
128 if (!bit_size || *bit_size == 0)
130 size_t chunk_idx = idx % *bit_size;
131 uint8_t value = !!(chunk->GetValueAsUnsigned(0) & (uint64_t(1) << chunk_idx));
132 DataExtractor data(&value,
sizeof(value), m_byte_order, m_byte_size);
134 m_elements[idx] = CreateValueObjectFromData(llvm::formatv(
"[{0}]", idx).str(),
135 data, ctx, m_bool_type);
137 return m_elements[idx];
143 return new GenericBitsetFrontEnd(*valobj_sp,
144 GenericBitsetFrontEnd::StdLib::LibStdcpp);
151 return new GenericBitsetFrontEnd(*valobj_sp,
152 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 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx)=0
virtual lldb::ChildCacheState Update()=0
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
virtual bool MightHaveChildren()=0
virtual size_t GetIndexOfChildWithName(ConstString name)=0
virtual llvm::Expected< uint32_t > CalculateNumChildren()=0
CompilerType GetCompilerType()
A class that represents a running process on the host machine.
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
@ eRefetch
Children need to be recomputed dynamically.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Target > TargetSP