LLDB mainline
NSArray.cpp
Go to the documentation of this file.
1//===-- NSArray.cpp -------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "clang/AST/ASTContext.h"
10#include "clang/Basic/TargetInfo.h"
11
12#include "Cocoa.h"
13
16
22#include "lldb/Target/Target.h"
24#include "lldb/Utility/Endian.h"
25#include "lldb/Utility/Status.h"
26#include "lldb/Utility/Stream.h"
27
28using namespace lldb;
29using namespace lldb_private;
30using namespace lldb_private::formatters;
31
32namespace lldb_private {
33namespace formatters {
34std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
36 static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
37 return g_map;
38}
39
40std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
42 static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>
43 g_map;
44 return g_map;
45}
46
48public:
49 NSArrayMSyntheticFrontEndBase(lldb::ValueObjectSP valobj_sp);
50
51 ~NSArrayMSyntheticFrontEndBase() override = default;
52
53 size_t CalculateNumChildren() override;
54
55 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
56
57 bool Update() override = 0;
58
59 bool MightHaveChildren() override;
60
61 size_t GetIndexOfChildWithName(ConstString name) override;
62
63protected:
65
66 virtual uint64_t GetUsedCount() = 0;
67
68 virtual uint64_t GetOffset() = 0;
69
70 virtual uint64_t GetSize() = 0;
71
73 uint8_t m_ptr_size = 8;
75};
76
77template <typename D32, typename D64>
79public:
80 GenericNSArrayMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
81
83
84 bool Update() override;
85
86protected:
88
89 uint64_t GetUsedCount() override;
90
91 uint64_t GetOffset() override;
92
93 uint64_t GetSize() override;
94
95private:
98};
99
100namespace Foundation1010 {
101 namespace {
102 struct DataDescriptor_32 {
106 uint64_t _priv1 : 4;
109 };
110
111 struct DataDescriptor_64 {
112 uint64_t _used;
113 uint64_t _offset;
114 uint64_t _size : 60;
115 uint64_t _priv1 : 4;
117 uint64_t _data;
118 };
119 }
120
123}
124
125namespace Foundation1428 {
126 namespace {
127 struct DataDescriptor_32 {
128 uint32_t _used;
130 uint32_t _size;
132 };
133
134 struct DataDescriptor_64 {
135 uint64_t _used;
136 uint64_t _offset;
137 uint64_t _size;
138 uint64_t _data;
139 };
140 }
141
144}
145
146namespace Foundation1437 {
147 template <typename PtrType>
149 PtrType _cow;
150 // __deque
151 PtrType _data;
156 };
157
161
162 template <typename DD>
163 uint64_t
165 lldb::addr_t valobj_addr, Status &error) {
166 const lldb::addr_t start_of_descriptor =
167 valobj_addr + process.GetAddressByteSize();
168 DD descriptor = DD();
169 process.ReadMemory(start_of_descriptor, &descriptor,
170 sizeof(descriptor), error);
171 if (error.Fail()) {
172 return 0;
173 }
174 return descriptor._used;
175 }
176
177 uint64_t
179 Status &error) {
180 if (process.GetAddressByteSize() == 4) {
181 return __NSArrayMSize_Impl<DataDescriptor<uint32_t>>(process, valobj_addr,
182 error);
183 } else {
184 return __NSArrayMSize_Impl<DataDescriptor<uint64_t>>(process, valobj_addr,
185 error);
186 }
187 }
188
189}
190
191namespace CallStackArray {
196 const uint32_t _size = 0;
197};
198
200 uint64_t _data;
201 uint64_t _used;
202 uint64_t _offset;
203 const uint64_t _size = 0;
204};
205
208} // namespace CallStackArray
209
210template <typename D32, typename D64, bool Inline>
212public:
213 GenericNSArrayISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
214
216
217 size_t CalculateNumChildren() override;
218
219 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
220
221 bool Update() override;
222
223 bool MightHaveChildren() override;
224
225 size_t GetIndexOfChildWithName(ConstString name) override;
226
227private:
229 uint8_t m_ptr_size = 8;
230
234};
235
236namespace Foundation1300 {
237 struct IDD32 {
240 };
241
242 struct IDD64 {
243 uint64_t used;
244 uint64_t list;
245 };
246
249}
250
251namespace Foundation1430 {
254}
255
256namespace Foundation1436 {
257 struct IDD32 {
259 uint32_t list; // in Inline cases, this is the first element
260 };
261
262 struct IDD64 {
263 uint64_t used;
264 uint64_t list; // in Inline cases, this is the first element
265 };
266
269
272
275
276 uint64_t
278 Status &error) {
279 return Foundation1437::__NSArrayMSize(process, valobj_addr, error);
280 }
281}
282
283namespace ConstantArray {
284
286 uint64_t used;
288};
289
291 uint64_t used;
292 uint64_t list;
293};
294
297} // namespace ConstantArray
298
300public:
301 NSArray0SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
302
303 ~NSArray0SyntheticFrontEnd() override = default;
304
305 size_t CalculateNumChildren() override;
306
307 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
308
309 bool Update() override;
310
311 bool MightHaveChildren() override;
312
313 size_t GetIndexOfChildWithName(ConstString name) override;
314};
315
317public:
318 NSArray1SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
319
320 ~NSArray1SyntheticFrontEnd() override = default;
321
322 size_t CalculateNumChildren() override;
323
324 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
325
326 bool Update() override;
327
328 bool MightHaveChildren() override;
329
330 size_t GetIndexOfChildWithName(ConstString name) override;
331};
332} // namespace formatters
333} // namespace lldb_private
334
336 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
337 static ConstString g_TypeHint("NSArray");
338
339 ProcessSP process_sp = valobj.GetProcessSP();
340 if (!process_sp)
341 return false;
342
343 ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
344
345 if (!runtime)
346 return false;
347
349 runtime->GetClassDescriptor(valobj));
350
351 if (!descriptor || !descriptor->IsValid())
352 return false;
353
354 uint32_t ptr_size = process_sp->GetAddressByteSize();
355
356 lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
357
358 if (!valobj_addr)
359 return false;
360
361 uint64_t value = 0;
362
363 ConstString class_name(descriptor->GetClassName());
364
365 static const ConstString g_NSArrayI("__NSArrayI");
366 static const ConstString g_NSArrayM("__NSArrayM");
367 static const ConstString g_NSArrayI_Transfer("__NSArrayI_Transfer");
368 static const ConstString g_NSFrozenArrayM("__NSFrozenArrayM");
369 static const ConstString g_NSArray0("__NSArray0");
370 static const ConstString g_NSArray1("__NSSingleObjectArrayI");
371 static const ConstString g_NSArrayCF("__NSCFArray");
372 static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy");
373 static const ConstString g_NSArrayMImmutable("__NSArrayM_Immutable");
374 static const ConstString g_NSCallStackArray("_NSCallStackArray");
375 static const ConstString g_NSConstantArray("NSConstantArray");
376
377 if (class_name.IsEmpty())
378 return false;
379
380 if (class_name == g_NSArrayI) {
382 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
383 ptr_size, 0, error);
384 if (error.Fail())
385 return false;
386 } else if (class_name == g_NSConstantArray) {
388 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, 8,
389 0, error);
390 if (error.Fail())
391 return false;
392 } else if (class_name == g_NSArrayM) {
393 AppleObjCRuntime *apple_runtime =
394 llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
396 if (apple_runtime && apple_runtime->GetFoundationVersion() >= 1437) {
397 value = Foundation1437::__NSArrayMSize(*process_sp, valobj_addr, error);
398 } else {
399 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
400 ptr_size, 0, error);
401 }
402 if (error.Fail())
403 return false;
404 } else if (class_name == g_NSArrayI_Transfer) {
406 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
407 ptr_size, 0, error);
408 if (error.Fail())
409 return false;
410 } else if (class_name == g_NSFrozenArrayM) {
412 value = Foundation1436::__NSFrozenArrayMSize(*process_sp, valobj_addr, error);
413 if (error.Fail())
414 return false;
415 } else if (class_name == g_NSArrayMLegacy) {
417 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
418 ptr_size, 0, error);
419 if (error.Fail())
420 return false;
421 } else if (class_name == g_NSArrayMImmutable) {
423 value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
424 ptr_size, 0, error);
425 if (error.Fail())
426 return false;
427 } else if (class_name == g_NSArray0) {
428 value = 0;
429 } else if (class_name == g_NSArray1) {
430 value = 1;
431 } else if (class_name == g_NSArrayCF || class_name == g_NSCallStackArray) {
432 // __NSCFArray and _NSCallStackArray store the number of elements as a
433 // pointer-sized value at offset `2 * ptr_size`.
435 value = process_sp->ReadUnsignedIntegerFromMemory(
436 valobj_addr + 2 * ptr_size, ptr_size, 0, error);
437 if (error.Fail())
438 return false;
439 } else {
441 auto iter = map.find(class_name), end = map.end();
442 if (iter != end)
443 return iter->second(valobj, stream, options);
444 else
445 return false;
446 }
447
448 std::string prefix, suffix;
449 if (Language *language = Language::FindPlugin(options.GetLanguage())) {
450 if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
451 suffix)) {
452 prefix.clear();
453 suffix.clear();
454 }
455 }
456
457 stream.Printf("%s%" PRIu64 " %s%s%s", prefix.c_str(), value, "element",
458 value == 1 ? "" : "s", suffix.c_str());
459 return true;
460}
461
463 NSArrayMSyntheticFrontEndBase(lldb::ValueObjectSP valobj_sp)
464 : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_id_type() {
465 if (valobj_sp) {
466 TypeSystemClangSP scratch_ts_sp = ScratchTypeSystemClang::GetForTarget(
467 *valobj_sp->GetExecutionContextRef().GetTargetSP());
468 if (scratch_ts_sp)
470 scratch_ts_sp->weak_from_this(),
471 scratch_ts_sp->getASTContext().ObjCBuiltinIdTy.getAsOpaquePtr());
472 if (valobj_sp->GetProcessSP())
473 m_ptr_size = valobj_sp->GetProcessSP()->GetAddressByteSize();
474 }
475}
476
477template <typename D32, typename D64>
480 GenericNSArrayMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
481 : NSArrayMSyntheticFrontEndBase(valobj_sp), m_data_32(nullptr),
482 m_data_64(nullptr) {}
483
484size_t
486 return GetUsedCount();
487}
488
489lldb::ValueObjectSP
491 size_t idx) {
492 if (idx >= CalculateNumChildren())
493 return lldb::ValueObjectSP();
494 lldb::addr_t object_at_idx = GetDataAddress();
495 size_t pyhs_idx = idx;
496 pyhs_idx += GetOffset();
497 if (GetSize() <= pyhs_idx)
498 pyhs_idx -= GetSize();
499 object_at_idx += (pyhs_idx * m_ptr_size);
500 StreamString idx_name;
501 idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
502 return CreateValueObjectFromAddress(idx_name.GetString(), object_at_idx,
503 m_exe_ctx_ref, m_id_type);
504}
505
506template <typename D32, typename D64>
507bool
510 ValueObjectSP valobj_sp = m_backend.GetSP();
511 m_ptr_size = 0;
512 delete m_data_32;
513 m_data_32 = nullptr;
514 delete m_data_64;
515 m_data_64 = nullptr;
516 if (!valobj_sp)
517 return false;
518 m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
520 error.Clear();
521 lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
522 if (!process_sp)
523 return false;
524 m_ptr_size = process_sp->GetAddressByteSize();
525 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
526 if (m_ptr_size == 4) {
527 m_data_32 = new D32();
528 process_sp->ReadMemory(data_location, m_data_32, sizeof(D32),
529 error);
530 } else {
531 m_data_64 = new D64();
532 process_sp->ReadMemory(data_location, m_data_64, sizeof(D64),
533 error);
534 }
535
536 return error.Success();
537}
538
539bool
541 return true;
542}
543
544size_t
546 ConstString name) {
547 const char *item_name = name.GetCString();
548 uint32_t idx = ExtractIndexFromString(item_name);
549 if (idx < UINT32_MAX && idx >= CalculateNumChildren())
550 return UINT32_MAX;
551 return idx;
552}
553
554template <typename D32, typename D64>
555lldb_private::formatters::
556 GenericNSArrayMSyntheticFrontEnd<D32, D64>::
557 ~GenericNSArrayMSyntheticFrontEnd<D32, D64>() {
558 delete m_data_32;
559 m_data_32 = nullptr;
560 delete m_data_64;
561 m_data_64 = nullptr;
562}
563
564template <typename D32, typename D64>
566lldb_private::formatters::
567 GenericNSArrayMSyntheticFrontEnd<D32, D64>::
568 GenericNSArrayMSyntheticFrontEnd::GetDataAddress() {
569 if (!m_data_32 && !m_data_64)
571 return m_data_32 ? m_data_32->_data : m_data_64->_data;
572}
573
574template <typename D32, typename D64>
575uint64_t
576lldb_private::formatters::
577 GenericNSArrayMSyntheticFrontEnd<D32, D64>::
578 GenericNSArrayMSyntheticFrontEnd::GetUsedCount() {
579 if (!m_data_32 && !m_data_64)
580 return 0;
581 return m_data_32 ? m_data_32->_used : m_data_64->_used;
582}
583
584template <typename D32, typename D64>
585uint64_t
586lldb_private::formatters::
587 GenericNSArrayMSyntheticFrontEnd<D32, D64>::
588 GenericNSArrayMSyntheticFrontEnd::GetOffset() {
589 if (!m_data_32 && !m_data_64)
590 return 0;
591 return m_data_32 ? m_data_32->_offset : m_data_64->_offset;
592}
593
594template <typename D32, typename D64>
595uint64_t
596lldb_private::formatters::
597 GenericNSArrayMSyntheticFrontEnd<D32, D64>::
598 GenericNSArrayMSyntheticFrontEnd::GetSize() {
599 if (!m_data_32 && !m_data_64)
600 return 0;
601 return m_data_32 ? m_data_32->_size : m_data_64->_size;
602}
603
604template <typename D32, typename D64, bool Inline>
606 GenericNSArrayISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
607 : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(),
608 m_data_32(nullptr), m_data_64(nullptr) {
609 if (valobj_sp) {
610 CompilerType type = valobj_sp->GetCompilerType();
611 if (type) {
612 TypeSystemClangSP scratch_ts_sp = ScratchTypeSystemClang::GetForTarget(
613 *valobj_sp->GetExecutionContextRef().GetTargetSP());
614 if (scratch_ts_sp)
615 m_id_type = scratch_ts_sp->GetType(
616 scratch_ts_sp->getASTContext().ObjCBuiltinIdTy);
617 }
618 }
619}
620
621template <typename D32, typename D64, bool Inline>
624 delete m_data_32;
625 m_data_32 = nullptr;
626 delete m_data_64;
627 m_data_64 = nullptr;
628}
629
630template <typename D32, typename D64, bool Inline>
631size_t
634 const char *item_name = name.GetCString();
635 uint32_t idx = ExtractIndexFromString(item_name);
636 if (idx < UINT32_MAX && idx >= CalculateNumChildren())
637 return UINT32_MAX;
638 return idx;
639}
640
641template <typename D32, typename D64, bool Inline>
642size_t
645 return m_data_32 ? m_data_32->used : m_data_64->used;
646}
647
648template <typename D32, typename D64, bool Inline>
649bool
651 Update() {
652 ValueObjectSP valobj_sp = m_backend.GetSP();
653 m_ptr_size = 0;
654 delete m_data_32;
655 m_data_32 = nullptr;
656 delete m_data_64;
657 m_data_64 = nullptr;
658 if (!valobj_sp)
659 return false;
660 m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
662 error.Clear();
663 lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
664 if (!process_sp)
665 return false;
666 m_ptr_size = process_sp->GetAddressByteSize();
667 uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
668 if (m_ptr_size == 4) {
669 m_data_32 = new D32();
670 process_sp->ReadMemory(data_location, m_data_32, sizeof(D32),
671 error);
672 } else {
673 m_data_64 = new D64();
674 process_sp->ReadMemory(data_location, m_data_64, sizeof(D64),
675 error);
676 }
677
678 return error.Success();
679}
680
681template <typename D32, typename D64, bool Inline>
682bool
685 return true;
686}
687
688template <typename D32, typename D64, bool Inline>
689lldb::ValueObjectSP
691 GetChildAtIndex(size_t idx) {
692 if (idx >= CalculateNumChildren())
693 return lldb::ValueObjectSP();
694 lldb::addr_t object_at_idx;
695 if (Inline) {
696 object_at_idx = m_backend.GetSP()->GetValueAsUnsigned(0) + m_ptr_size;
697 object_at_idx += m_ptr_size == 4 ? sizeof(D32) : sizeof(D64); // skip the data header
698 object_at_idx -= m_ptr_size; // we treat the last entry in the data header as the first pointer
699 } else {
700 object_at_idx = m_data_32 ? m_data_32->list : m_data_64->list;
701 }
702 object_at_idx += (idx * m_ptr_size);
703
704 ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
705 if (!process_sp)
706 return lldb::ValueObjectSP();
708 if (error.Fail())
709 return lldb::ValueObjectSP();
710 StreamString idx_name;
711 idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
712 return CreateValueObjectFromAddress(idx_name.GetString(), object_at_idx,
713 m_exe_ctx_ref, m_id_type);
714}
715
717 lldb::ValueObjectSP valobj_sp)
718 : SyntheticChildrenFrontEnd(*valobj_sp) {}
719
720size_t
722 ConstString name) {
723 return UINT32_MAX;
724}
725
726size_t
728 return 0;
729}
730
732 return false;
733}
734
736 return false;
737}
738
739lldb::ValueObjectSP
741 size_t idx) {
742 return lldb::ValueObjectSP();
743}
744
746 lldb::ValueObjectSP valobj_sp)
747 : SyntheticChildrenFrontEnd(*valobj_sp.get()) {}
748
749size_t
751 ConstString name) {
752 static const ConstString g_zero("[0]");
753
754 if (name == g_zero)
755 return 0;
756
757 return UINT32_MAX;
758}
759
760size_t
762 return 1;
763}
764
766 return false;
767}
768
770 return true;
771}
772
773lldb::ValueObjectSP
775 size_t idx) {
776 static const ConstString g_zero("[0]");
777
778 if (idx == 0) {
779 TypeSystemClangSP scratch_ts_sp =
780 ScratchTypeSystemClang::GetForTarget(*m_backend.GetTargetSP());
781 if (scratch_ts_sp) {
782 CompilerType id_type(scratch_ts_sp->GetBasicType(lldb::eBasicTypeObjCID));
783 return m_backend.GetSyntheticChildAtOffset(
784 m_backend.GetProcessSP()->GetAddressByteSize(), id_type, true,
785 g_zero);
786 }
787 }
788 return lldb::ValueObjectSP();
789}
790
793 CXXSyntheticChildren *synth, lldb::ValueObjectSP valobj_sp) {
794 if (!valobj_sp)
795 return nullptr;
796
797 lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
798 if (!process_sp)
799 return nullptr;
800 AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
801 ObjCLanguageRuntime::Get(*process_sp));
802 if (!runtime)
803 return nullptr;
804
805 CompilerType valobj_type(valobj_sp->GetCompilerType());
806 Flags flags(valobj_type.GetTypeInfo());
807
808 if (flags.IsClear(eTypeIsPointer)) {
810 valobj_sp = valobj_sp->AddressOf(error);
811 if (error.Fail() || !valobj_sp)
812 return nullptr;
813 }
814
816 runtime->GetClassDescriptor(*valobj_sp));
817
818 if (!descriptor || !descriptor->IsValid())
819 return nullptr;
820
821 ConstString class_name(descriptor->GetClassName());
822
823 static const ConstString g_NSArrayI("__NSArrayI");
824 static const ConstString g_NSConstantArray("NSConstantArray");
825 static const ConstString g_NSArrayI_Transfer("__NSArrayI_Transfer");
826 static const ConstString g_NSFrozenArrayM("__NSFrozenArrayM");
827 static const ConstString g_NSArrayM("__NSArrayM");
828 static const ConstString g_NSArray0("__NSArray0");
829 static const ConstString g_NSArray1("__NSSingleObjectArrayI");
830 static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy");
831 static const ConstString g_NSArrayMImmutable("__NSArrayM_Immutable");
832 static const ConstString g_NSCallStackArray("_NSCallStackArray");
833
834 if (class_name.IsEmpty())
835 return nullptr;
836
837 if (class_name == g_NSArrayI) {
838 if (runtime->GetFoundationVersion() >= 1436)
839 return (new Foundation1436::NSArrayISyntheticFrontEnd(valobj_sp));
840 if (runtime->GetFoundationVersion() >= 1430)
841 return (new Foundation1430::NSArrayISyntheticFrontEnd(valobj_sp));
842 return (new Foundation1300::NSArrayISyntheticFrontEnd(valobj_sp));
843 } else if (class_name == g_NSArrayI_Transfer) {
845 } else if (class_name == g_NSConstantArray) {
847 } else if (class_name == g_NSFrozenArrayM) {
849 } else if (class_name == g_NSArray0) {
850 return (new NSArray0SyntheticFrontEnd(valobj_sp));
851 } else if (class_name == g_NSArray1) {
852 return (new NSArray1SyntheticFrontEnd(valobj_sp));
853 } else if (class_name == g_NSArrayM) {
854 if (runtime->GetFoundationVersion() >= 1437)
855 return (new Foundation1437::NSArrayMSyntheticFrontEnd(valobj_sp));
856 if (runtime->GetFoundationVersion() >= 1428)
857 return (new Foundation1428::NSArrayMSyntheticFrontEnd(valobj_sp));
858 if (runtime->GetFoundationVersion() >= 1100)
859 return (new Foundation1010::NSArrayMSyntheticFrontEnd(valobj_sp));
860 } else if (class_name == g_NSCallStackArray) {
862 } else {
864 auto iter = map.find(class_name), end = map.end();
865 if (iter != end)
866 return iter->second(synth, valobj_sp);
867 }
868
869 return nullptr;
870}
static llvm::raw_ostream & error(Stream &strm)
uint32_t _data
Definition: NSArray.cpp:108
uint32_t _size
Definition: NSArray.cpp:105
uint32_t _used
Definition: NSArray.cpp:103
uint32_t _priv2
Definition: NSArray.cpp:107
uint32_t _offset
Definition: NSArray.cpp:104
uint64_t _priv1
Definition: NSArray.cpp:106
static size_t CalculateNumChildren(CompilerType container_type, CompilerType element_type, lldb_private::ExecutionContextScope *exe_scope=nullptr)
Definition: VectorType.cpp:172
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
A uniqued constant string class.
Definition: ConstString.h:39
bool IsEmpty() const
Test for empty string.
Definition: ConstString.h:303
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:215
Execution context objects refer to objects in the execution of the program that is being debugged.
A class to manage flags.
Definition: Flags.h:22
bool IsClear(ValueType bit) const
Test a single flag bit to see if it is clear (zero).
Definition: Flags.h:111
static Language * FindPlugin(lldb::LanguageType language)
Definition: Language.cpp:53
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.
Definition: Process.h:342
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:1926
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3367
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
An error handling class.
Definition: Status.h:44
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb::LanguageType GetLanguage() const
Definition: TypeSummary.cpp:31
lldb::ProcessSP GetProcessSP() const
Definition: ValueObject.h:338
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
GenericNSArrayISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition: NSArray.cpp:606
size_t GetIndexOfChildWithName(ConstString name) override
Definition: NSArray.cpp:633
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: NSArray.cpp:691
GenericNSArrayMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition: NSArray.cpp:480
size_t GetIndexOfChildWithName(ConstString name) override
Definition: NSArray.cpp:721
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: NSArray.cpp:740
NSArray0SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition: NSArray.cpp:716
NSArray1SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
Definition: NSArray.cpp:745
size_t GetIndexOfChildWithName(ConstString name) override
Definition: NSArray.cpp:750
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: NSArray.cpp:774
size_t GetIndexOfChildWithName(ConstString name) override
Definition: NSArray.cpp:545
lldb::ValueObjectSP GetChildAtIndex(size_t idx) override
Definition: NSArray.cpp:490
NSArrayMSyntheticFrontEndBase(lldb::ValueObjectSP valobj_sp)
Definition: NSArray.cpp:463
static std::map< ConstString, CXXFunctionSummaryFormat::Callback > & GetAdditionalSummaries()
Definition: NSArray.cpp:35
static std::map< ConstString, CXXSyntheticChildren::CreateFrontEndCallback > & GetAdditionalSynthetics()
Definition: NSArray.cpp:41
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
#define UINT32_MAX
Definition: lldb-defines.h:19
GenericNSArrayISyntheticFrontEnd< ConstantArray32, ConstantArray64, false > NSConstantArraySyntheticFrontEnd
Definition: NSArray.cpp:296
GenericNSArrayMSyntheticFrontEnd< DataDescriptor_32, DataDescriptor_64 > NSArrayMSyntheticFrontEnd
Definition: NSArray.cpp:143
uint64_t __NSFrozenArrayMSize(lldb_private::Process &process, lldb::addr_t valobj_addr, Status &error)
Definition: NSArray.cpp:277
GenericNSArrayMSyntheticFrontEnd< DataDescriptor< uint32_t >, DataDescriptor< uint64_t > > NSArrayMSyntheticFrontEnd
Definition: NSArray.cpp:160
uint64_t __NSArrayMSize(lldb_private::Process &process, lldb::addr_t valobj_addr, Status &error)
Definition: NSArray.cpp:178
uint64_t __NSArrayMSize_Impl(lldb_private::Process &process, lldb::addr_t valobj_addr, Status &error)
Definition: NSArray.cpp:164
SyntheticChildrenFrontEnd * NSArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
Definition: NSArray.cpp:792
size_t ExtractIndexFromString(const char *item_name)
bool NSArraySummaryProvider(ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options)
Definition: NSArray.cpp:335
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
@ eBasicTypeObjCID
uint64_t addr_t
Definition: lldb-types.h:83