14#include "llvm/Support/ErrorExtras.h"
26 : SyntheticChildrenFrontEnd(*valobj_sp) {
32 if (!m_start || m_element_size == 0)
38 if (!m_start || idx >= m_count)
41 uint64_t offset = m_start->GetValueAsUnsigned(0) +
42 static_cast<uint64_t
>(idx) * m_element_size;
44 name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
45 return CreateChildValueObjectFromAddress(name.
GetString(), offset,
46 m_backend.GetExecutionContextRef(),
55 ValueObjectSP start = m_backend.GetChildMemberWithName(
"_Myptr");
56 ValueObjectSP size_sp = m_backend.GetChildMemberWithName(
"_Mysize");
57 if (!start || !size_sp)
58 return ChildCacheState::eRefetch;
63 m_element_type = start->GetCompilerType().GetPointeeType();
64 if (!m_element_type.IsValid()) {
65 CompilerType type = m_backend.GetCompilerType().GetNonReferenceType();
68 if (!m_element_type.IsValid())
69 return ChildCacheState::eRefetch;
71 if (std::optional<uint64_t> size =
72 llvm::expectedToOptional(m_element_type.GetByteSize(
nullptr)))
73 m_element_size = *size;
75 if (m_element_size == 0)
76 return ChildCacheState::eRefetch;
78 m_start = start.get();
79 m_count = size_sp->GetValueAsUnsigned(0);
80 return ChildCacheState::eRefetch;
83 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name)
override {
85 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
88 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
94 ValueObject *m_start =
nullptr;
95 CompilerType m_element_type;
96 uint32_t m_element_size = 0;
103 return valobj_sp->GetChildMemberWithName(
"_Myptr") !=
nullptr;
111 return new MsvcStlValarraySyntheticFrontEnd(valobj_sp);
static std::optional< size_t > CalculateNumChildren(CompilerType container_elem_type, uint64_t num_elements, CompilerType element_type)
Calculates the number of elements stored in a container (with element type 'container_elem_type') as ...
CompilerType GetTypeTemplateArgument(size_t idx, bool expand_pack=false) const
const char * GetCString() const
Get the string value as a C string.
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
virtual lldb::ValueObjectSP GetNonSyntheticValue()
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.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP