21#include "llvm/ADT/StringRef.h"
91 return m_num_elements;
97 if (scratch.consume_front(
"__") && std::isalnum(scratch[0])) {
98 scratch = scratch.drop_while([](
char c) {
return std::isalnum(c); });
99 if (scratch.consume_front(
"::")) {
109 if (name.consume_front(
"std::"))
111 return name.consume_front(type) && name.starts_with(
"<");
121 if (idx >= CalculateNumChildrenIgnoringErrors())
123 if (m_tree ==
nullptr)
126 while (idx >= m_elements_cache.size()) {
127 if (m_next_element ==
nullptr)
132 if (!node_sp ||
error.Fail())
135 ValueObjectSP value_sp = node_sp->GetChildMemberWithName(
"__value_");
136 ValueObjectSP hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
137 if (!hash_sp || !value_sp) {
138 if (!m_element_type) {
139 auto p1_sp = m_backend.GetChildAtNamePath({
"__table_",
"__p1_"});
147 m_element_type = first_sp->GetCompilerType();
148 m_element_type = m_element_type.GetTypeTemplateArgument(0);
149 m_element_type = m_element_type.GetPointeeType();
150 m_node_type = m_element_type;
151 m_element_type = m_element_type.GetTypeTemplateArgument(0);
161 0, name,
nullptr,
nullptr,
nullptr);
164 m_element_type = actual_type;
169 node_sp = m_next_element->Cast(m_node_type.GetPointerType())
170 ->Dereference(
error);
171 if (!node_sp ||
error.Fail())
174 hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
178 value_sp = node_sp->GetChildMemberWithName(
"__value_");
187 auto anon_union_sp = node_sp->GetChildAtIndex(2);
191 value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
196 m_elements_cache.push_back(
197 {value_sp.get(), hash_sp->GetValueAsUnsigned(0)});
198 m_next_element = node_sp->GetChildMemberWithName(
"__next_").get();
199 if (!m_next_element || m_next_element->GetValueAsUnsigned(0) == 0)
200 m_next_element =
nullptr;
203 std::pair<ValueObject *, uint64_t> val_hash = m_elements_cache[idx];
207 stream.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
210 val_hash.first->GetData(data,
error);
213 const bool thread_and_frame_only_if_stopped =
true;
215 thread_and_frame_only_if_stopped);
216 return CreateValueObjectFromData(stream.
GetString(), data, exe_ctx,
223 m_next_element =
nullptr;
224 m_elements_cache.clear();
225 ValueObjectSP table_sp = m_backend.GetChildMemberWithName(
"__table_");
229 ValueObjectSP p2_sp = table_sp->GetChildMemberWithName(
"__p2_");
234 if (!num_elements_sp)
237 ValueObjectSP p1_sp = table_sp->GetChildMemberWithName(
"__p1_");
245 m_tree = value_sp->GetChildMemberWithName(
"__next_").get();
246 if (m_tree ==
nullptr)
249 m_num_elements = num_elements_sp->GetValueAsUnsigned(0);
251 if (m_num_elements > 0)
252 m_next_element = m_tree;
289 TargetSP target_sp(valobj_sp->GetTargetSP());
300 auto hash_iter_sp = valobj_sp->GetChildMemberWithName(
"__i_");
305 auto hash_iter_type = hash_iter_sp->GetCompilerType();
306 if (!hash_iter_type.IsValid())
310 auto node_pointer_type = hash_iter_type.GetTypeTemplateArgument(0);
311 if (!node_pointer_type.IsValid())
316 auto hash_node_sp = hash_iter_sp->Cast(node_pointer_type);
320 auto key_value_sp = hash_node_sp->GetChildMemberWithName(
"__value_");
329 auto anon_union_sp = hash_node_sp->GetChildAtIndex(2);
333 key_value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
345 auto potential_child_sp = key_value_sp->Clone(
ConstString(
"pair"));
346 if (potential_child_sp)
347 if (potential_child_sp->GetNumChildrenIgnoringErrors() == 1)
348 if (
auto child0_sp = potential_child_sp->GetChildAtIndex(0);
349 child0_sp->GetName() ==
"__cc_" || child0_sp->GetName() ==
"__cc")
350 potential_child_sp = child0_sp->Clone(
ConstString(
"pair"));
352 m_pair_sp = potential_child_sp;
365 return m_pair_sp->GetChildAtIndex(idx);
378 if (name ==
"second")
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)
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.
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
std::shared_ptr< lldb_private::Target > TargetSP