21#include "llvm/ADT/StringRef.h"
22#include "llvm/Support/Error.h"
23#include "llvm/Support/ErrorExtras.h"
133 auto table_sp =
m_backend.GetChildMemberWithName(
"__table_");
137 auto [node_sp, is_compressed_pair] =
139 if (is_compressed_pair)
145 return node_sp->GetCompilerType().GetTypeTemplateArgument(0).GetPointeeType();
161 if (!node_sp ||
error.Fail())
164 ValueObjectSP value_sp = node_sp->GetChildMemberWithName(
"__value_");
165 ValueObjectSP hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
166 if (!hash_sp || !value_sp) {
168 ->Dereference(
error);
169 if (!node_sp ||
error.Fail())
172 hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
176 value_sp = node_sp->GetChildMemberWithName(
"__value_");
185 auto anon_union_sp = node_sp->GetChildAtIndex(2);
189 value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
195 m_next_element = node_sp->GetChildMemberWithName(
"__next_").get();
204 stream.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
210 const bool thread_and_frame_only_if_stopped =
true;
217llvm::Expected<size_t>
220 auto [size_sp, is_compressed_pair] =
222 if (!is_compressed_pair && size_sp)
223 return size_sp->GetValueAsUnsigned(0);
225 if (!is_compressed_pair)
226 return llvm::createStringError(
"unsupported std::unordered_map layout");
230 if (!num_elements_sp)
231 return llvm::createStringError(
232 "Unexpected std::unordered_map layout: failed to retrieve first member "
233 "in old __compressed_pair layout.");
235 return num_elements_sp->GetValueAsUnsigned(0);
239 auto [tree_sp, is_compressed_pair] =
241 if (is_compressed_pair)
247 return tree_sp->GetChildMemberWithName(
"__next_");
277 num_elems_or_err.takeError(),
"{0}");
309 TargetSP target_sp(valobj_sp->GetTargetSP());
320 auto hash_iter_sp = valobj_sp->GetChildMemberWithName(
"__i_");
325 auto hash_iter_type = hash_iter_sp->GetCompilerType();
326 if (!hash_iter_type.IsValid())
330 auto node_pointer_type = hash_iter_type.GetTypeTemplateArgument(0);
331 if (!node_pointer_type.IsValid())
336 auto hash_node_sp = hash_iter_sp->Cast(node_pointer_type);
340 auto key_value_sp = hash_node_sp->GetChildMemberWithName(
"__value_");
349 auto anon_union_sp = hash_node_sp->GetChildAtIndex(2);
353 key_value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
365 auto potential_child_sp = key_value_sp->Clone(
ConstString(
"pair"));
366 if (potential_child_sp)
367 if (potential_child_sp->GetNumChildrenIgnoringErrors() == 1)
368 if (
auto child0_sp = potential_child_sp->GetChildAtIndex(0);
369 child0_sp->GetName() ==
"__cc_" || child0_sp->GetName() ==
"__cc")
370 potential_child_sp = child0_sp->Clone(
ConstString(
"pair"));
389llvm::Expected<size_t>
394 if (name ==
"second")
396 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
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.
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