21#include "llvm/ADT/StringRef.h"
22#include "llvm/Support/Error.h"
132 auto table_sp =
m_backend.GetChildMemberWithName(
"__table_");
136 auto [node_sp, is_compressed_pair] =
138 if (is_compressed_pair)
144 return node_sp->GetCompilerType().GetTypeTemplateArgument(0).GetPointeeType();
160 if (!node_sp ||
error.Fail())
163 ValueObjectSP value_sp = node_sp->GetChildMemberWithName(
"__value_");
164 ValueObjectSP hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
165 if (!hash_sp || !value_sp) {
167 ->Dereference(
error);
168 if (!node_sp ||
error.Fail())
171 hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
175 value_sp = node_sp->GetChildMemberWithName(
"__value_");
184 auto anon_union_sp = node_sp->GetChildAtIndex(2);
188 value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
194 m_next_element = node_sp->GetChildMemberWithName(
"__next_").get();
203 stream.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
209 const bool thread_and_frame_only_if_stopped =
true;
216llvm::Expected<size_t>
219 auto [size_sp, is_compressed_pair] =
221 if (!is_compressed_pair && size_sp)
222 return size_sp->GetValueAsUnsigned(0);
224 if (!is_compressed_pair)
225 return llvm::createStringError(
"Unsupported std::unordered_map layout.");
229 if (!num_elements_sp)
230 return llvm::createStringError(
231 "Unexpected std::unordered_map layout: failed to retrieve first member "
232 "in old __compressed_pair layout.");
234 return num_elements_sp->GetValueAsUnsigned(0);
238 auto [tree_sp, is_compressed_pair] =
240 if (is_compressed_pair)
246 return tree_sp->GetChildMemberWithName(
"__next_");
276 num_elems_or_err.takeError(),
"{0}");
308 TargetSP target_sp(valobj_sp->GetTargetSP());
319 auto hash_iter_sp = valobj_sp->GetChildMemberWithName(
"__i_");
324 auto hash_iter_type = hash_iter_sp->GetCompilerType();
325 if (!hash_iter_type.IsValid())
329 auto node_pointer_type = hash_iter_type.GetTypeTemplateArgument(0);
330 if (!node_pointer_type.IsValid())
335 auto hash_node_sp = hash_iter_sp->Cast(node_pointer_type);
339 auto key_value_sp = hash_node_sp->GetChildMemberWithName(
"__value_");
348 auto anon_union_sp = hash_node_sp->GetChildAtIndex(2);
352 key_value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
364 auto potential_child_sp = key_value_sp->Clone(
ConstString(
"pair"));
365 if (potential_child_sp)
366 if (potential_child_sp->GetNumChildrenIgnoringErrors() == 1)
367 if (
auto child0_sp = potential_child_sp->GetChildAtIndex(0);
368 child0_sp->GetName() ==
"__cc_" || child0_sp->GetName() ==
"__cc")
369 potential_child_sp = child0_sp->Clone(
ConstString(
"pair"));
388llvm::Expected<size_t>
393 if (name ==
"second")
395 return llvm::createStringError(
"Type has no child named '%s'",
static llvm::raw_ostream & error(Stream &strm)
static ValueObjectSP GetTreePointer(ValueObject &table)
static bool isUnorderedMap(ConstString type_name)
#define LLDB_LOG_ERRORV(log, error,...)
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
CompilerType GetDirectNestedTypeWithName(llvm::StringRef name) const
ConstString GetTypeName(bool BaseOnly=false) const
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
CompilerType GetCanonicalType() const
bool IsPointerOrReferenceType(CompilerType *pointee_type=nullptr) const
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const
Create an ExecutionContext object from this object.
"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.
uint32_t CalculateNumChildrenIgnoringErrors(uint32_t max=UINT32_MAX)
lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
SyntheticChildrenFrontEnd(ValueObject &backend)
virtual uint64_t GetData(DataExtractor &data, Status &error)
const ExecutionContextRef & GetExecutionContextRef() const
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
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