15#include "llvm/Support/Error.h"
16#include "llvm/Support/ErrorExtras.h"
92static llvm::Expected<uint32_t>
94 uint64_t value_type_size) {
99 if (start_val == 0 && finish_val == 0)
103 return llvm::createStringError(
"invalid value for start of vector");
106 return llvm::createStringError(
"invalid value for end of vector");
108 if (start_val > finish_val)
109 return llvm::createStringError(
110 "start of vector data begins after end pointer");
112 size_t num_children = (finish_val - start_val);
113 if (num_children % value_type_size)
114 return llvm::createStringError(
"size not multiple of element size");
116 return num_children / value_type_size;
121 return llvm::createStringError(
122 "size data member must be a built-in integer type");
129 return llvm::createStringError(
130 "failed to determine start/end of vector data");
140 assert(
false &&
"invalid vector layout");
141 return llvm::createStringError(
"invalid vector layout");
151 offset = offset +
m_start->GetValueAsUnsigned(0);
153 name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
172 llvm::Expected<uint64_t> size_or_err =
m_element_type.GetByteSize(
nullptr);
202llvm::Expected<size_t>
206 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
209 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
211 return *optional_idx;
242 size_t byte_idx = (idx >> 3);
243 size_t bit_index = (idx & 7);
251 size_t bytes_read = process_sp->ReadMemory(byte_location, &
byte, 1, err);
252 if (err.
Fail() || bytes_read == 0)
254 mask = 1 << bit_index;
255 bool bit_set = ((
byte & mask) != 0);
256 std::optional<uint64_t> size =
257 llvm::expectedToOptional(
m_bool_type.GetByteSize(
nullptr));
261 if (bit_set && buffer_sp && buffer_sp->GetBytes()) {
263 *(buffer_sp->GetBytes()) = 1;
266 name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
270 process_sp->GetAddressByteSize()),
284 ValueObjectSP size_sp(valobj_sp->GetChildMemberWithName(
"__size_"));
287 m_count = size_sp->GetValueAsUnsigned(0);
290 ValueObjectSP begin_sp(valobj_sp->GetChildMemberWithName(
"__begin_"));
303llvm::Expected<size_t>
307 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
310 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
312 uint32_t idx = *optional_idx;
314 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
static llvm::Expected< uint32_t > CalculateNumChildrenUsingPointerArithmetic(ValueObject *begin, ValueObject *end, uint64_t value_type_size)
static llvm::Expected< uint32_t > GetNumChildren(ValueObject *size)
#define LLDB_LOG_ERRORV(log, error,...)
Generic representation of a type in a programming language.
CompilerType GetTypeTemplateArgument(size_t idx, bool expand_pack=false) const
size_t GetNumTemplateArguments(bool expand_pack=false) const
Return the number of template arguments the type has.
ConstString GetTypeName(bool BaseOnly=false) const
bool IsInteger() const
This is used when you don't care about the signedness of the integer.
A subclass of DataBuffer that stores a data buffer on the heap.
Execution context objects refer to objects in the execution of the program that is being debugged.
bool Fail() const
Test for error condition.
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 CreateChildValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type, bool do_deref=true)
SyntheticChildrenFrontEnd(ValueObject &backend)
lldb::ValueObjectSP CreateChildValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
virtual lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name, bool can_create=true)
CompilerType GetCompilerType()
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.
@ eReuse
Children did not change and don't need to be recomputed; re-use what we computed the last time we cal...
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP