16#include "llvm/Support/Error.h"
17#include "llvm/Support/ErrorExtras.h"
93static llvm::Expected<uint32_t>
95 uint64_t value_type_size) {
100 if (start_val == 0 && finish_val == 0)
104 return llvm::createStringError(
"invalid value for start of vector");
107 return llvm::createStringError(
"invalid value for end of vector");
109 if (start_val > finish_val)
110 return llvm::createStringError(
111 "start of vector data begins after end pointer");
113 size_t num_children = (finish_val - start_val);
114 if (num_children % value_type_size)
115 return llvm::createStringError(
"size not multiple of element size");
117 return num_children / value_type_size;
122 return llvm::createStringError(
123 "size data member must be a built-in integer type");
130 return llvm::createStringError(
131 "failed to determine start/end of vector data");
149 offset = offset +
m_start->GetValueAsUnsigned(0);
151 name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
170 llvm::Expected<uint64_t> size_or_err =
m_element_type.GetByteSize(
nullptr);
200llvm::Expected<size_t>
204 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
207 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
209 return *optional_idx;
240 size_t byte_idx = (idx >> 3);
241 size_t bit_index = (idx & 7);
249 size_t bytes_read = process_sp->ReadMemory(byte_location, &
byte, 1, err);
250 if (err.
Fail() || bytes_read == 0)
252 mask = 1 << bit_index;
253 bool bit_set = ((
byte & mask) != 0);
254 std::optional<uint64_t> size =
255 llvm::expectedToOptional(
m_bool_type.GetByteSize(
nullptr));
259 if (bit_set && buffer_sp && buffer_sp->GetBytes()) {
261 *(buffer_sp->GetBytes()) = 1;
264 name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
268 process_sp->GetAddressByteSize()),
282 ValueObjectSP size_sp(valobj_sp->GetChildMemberWithName(
"__size_"));
285 m_count = size_sp->GetValueAsUnsigned(0);
288 ValueObjectSP begin_sp(valobj_sp->GetChildMemberWithName(
"__begin_"));
301llvm::Expected<size_t>
305 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
308 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
310 uint32_t idx = *optional_idx;
312 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 uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
const char * AsCString(const char *value_if_empty) const
Get the string value as a C string.
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