21#include "llvm/ADT/StringRef.h"
22#include "llvm/Support/Error.h"
134 auto table_sp =
m_backend.GetChildMemberWithName(
"__table_");
139 *table_sp, 1,
"__first_node_",
"__p1_");
140 if (is_compressed_pair)
146 return node_sp->GetCompilerType().GetTypeTemplateArgument(0).GetPointeeType();
162 if (!node_sp ||
error.Fail())
165 ValueObjectSP value_sp = node_sp->GetChildMemberWithName(
"__value_");
166 ValueObjectSP hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
167 if (!hash_sp || !value_sp) {
169 ->Dereference(
error);
170 if (!node_sp ||
error.Fail())
173 hash_sp = node_sp->GetChildMemberWithName(
"__hash_");
177 value_sp = node_sp->GetChildMemberWithName(
"__value_");
186 auto anon_union_sp = node_sp->GetChildAtIndex(2);
190 value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
196 {value_sp.get(), hash_sp->GetValueAsUnsigned(0)});
197 m_next_element = node_sp->GetChildMemberWithName(
"__next_").get();
206 stream.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
209 val_hash.first->GetData(data,
error);
212 const bool thread_and_frame_only_if_stopped =
true;
214 thread_and_frame_only_if_stopped);
219llvm::Expected<size_t>
223 table, 2,
"__size_",
"__p2_");
224 if (!is_compressed_pair && size_sp)
225 return size_sp->GetValueAsUnsigned(0);
227 if (!is_compressed_pair)
228 return llvm::createStringError(
"Unsupported std::unordered_map layout.");
232 if (!num_elements_sp)
233 return llvm::createStringError(
234 "Unexpected std::unordered_map layout: failed to retrieve first member "
235 "in old __compressed_pair layout.");
237 return num_elements_sp->GetValueAsUnsigned(0);
242 table, 1,
"__first_node_",
"__p1_");
243 if (is_compressed_pair)
249 return tree_sp->GetChildMemberWithName(
"__next_");
279 num_elems_or_err.takeError(),
"{0}");
289llvm::Expected<size_t>
294 return llvm::createStringError(
"Type has no child named '%s'",
297 return *optional_idx;
322 TargetSP target_sp(valobj_sp->GetTargetSP());
333 auto hash_iter_sp = valobj_sp->GetChildMemberWithName(
"__i_");
338 auto hash_iter_type = hash_iter_sp->GetCompilerType();
339 if (!hash_iter_type.IsValid())
343 auto node_pointer_type = hash_iter_type.GetTypeTemplateArgument(0);
344 if (!node_pointer_type.IsValid())
349 auto hash_node_sp = hash_iter_sp->Cast(node_pointer_type);
353 auto key_value_sp = hash_node_sp->GetChildMemberWithName(
"__value_");
362 auto anon_union_sp = hash_node_sp->GetChildAtIndex(2);
366 key_value_sp = anon_union_sp->GetChildMemberWithName(
"__value_");
378 auto potential_child_sp = key_value_sp->Clone(
ConstString(
"pair"));
379 if (potential_child_sp)
380 if (potential_child_sp->GetNumChildrenIgnoringErrors() == 1)
381 if (
auto child0_sp = potential_child_sp->GetChildAtIndex(0);
382 child0_sp->GetName() ==
"__cc_" || child0_sp->GetName() ==
"__cc")
383 potential_child_sp = child0_sp->Clone(
ConstString(
"pair"));
402llvm::Expected<size_t>
407 if (name ==
"second")
409 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.
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.
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)
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