28std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
30 static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
34std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
36 static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>
109template <
typename D32,
typename D64>
158 struct DataDescriptor_32 {
165 struct DataDescriptor_64 {
177 struct DataDescriptor_32 {
186 struct DataDescriptor_64 {
198 template <
typename DD>
204 DD descriptor = DD();
205 process.
ReadMemory(start_of_descriptor, &descriptor,
sizeof(descriptor),
210 return descriptor._used;
226template <
bool cf_style>
229 static constexpr llvm::StringLiteral g_TypeHint(
"NSSet");
243 if (!descriptor || !descriptor->IsValid())
246 uint32_t ptr_size = process_sp->GetAddressByteSize();
247 bool is_64bit = (ptr_size == 8);
256 ConstString class_name(descriptor->GetClassName());
259 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
267 if (class_name == g_SetI || class_name == g_OrderedSetI) {
269 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
273 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
274 }
else if (class_name == g_SetM) {
276 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
281 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
283 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
287 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
290 if (!cfbh.
Update(valobj_addr, exe_ctx))
295 auto iter = map.find(class_name), end = map.end();
297 return iter->second(valobj, stream, options);
302 llvm::StringRef prefix, suffix;
304 std::tie(prefix, suffix) = language->GetFormatterPrefixSuffix(g_TypeHint);
307 stream.
Printf(
"%" PRIu64
" %s%s", value,
"element", value == 1 ?
"" :
"s");
323 Flags flags(valobj_type.GetTypeInfo());
325 if (flags.IsClear(eTypeIsPointer)) {
327 valobj_sp = valobj_sp->AddressOf(
error);
328 if (
error.Fail() || !valobj_sp)
335 if (!descriptor || !descriptor->IsValid())
338 ConstString class_name = descriptor->GetClassName();
341 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
349 if (class_name == g_SetI || class_name == g_OrderedSetI) {
351 }
else if (class_name == g_SetM) {
352 AppleObjCRuntime *apple_runtime =
353 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
364 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
365 return (
new NSCFSetSyntheticFrontEnd(valobj_sp));
368 auto iter = map.find(class_name), end = map.end();
370 return iter->second(synth, valobj_sp);
389llvm::Expected<size_t>
394 return llvm::createStringError(
"Type has no child named '%s'",
397 uint32_t idx = *optional_idx;
399 return llvm::createStringError(
"Type has no child named '%s'",
404llvm::Expected<uint32_t>
426 m_ptr_size = process_sp->GetAddressByteSize();
427 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
449 if (idx >= num_children)
461 uint32_t test_idx = 0;
463 while (tries < num_children) {
468 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
489 auto ptr_size = process_sp->GetAddressByteSize();
495 *
reinterpret_cast<uint32_t *
>(buffer.
GetBytes()) =
496 static_cast<uint32_t
>(set_item.
item_ptr);
499 *
reinterpret_cast<uint64_t *
>(buffer.
GetBytes()) =
500 static_cast<uint64_t
>(set_item.
item_ptr);
503 lldbassert(
false &&
"pointer size is not 4 nor 8");
506 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
509 process_sp->GetByteOrder(),
510 process_sp->GetAddressByteSize());
514 m_backend.GetCompilerType().GetBasicTypeFromAST(
525llvm::Expected<size_t>
530 return llvm::createStringError(
"Type has no child named '%s'",
533 uint32_t idx = *optional_idx;
535 return llvm::createStringError(
"Type has no child named '%s'",
540llvm::Expected<uint32_t>
559 m_ptr_size = process_sp->GetAddressByteSize();
560 m_order = process_sp->GetByteOrder();
573 if (idx >= num_children)
585 uint32_t test_idx = 0;
591 while (tries < num_children) {
592 val_at_idx = m_values_ptr + (test_idx *
m_ptr_size);
594 val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx,
error);
622 *
reinterpret_cast<uint32_t *
>(buffer_sp->GetBytes()) =
623 static_cast<uint32_t
>(set_item.
item_ptr);
626 *
reinterpret_cast<uint64_t *
>(buffer_sp->GetBytes()) =
627 static_cast<uint64_t
>(set_item.
item_ptr);
630 lldbassert(
false &&
"pointer size is not 4 nor 8");
633 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
639 m_backend.GetCompilerType().GetBasicTypeFromAST(
646template <
typename D32,
typename D64>
655template <
typename D32,
typename D64>
664template <
typename D32,
typename D64>
669 return llvm::createStringError(
"Type has no child named '%s'",
672 uint32_t idx = *optional_idx;
674 return llvm::createStringError(
"Type has no child named '%s'",
679template <
typename D32,
typename D64>
680llvm::Expected<uint32_t>
688template <
typename D32,
typename D64>
706 m_ptr_size = process_sp->GetAddressByteSize();
707 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
711 process_sp->ReadMemory(data_location,
m_data_32,
sizeof(D32),
715 process_sp->ReadMemory(data_location,
m_data_64,
sizeof(D64),
722template <
typename D32,
typename D64>
731 if (idx >= num_children)
743 uint32_t test_idx = 0;
745 while (tries < num_children) {
746 obj_at_idx = m_objs_addr + (test_idx *
m_ptr_size);
750 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
771 auto ptr_size = process_sp->GetAddressByteSize();
783 assert(
false &&
"pointer size is not 4 nor 8 - get out of here ASAP");
786 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
789 process_sp->GetByteOrder(),
790 process_sp->GetAddressByteSize());
794 m_backend.GetCompilerType().GetBasicTypeFromAST(
static llvm::raw_ostream & error(Stream &strm)
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 ...
uint32_t GetFoundationVersion()
bool Update(lldb::addr_t addr, ExecutionContextRef exe_ctx_rf)
Generic representation of a type in a programming language.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
Execution context objects refer to objects in the execution of the program that is being debugged.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static Language * FindPlugin(lldb::LanguageType language)
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
static ObjCLanguageRuntime * Get(Process &process)
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
uint32_t GetAddressByteSize() const
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
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)
lldb::LanguageType GetLanguage() const
lldb::ProcessSP GetProcessSP() const
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_INVALID_ADDRESS
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.
@ 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
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP