21#include "llvm/ADT/StringRef.h"
67 return m_num_elements;
73 if (scratch.consume_front(
"__") && std::isalnum(scratch[0])) {
74 scratch = scratch.drop_while([](
char c) {
return std::isalnum(c); });
75 if (scratch.consume_front(
"::")) {
85 if (name.consume_front(
"std::"))
87 return name.consume_front(type) && name.startswith(
"<");
99 if (m_tree ==
nullptr)
102 while (idx >= m_elements_cache.size()) {
103 if (m_next_element ==
nullptr)
108 if (!node_sp ||
error.Fail())
111 ValueObjectSP value_sp = node_sp->GetChildMemberWithName(
"__value_");
112 ValueObjectSP hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
113 if (!hash_sp || !value_sp) {
114 if (!m_element_type) {
115 auto p1_sp = m_backend.GetChildAtNamePath({
"__table_",
"__p1_"});
120 switch (p1_sp->GetCompilerType().GetNumDirectBaseClasses()) {
123 first_sp = p1_sp->GetChildMemberWithName(
"__first_");
128 p1_sp->GetChildAtIndex(0);
129 first_sp = p1_sp->GetChildMemberWithName(
"__value_");
138 m_element_type = first_sp->GetCompilerType();
139 m_element_type = m_element_type.GetTypeTemplateArgument(0);
140 m_element_type = m_element_type.GetPointeeType();
141 m_node_type = m_element_type;
142 m_element_type = m_element_type.GetTypeTemplateArgument(0);
152 0, name,
nullptr,
nullptr,
nullptr);
155 m_element_type = actual_type;
160 node_sp = m_next_element->Cast(m_node_type.GetPointerType())
161 ->Dereference(
error);
162 if (!node_sp ||
error.Fail())
165 value_sp = node_sp->GetChildMemberWithName(
"__value_");
166 hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
167 if (!value_sp || !hash_sp)
170 m_elements_cache.push_back(
171 {value_sp.get(), hash_sp->GetValueAsUnsigned(0)});
172 m_next_element = node_sp->GetChildMemberWithName(
"__next_").get();
173 if (!m_next_element || m_next_element->GetValueAsUnsigned(0) == 0)
174 m_next_element =
nullptr;
177 std::pair<ValueObject *, uint64_t> val_hash = m_elements_cache[idx];
181 stream.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
184 val_hash.first->GetData(data,
error);
187 const bool thread_and_frame_only_if_stopped =
true;
189 thread_and_frame_only_if_stopped);
190 return CreateValueObjectFromData(stream.
GetString(), data, exe_ctx,
197 m_next_element =
nullptr;
198 m_elements_cache.clear();
199 ValueObjectSP table_sp = m_backend.GetChildMemberWithName(
"__table_");
203 ValueObjectSP p2_sp = table_sp->GetChildMemberWithName(
"__p2_");
205 llvm::SmallVector<llvm::StringRef, 3> next_path;
206 switch (p2_sp->GetCompilerType().GetNumDirectBaseClasses()) {
209 num_elements_sp = p2_sp->GetChildMemberWithName(
"__first_");
210 next_path.append({
"__p1_",
"__first_",
"__next_"});
215 num_elements_sp = first_elem_parent->GetChildMemberWithName(
"__value_");
216 next_path.append({
"__p1_",
"__value_",
"__next_"});
223 if (!num_elements_sp)
226 m_tree = table_sp->GetChildAtNamePath(next_path).get();
227 if (m_tree ==
nullptr)
230 m_num_elements = num_elements_sp->GetValueAsUnsigned(0);
232 if (m_num_elements > 0)
234 table_sp->GetChildAtNamePath(next_path).get();
static llvm::raw_ostream & error(Stream &strm)
static bool isStdTemplate(ConstString type_name, llvm::StringRef type)
static bool isUnorderedMap(ConstString type_name)
static void consumeInlineNamespace(llvm::StringRef &name)
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 GetFieldAtIndex(size_t idx, std::string &name, uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) const
ConstString GetTypeName(bool BaseOnly=false) const
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
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