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>
51 lldb::ValueObjectSP GetChildAtIndex(
size_t idx)
override;
53 bool Update()
override;
55 bool MightHaveChildren()
override;
57 size_t GetIndexOfChildWithName(
ConstString name)
override;
76 uint8_t m_ptr_size = 8;
89 lldb::ValueObjectSP GetChildAtIndex(
size_t idx)
override;
91 bool Update()
override;
93 bool MightHaveChildren()
override;
95 size_t GetIndexOfChildWithName(
ConstString name)
override;
104 uint8_t m_ptr_size = 8;
113template <
typename D32,
typename D64>
122 lldb::ValueObjectSP GetChildAtIndex(
size_t idx)
override;
124 bool Update()
override;
126 bool MightHaveChildren()
override;
128 size_t GetIndexOfChildWithName(
ConstString name)
override;
138 uint8_t m_ptr_size = 8;
144namespace Foundation1300 {
163namespace Foundation1428 {
164 struct DataDescriptor_32 {
171 struct DataDescriptor_64 {
182namespace Foundation1437 {
183 struct DataDescriptor_32 {
192 struct DataDescriptor_64 {
204 template <
typename DD>
210 DD descriptor = DD();
211 process.
ReadMemory(start_of_descriptor, &descriptor,
sizeof(descriptor),
216 return descriptor._used;
223 return __NSSetMSize_Impl<DataDescriptor_32>(process, valobj_addr,
error);
225 return __NSSetMSize_Impl<DataDescriptor_64>(process, valobj_addr,
error);
249template <
bool cf_style>
266 if (!descriptor || !descriptor->IsValid())
269 uint32_t ptr_size = process_sp->GetAddressByteSize();
270 bool is_64bit = (ptr_size == 8);
279 ConstString class_name(descriptor->GetClassName());
282 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
290 if (class_name == g_SetI || class_name == g_OrderedSetI) {
292 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
296 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
297 }
else if (class_name == g_SetM) {
299 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
304 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
306 value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
310 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
313 if (!cfbh.
Update(valobj_addr, exe_ctx))
318 auto iter = map.find(class_name), end = map.end();
320 return iter->second(valobj, stream, options);
325 std::string prefix, suffix;
327 if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
334 stream.
Printf(
"%s%" PRIu64
" %s%s%s", prefix.c_str(), value,
"element",
335 value == 1 ?
"" :
"s", suffix.c_str());
342 lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
352 if (flags.
IsClear(eTypeIsPointer)) {
354 valobj_sp = valobj_sp->AddressOf(
error);
355 if (
error.Fail() || !valobj_sp)
362 if (!descriptor || !descriptor->IsValid())
365 ConstString class_name = descriptor->GetClassName();
368 static const ConstString g_OrderedSetI(
"__NSOrderedSetI");
376 if (class_name == g_SetI || class_name == g_OrderedSetI) {
378 }
else if (class_name == g_SetM) {
380 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
391 }
else if (class_name == g_SetCF || class_name == g_SetCFRef) {
395 auto iter = map.find(class_name), end = map.end();
397 return iter->second(synth, valobj_sp);
403 lldb::ValueObjectSP valobj_sp)
428 if (!m_data_32 && !m_data_64)
430 return (m_data_32 ? m_data_32->_used : m_data_64->_used);
440 ValueObjectSP valobj_sp = m_backend.GetSP();
445 m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
446 lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
449 m_ptr_size = process_sp->GetAddressByteSize();
450 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
452 if (m_ptr_size == 4) {
463 m_data_ptr = data_location + m_ptr_size;
475 if (idx >= num_children)
476 return lldb::ValueObjectSP();
478 ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
480 return lldb::ValueObjectSP();
482 if (m_children.empty()) {
489 while (tries < num_children) {
490 obj_at_idx = m_data_ptr + (test_idx * m_ptr_size);
492 return lldb::ValueObjectSP();
494 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
496 return lldb::ValueObjectSP();
506 m_children.push_back(descriptor);
510 if (idx >= m_children.size())
511 return lldb::ValueObjectSP();
515 auto ptr_size = process_sp->GetAddressByteSize();
519 return lldb::ValueObjectSP();
521 *
reinterpret_cast<uint32_t *
>(buffer.GetBytes()) =
525 *
reinterpret_cast<uint64_t *
>(buffer.GetBytes()) =
526 static_cast<uint64_t
>(set_item.
item_ptr);
529 lldbassert(
false &&
"pointer size is not 4 nor 8");
532 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
535 process_sp->GetByteOrder(),
536 process_sp->GetAddressByteSize());
538 set_item.
valobj_sp = CreateValueObjectFromData(
539 idx_name.
GetString(), data, m_exe_ctx_ref,
540 m_backend.GetCompilerType().GetBasicTypeFromAST(
547 lldb::ValueObjectSP valobj_sp)
563 if (!m_hashtable.IsValid())
565 return m_hashtable.GetCount();
570 ValueObjectSP valobj_sp = m_backend.GetSP();
574 m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
576 lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
579 m_ptr_size = process_sp->GetAddressByteSize();
580 m_order = process_sp->GetByteOrder();
581 return m_hashtable.Update(valobj_sp->GetValueAsUnsigned(0), m_exe_ctx_ref);
591 lldb::addr_t m_values_ptr = m_hashtable.GetValuePointer();
595 if (idx >= num_children)
596 return lldb::ValueObjectSP();
598 if (m_children.empty()) {
599 ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
601 return lldb::ValueObjectSP();
613 while (tries < num_children) {
614 val_at_idx = m_values_ptr + (test_idx * m_ptr_size);
616 val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx,
error);
618 return lldb::ValueObjectSP();
628 m_children.push_back(descriptor);
632 if (idx >= m_children.size())
633 return lldb::ValueObjectSP();
638 WritableDataBufferSP buffer_sp(
new DataBufferHeap(m_ptr_size, 0));
640 switch (m_ptr_size) {
642 return lldb::ValueObjectSP();
644 *
reinterpret_cast<uint32_t *
>(buffer_sp->GetBytes()) =
648 *
reinterpret_cast<uint64_t *
>(buffer_sp->GetBytes()) =
649 static_cast<uint64_t
>(set_item.
item_ptr);
652 lldbassert(
false &&
"pointer size is not 4 nor 8");
655 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
659 set_item.
valobj_sp = CreateValueObjectFromData(
660 idx_name.
GetString(), data, m_exe_ctx_ref,
661 m_backend.GetCompilerType().GetBasicTypeFromAST(
668template <
typename D32,
typename D64>
672 m_data_32(nullptr), m_data_64(nullptr) {
677template <
typename D32,
typename D64>
678lldb_private::formatters::
679 GenericNSSetMSyntheticFrontEnd<D32, D64>::~GenericNSSetMSyntheticFrontEnd<D32, D64>() {
686template <
typename D32,
typename D64>
698template <
typename D32,
typename D64>
702 if (!m_data_32 && !m_data_64)
704 return (m_data_32 ? m_data_32->_used : m_data_64->_used);
707template <
typename D32,
typename D64>
712 ValueObjectSP valobj_sp = m_backend.GetSP();
722 m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
723 lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
726 m_ptr_size = process_sp->GetAddressByteSize();
727 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
729 if (m_ptr_size == 4) {
730 m_data_32 =
new D32();
731 process_sp->ReadMemory(data_location, m_data_32,
sizeof(D32),
734 m_data_64 =
new D64();
735 process_sp->ReadMemory(data_location, m_data_64,
sizeof(D64),
738 return error.Success();
741template <
typename D32,
typename D64>
748template <
typename D32,
typename D64>
753 (m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
757 if (idx >= num_children)
758 return lldb::ValueObjectSP();
760 ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
762 return lldb::ValueObjectSP();
764 if (m_children.empty()) {
771 while (tries < num_children) {
772 obj_at_idx = m_objs_addr + (test_idx * m_ptr_size);
774 return lldb::ValueObjectSP();
776 obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx,
error);
778 return lldb::ValueObjectSP();
788 m_children.push_back(descriptor);
792 if (idx >= m_children.size())
793 return lldb::ValueObjectSP();
797 auto ptr_size = process_sp->GetAddressByteSize();
801 return lldb::ValueObjectSP();
806 *((uint64_t *)buffer.GetBytes()) = (uint64_t)set_item.
item_ptr;
809 assert(
false &&
"pointer size is not 4 nor 8 - get out of here ASAP");
812 idx_name.
Printf(
"[%" PRIu64
"]", (uint64_t)idx);
815 process_sp->GetByteOrder(),
816 process_sp->GetAddressByteSize());
818 set_item.
valobj_sp = CreateValueObjectFromData(
819 idx_name.
GetString(), data, m_exe_ctx_ref,
820 m_backend.GetCompilerType().GetBasicTypeFromAST(
826template bool lldb_private::formatters::NSSetSummaryProvider<true>(
829template bool lldb_private::formatters::NSSetSummaryProvider<false>(
static llvm::raw_ostream & error(Stream &strm)
static size_t CalculateNumChildren(CompilerType container_type, CompilerType element_type, lldb_private::ExecutionContextScope *exe_scope=nullptr)
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.
bool IsEmpty() const
Test for empty string.
const char * GetCString() const
Get the string value as a C string.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
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.
lldb::LanguageType GetLanguage() const
lldb::ProcessSP GetProcessSP() const
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.