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");
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) {
353 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
364 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
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>
428 m_ptr_size = process_sp->GetAddressByteSize();
429 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
451 if (idx >= num_children)
463 uint32_t test_idx = 0;
465 while (tries < num_children) {
470 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
491 auto ptr_size = process_sp->GetAddressByteSize();
497 *
reinterpret_cast<uint32_t *
>(buffer.
GetBytes()) =
498 static_cast<uint32_t
>(set_item.
item_ptr);
501 *
reinterpret_cast<uint64_t *
>(buffer.
GetBytes()) =
502 static_cast<uint64_t
>(set_item.
item_ptr);
505 lldbassert(
false &&
"pointer size is not 4 nor 8");
508 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
511 process_sp->GetByteOrder(),
512 process_sp->GetAddressByteSize());
516 m_backend.GetCompilerType().GetBasicTypeFromAST(
527llvm::Expected<size_t>
532 return llvm::createStringError(
"Type has no child named '%s'",
535 uint32_t idx = *optional_idx;
537 return llvm::createStringError(
"Type has no child named '%s'",
542llvm::Expected<uint32_t>
561 m_ptr_size = process_sp->GetAddressByteSize();
562 m_order = process_sp->GetByteOrder();
575 if (idx >= num_children)
587 uint32_t test_idx = 0;
593 while (tries < num_children) {
594 val_at_idx = m_values_ptr + (test_idx *
m_ptr_size);
596 val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx,
error);
624 *
reinterpret_cast<uint32_t *
>(buffer_sp->GetBytes()) =
625 static_cast<uint32_t
>(set_item.
item_ptr);
628 *
reinterpret_cast<uint64_t *
>(buffer_sp->GetBytes()) =
629 static_cast<uint64_t
>(set_item.
item_ptr);
632 lldbassert(
false &&
"pointer size is not 4 nor 8");
635 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
641 m_backend.GetCompilerType().GetBasicTypeFromAST(
648template <
typename D32,
typename D64>
657template <
typename D32,
typename D64>
666template <
typename D32,
typename D64>
671 return llvm::createStringError(
"Type has no child named '%s'",
674 uint32_t idx = *optional_idx;
676 return llvm::createStringError(
"Type has no child named '%s'",
681template <
typename D32,
typename D64>
682llvm::Expected<uint32_t>
690template <
typename D32,
typename D64>
708 m_ptr_size = process_sp->GetAddressByteSize();
709 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
713 process_sp->ReadMemory(data_location,
m_data_32,
sizeof(D32),
717 process_sp->ReadMemory(data_location,
m_data_64,
sizeof(D64),
724template <
typename D32,
typename D64>
733 if (idx >= num_children)
745 uint32_t test_idx = 0;
747 while (tries < num_children) {
748 obj_at_idx = m_objs_addr + (test_idx *
m_ptr_size);
752 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
773 auto ptr_size = process_sp->GetAddressByteSize();
785 assert(
false &&
"pointer size is not 4 nor 8 - get out of here ASAP");
788 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
791 process_sp->GetByteOrder(),
792 process_sp->GetAddressByteSize());
796 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.
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_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.
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.
bool IsClear(ValueType bit) const
Test a single flag bit to see if it is clear (zero).
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