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>
105template <
typename D32,
typename D64>
152 struct DataDescriptor_32 {
159 struct DataDescriptor_64 {
171 struct DataDescriptor_32 {
180 struct DataDescriptor_64 {
192 template <
typename DD>
198 DD descriptor = DD();
199 process.
ReadMemory(start_of_descriptor, &descriptor,
sizeof(descriptor),
204 return descriptor._used;
220template <
bool cf_style>
223 static constexpr llvm::StringLiteral g_TypeHint(
"NSSet");
237 if (!descriptor || !descriptor->IsValid())
240 uint32_t ptr_size = process_sp->GetAddressByteSize();
241 bool is_64bit = (ptr_size == 8);
250 ConstString class_name(descriptor->GetClassName());
253 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
261 if (class_name == g_SetI || class_name == g_OrderedSetI) {
263 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
267 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
268 }
else if (class_name == g_SetM) {
270 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
275 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
277 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
281 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
284 if (!cfbh.
Update(valobj_addr, exe_ctx))
289 auto iter = map.find(class_name), end = map.end();
291 return iter->second(valobj, stream, options);
296 llvm::StringRef prefix, suffix;
298 std::tie(prefix, suffix) = language->GetFormatterPrefixSuffix(g_TypeHint);
301 stream.
Printf(
"%" PRIu64
" %s%s", value,
"element", value == 1 ?
"" :
"s");
317 Flags flags(valobj_type.GetTypeInfo());
319 if (flags.IsClear(eTypeIsPointer)) {
321 valobj_sp = valobj_sp->AddressOf(
error);
322 if (
error.Fail() || !valobj_sp)
329 if (!descriptor || !descriptor->IsValid())
332 ConstString class_name = descriptor->GetClassName();
335 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
343 if (class_name == g_SetI || class_name == g_OrderedSetI) {
345 }
else if (class_name == g_SetM) {
346 AppleObjCRuntime *apple_runtime =
347 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
358 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
359 return (
new NSCFSetSyntheticFrontEnd(valobj_sp));
362 auto iter = map.find(class_name), end = map.end();
364 return iter->second(synth, valobj_sp);
383llvm::Expected<uint32_t>
405 m_ptr_size = process_sp->GetAddressByteSize();
406 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
428 if (idx >= num_children)
440 uint32_t test_idx = 0;
442 while (tries < num_children) {
447 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
468 auto ptr_size = process_sp->GetAddressByteSize();
474 *
reinterpret_cast<uint32_t *
>(buffer.
GetBytes()) =
475 static_cast<uint32_t
>(set_item.
item_ptr);
478 *
reinterpret_cast<uint64_t *
>(buffer.
GetBytes()) =
479 static_cast<uint64_t
>(set_item.
item_ptr);
482 lldbassert(
false &&
"pointer size is not 4 nor 8");
485 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
488 process_sp->GetByteOrder(),
489 process_sp->GetAddressByteSize());
493 m_backend.GetCompilerType().GetBasicTypeFromAST(
504llvm::Expected<uint32_t>
523 m_ptr_size = process_sp->GetAddressByteSize();
524 m_order = process_sp->GetByteOrder();
537 if (idx >= num_children)
549 uint32_t test_idx = 0;
555 while (tries < num_children) {
556 val_at_idx = m_values_ptr + (test_idx *
m_ptr_size);
558 val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx,
error);
586 *
reinterpret_cast<uint32_t *
>(buffer_sp->GetBytes()) =
587 static_cast<uint32_t
>(set_item.
item_ptr);
590 *
reinterpret_cast<uint64_t *
>(buffer_sp->GetBytes()) =
591 static_cast<uint64_t
>(set_item.
item_ptr);
594 lldbassert(
false &&
"pointer size is not 4 nor 8");
597 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
603 m_backend.GetCompilerType().GetBasicTypeFromAST(
610template <
typename D32,
typename D64>
619template <
typename D32,
typename D64>
628template <
typename D32,
typename D64>
629llvm::Expected<uint32_t>
637template <
typename D32,
typename D64>
655 m_ptr_size = process_sp->GetAddressByteSize();
656 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) +
m_ptr_size;
660 process_sp->ReadMemory(data_location,
m_data_32,
sizeof(D32),
664 process_sp->ReadMemory(data_location,
m_data_64,
sizeof(D64),
671template <
typename D32,
typename D64>
680 if (idx >= num_children)
692 uint32_t test_idx = 0;
694 while (tries < num_children) {
695 obj_at_idx = m_objs_addr + (test_idx *
m_ptr_size);
699 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
720 auto ptr_size = process_sp->GetAddressByteSize();
732 assert(
false &&
"pointer size is not 4 nor 8 - get out of here ASAP");
735 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
738 process_sp->GetByteOrder(),
739 process_sp->GetAddressByteSize());
743 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.
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