87 if (!m_start || !m_finish)
89 uint64_t start_val = m_start->GetValueAsUnsigned(0);
90 uint64_t finish_val = m_finish->GetValueAsUnsigned(0);
92 if (start_val == 0 || finish_val == 0)
95 if (start_val >= finish_val)
98 size_t num_children = (finish_val - start_val);
99 if (num_children % m_element_size)
101 return num_children / m_element_size;
107 if (!m_start || !m_finish)
110 uint64_t offset = idx * m_element_size;
111 offset = offset + m_start->GetValueAsUnsigned(0);
113 name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
114 return CreateValueObjectFromAddress(name.
GetString(), offset,
115 m_backend.GetExecutionContextRef(),
120 m_start = m_finish =
nullptr;
122 m_backend.GetChildMemberWithName(
"__end_cap_"));
123 if (!data_type_finder_sp)
126 switch (data_type_finder_sp->GetCompilerType().GetNumDirectBaseClasses()) {
129 data_type_finder_sp =
130 data_type_finder_sp->GetChildMemberWithName(
"__first_");
135 data_type_finder_sp->GetChildAtIndex(0);
136 data_type_finder_sp =
137 first_elem_parent_sp->GetChildMemberWithName(
"__value_");
144 if (!data_type_finder_sp)
146 m_element_type = data_type_finder_sp->GetCompilerType().GetPointeeType();
147 if (std::optional<uint64_t> size = m_element_type.GetByteSize(
nullptr)) {
148 m_element_size = *size;
150 if (m_element_size > 0) {
152 m_start = m_backend.GetChildMemberWithName(
"__begin_").get();
153 m_finish = m_backend.GetChildMemberWithName(
"__end_").get();
166 if (!m_start || !m_finish)
190 auto iter = m_children.find(idx), end = m_children.end();
195 if (m_base_data_address == 0 || m_count == 0)
199 size_t byte_idx = (idx >> 3);
200 size_t bit_index = (idx & 7);
201 lldb::addr_t byte_location = m_base_data_address + byte_idx;
202 ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
208 size_t bytes_read = process_sp->ReadMemory(byte_location, &
byte, 1, err);
209 if (err.
Fail() || bytes_read == 0)
211 mask = 1 << bit_index;
212 bool bit_set = ((
byte & mask) != 0);
213 std::optional<uint64_t> size = m_bool_type.GetByteSize(
nullptr);
217 if (bit_set && buffer_sp && buffer_sp->GetBytes()) {
219 *(buffer_sp->GetBytes()) = 1;
222 name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
226 process_sp->GetAddressByteSize()),
227 m_exe_ctx_ref, m_bool_type));
229 m_children[idx] = retval_sp;
249 m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
250 ValueObjectSP size_sp(valobj_sp->GetChildMemberWithName(
"__size_"));
253 m_count = size_sp->GetValueAsUnsigned(0);
256 ValueObjectSP begin_sp(valobj_sp->GetChildMemberWithName(
"__begin_"));
261 m_base_data_address = begin_sp->GetValueAsUnsigned(0);
262 if (!m_base_data_address) {
271 if (!m_count || !m_base_data_address)
static size_t CalculateNumChildren(CompilerType container_type, CompilerType element_type, lldb_private::ExecutionContextScope *exe_scope=nullptr)
Generic representation of a type in a programming language.
CompilerType GetTypeTemplateArgument(size_t idx, bool expand_pack=false) const
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
size_t GetNumTemplateArguments(bool expand_pack=false) const
Return the number of template arguments the type has.
ConstString GetTypeName(bool BaseOnly=false) const
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
A subclass of DataBuffer that stores a data buffer on the heap.
Execution context objects refer to objects in the execution of the program that is being debugged.
bool Fail() const
Test for error condition.
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP