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(
"<");
98 return lldb::ValueObjectSP();
99 if (m_tree ==
nullptr)
100 return lldb::ValueObjectSP();
102 while (idx >= m_elements_cache.size()) {
103 if (m_next_element ==
nullptr)
104 return lldb::ValueObjectSP();
107 ValueObjectSP node_sp = m_next_element->Dereference(
error);
108 if (!node_sp ||
error.Fail())
109 return lldb::ValueObjectSP();
111 ValueObjectSP value_sp =
112 node_sp->GetChildMemberWithName(
ConstString(
"__value_"),
true);
113 ValueObjectSP hash_sp =
114 node_sp->GetChildMemberWithName(
ConstString(
"__hash_"),
true);
115 if (!hash_sp || !value_sp) {
116 if (!m_element_type) {
117 auto p1_sp = m_backend.GetChildAtNamePath({
ConstString(
"__table_"),
122 ValueObjectSP first_sp =
nullptr;
123 switch (p1_sp->GetCompilerType().GetNumDirectBaseClasses()) {
126 first_sp = p1_sp->GetChildMemberWithName(
ConstString(
"__first_"),
131 ValueObjectSP first_elem_parent_sp =
132 p1_sp->GetChildAtIndex(0,
true);
133 first_sp = p1_sp->GetChildMemberWithName(
ConstString(
"__value_"),
143 m_element_type = first_sp->GetCompilerType();
144 m_element_type = m_element_type.GetTypeTemplateArgument(0);
145 m_element_type = m_element_type.GetPointeeType();
146 m_node_type = m_element_type;
147 m_element_type = m_element_type.GetTypeTemplateArgument(0);
157 0, name,
nullptr,
nullptr,
nullptr);
160 m_element_type = actual_type;
165 node_sp = node_sp->Cast(m_node_type);
166 value_sp = node_sp->GetChildMemberWithName(
ConstString(
"__value_"),
true);
167 hash_sp = node_sp->GetChildMemberWithName(
ConstString(
"__hash_"),
true);
168 if (!value_sp || !hash_sp)
171 m_elements_cache.push_back(
172 {value_sp.get(), hash_sp->GetValueAsUnsigned(0)});
174 node_sp->GetChildMemberWithName(
ConstString(
"__next_"),
true).get();
175 if (!m_next_element || m_next_element->GetValueAsUnsigned(0) == 0)
176 m_next_element =
nullptr;
179 std::pair<ValueObject *, uint64_t> val_hash = m_elements_cache[idx];
181 return lldb::ValueObjectSP();
183 stream.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
186 val_hash.first->GetData(data,
error);
188 return lldb::ValueObjectSP();
189 const bool thread_and_frame_only_if_stopped =
true;
191 thread_and_frame_only_if_stopped);
192 return CreateValueObjectFromData(stream.
GetString(), data, exe_ctx,
199 m_next_element =
nullptr;
200 m_elements_cache.clear();
201 ValueObjectSP table_sp =
202 m_backend.GetChildMemberWithName(
ConstString(
"__table_"),
true);
206 ValueObjectSP p2_sp = table_sp->GetChildMemberWithName(
208 ValueObjectSP num_elements_sp =
nullptr;
209 llvm::SmallVector<ConstString, 3> next_path;
210 switch (p2_sp->GetCompilerType().GetNumDirectBaseClasses()) {
213 num_elements_sp = p2_sp->GetChildMemberWithName(
220 ValueObjectSP first_elem_parent = p2_sp->GetChildAtIndex(0,
true);
221 num_elements_sp = first_elem_parent->GetChildMemberWithName(
231 if (!num_elements_sp)
234 m_tree = table_sp->GetChildAtNamePath(next_path).get();
235 if (m_tree ==
nullptr)
238 m_num_elements = num_elements_sp->GetValueAsUnsigned(0);
240 if (m_num_elements > 0)
242 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.