1 //===-- CXXFormatterFunctions.h------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef liblldb_CXXFormatterFunctions_h_
11 #define liblldb_CXXFormatterFunctions_h_
12 
13 #include <stdint.h>
14 #include <time.h>
15 
16 #include "lldb/lldb-forward.h"
17 
18 #include "lldb/Core/ConstString.h"
19 #include "lldb/DataFormatters/FormatClasses.h"
20 #include "lldb/Target/Target.h"
21 
22 #include "clang/AST/ASTContext.h"
23 
24 namespace lldb_private {
25     namespace formatters
26     {
27         bool
28         ExtractValueFromObjCExpression (ValueObject &valobj,
29                                         const char* target_type,
30                                         const char* selector,
31                                         uint64_t &value);
32 
33         bool
34         ExtractSummaryFromObjCExpression (ValueObject &valobj,
35                                           const char* target_type,
36                                           const char* selector,
37                                           Stream &stream);
38 
39         lldb::ValueObjectSP
40         CallSelectorOnObject (ValueObject &valobj,
41                               const char* return_type,
42                               const char* selector,
43                               uint64_t index);
44 
45         lldb::ValueObjectSP
46         CallSelectorOnObject (ValueObject &valobj,
47                               const char* return_type,
48                               const char* selector,
49                               const char* key);
50 
51         size_t
52         ExtractIndexFromString (const char* item_name);
53 
54         time_t
55         GetOSXEpoch ();
56 
57         bool
58         Char16StringSummaryProvider (ValueObject& valobj, Stream& stream); // char16_t* and unichar*
59 
60         bool
61         Char32StringSummaryProvider (ValueObject& valobj, Stream& stream); // char32_t*
62 
63         bool
64         WCharStringSummaryProvider (ValueObject& valobj, Stream& stream); // wchar_t*
65 
66         bool
67         Char16SummaryProvider (ValueObject& valobj, Stream& stream); // char16_t and unichar
68 
69         bool
70         Char32SummaryProvider (ValueObject& valobj, Stream& stream); // char32_t
71 
72         bool
73         WCharSummaryProvider (ValueObject& valobj, Stream& stream); // wchar_t
74 
75         bool
76         LibcxxStringSummaryProvider (ValueObject& valobj, Stream& stream); // libc++ std::string
77 
78         bool
79         LibcxxWStringSummaryProvider (ValueObject& valobj, Stream& stream); // libc++ std::wstring
80 
81         bool
82         ObjCClassSummaryProvider (ValueObject& valobj, Stream& stream);
83 
84         SyntheticChildrenFrontEnd* ObjCClassSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
85 
86         template<bool name_entries>
87         bool
88         NSDictionarySummaryProvider (ValueObject& valobj, Stream& stream);
89 
90         bool
91         NSIndexSetSummaryProvider (ValueObject& valobj, Stream& stream);
92 
93         bool
94         NSArraySummaryProvider (ValueObject& valobj, Stream& stream);
95 
96         template<bool cf_style>
97         bool
98         NSSetSummaryProvider (ValueObject& valobj, Stream& stream);
99 
100         template<bool needs_at>
101         bool
102         NSDataSummaryProvider (ValueObject& valobj, Stream& stream);
103 
104         bool
105         NSNumberSummaryProvider (ValueObject& valobj, Stream& stream);
106 
107         bool
108         NSNotificationSummaryProvider (ValueObject& valobj, Stream& stream);
109 
110         bool
111         NSTimeZoneSummaryProvider (ValueObject& valobj, Stream& stream);
112 
113         bool
114         NSMachPortSummaryProvider (ValueObject& valobj, Stream& stream);
115 
116         bool
117         CFBagSummaryProvider (ValueObject& valobj, Stream& stream);
118 
119         bool
120         CFBinaryHeapSummaryProvider (ValueObject& valobj, Stream& stream);
121 
122         bool
123         CFBitVectorSummaryProvider (ValueObject& valobj, Stream& stream);
124 
125         bool
126         NSDateSummaryProvider (ValueObject& valobj, Stream& stream);
127 
128         bool
129         CFAbsoluteTimeSummaryProvider (ValueObject& valobj, Stream& stream);
130 
131         bool
132         NSBundleSummaryProvider (ValueObject& valobj, Stream& stream);
133 
134         bool
135         NSStringSummaryProvider (ValueObject& valobj, Stream& stream);
136 
137         bool
138         NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream);
139 
140         bool
141         NSMutableAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream);
142 
143         bool
144         NSURLSummaryProvider (ValueObject& valobj, Stream& stream);
145 
146         bool
147         ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream);
148 
149         template <bool is_sel_ptr>
150         bool
151         ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream);
152 
153         bool
154         RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream);
155 
156         extern template bool
157         NSDictionarySummaryProvider<true> (ValueObject&, Stream&) ;
158 
159         extern template bool
160         NSDictionarySummaryProvider<false> (ValueObject&, Stream&) ;
161 
162         extern template bool
163         NSDataSummaryProvider<true> (ValueObject&, Stream&) ;
164 
165         extern template bool
166         NSDataSummaryProvider<false> (ValueObject&, Stream&) ;
167 
168         extern template bool
169         ObjCSELSummaryProvider<true> (ValueObject&, Stream&);
170 
171         extern template bool
172         ObjCSELSummaryProvider<false> (ValueObject&, Stream&);
173 
174         class NSArrayMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
175         {
176         private:
177             struct DataDescriptor_32
178             {
179                 uint32_t _used;
180                 uint32_t _priv1 : 2 ;
181                 uint32_t _size : 30;
182                 uint32_t _priv2 : 2;
183                 uint32_t offset : 30;
184                 uint32_t _priv3;
185                 uint32_t _data;
186             };
187             struct DataDescriptor_64
188             {
189                 uint64_t _used;
190                 uint64_t _priv1 : 2 ;
191                 uint64_t _size : 62;
192                 uint64_t _priv2 : 2;
193                 uint64_t offset : 62;
194                 uint32_t _priv3;
195                 uint64_t _data;
196             };
197         public:
198             NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
199 
200             virtual size_t
201             CalculateNumChildren ();
202 
203             virtual lldb::ValueObjectSP
204             GetChildAtIndex (size_t idx);
205 
206             virtual bool
207             Update();
208 
209             virtual bool
210             MightHaveChildren ();
211 
212             virtual size_t
213             GetIndexOfChildWithName (const ConstString &name);
214 
215             virtual
216             ~NSArrayMSyntheticFrontEnd ();
217         private:
218             ExecutionContextRef m_exe_ctx_ref;
219             uint8_t m_ptr_size;
220             DataDescriptor_32 *m_data_32;
221             DataDescriptor_64 *m_data_64;
222             ClangASTType m_id_type;
223             std::vector<lldb::ValueObjectSP> m_children;
224         };
225 
226         class NSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd
227         {
228         public:
229             NSArrayISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
230 
231             virtual size_t
232             CalculateNumChildren ();
233 
234             virtual lldb::ValueObjectSP
235             GetChildAtIndex (size_t idx);
236 
237             virtual bool
238             Update();
239 
240             virtual bool
241             MightHaveChildren ();
242 
243             virtual size_t
244             GetIndexOfChildWithName (const ConstString &name);
245 
246             virtual
247             ~NSArrayISyntheticFrontEnd ();
248         private:
249             ExecutionContextRef m_exe_ctx_ref;
250             uint8_t m_ptr_size;
251             uint64_t m_items;
252             lldb::addr_t m_data_ptr;
253             ClangASTType m_id_type;
254             std::vector<lldb::ValueObjectSP> m_children;
255         };
256 
257         class NSArrayCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
258         {
259         public:
260             NSArrayCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
261 
262             virtual size_t
263             CalculateNumChildren ();
264 
265             virtual lldb::ValueObjectSP
266             GetChildAtIndex (size_t idx);
267 
268             virtual bool
269             Update();
270 
271             virtual bool
272             MightHaveChildren ();
273 
274             virtual size_t
275             GetIndexOfChildWithName (const ConstString &name);
276 
277             virtual
278             ~NSArrayCodeRunningSyntheticFrontEnd ();
279         };
280 
281         SyntheticChildrenFrontEnd* NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
282 
283         class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd
284         {
285         private:
286             struct DataDescriptor_32
287             {
288                 uint32_t _used : 26;
289                 uint32_t _szidx : 6;
290             };
291             struct DataDescriptor_64
292             {
293                 uint64_t _used : 58;
294                 uint32_t _szidx : 6;
295             };
296 
297             struct DictionaryItemDescriptor
298             {
299                 lldb::addr_t key_ptr;
300                 lldb::addr_t val_ptr;
301                 lldb::ValueObjectSP valobj_sp;
302             };
303 
304         public:
305             NSDictionaryISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
306 
307             virtual size_t
308             CalculateNumChildren ();
309 
310             virtual lldb::ValueObjectSP
311             GetChildAtIndex (size_t idx);
312 
313             virtual bool
314             Update();
315 
316             virtual bool
317             MightHaveChildren ();
318 
319             virtual size_t
320             GetIndexOfChildWithName (const ConstString &name);
321 
322             virtual
323             ~NSDictionaryISyntheticFrontEnd ();
324         private:
325             ExecutionContextRef m_exe_ctx_ref;
326             uint8_t m_ptr_size;
327             lldb::ByteOrder m_order;
328             DataDescriptor_32 *m_data_32;
329             DataDescriptor_64 *m_data_64;
330             lldb::addr_t m_data_ptr;
331             ClangASTType m_pair_type;
332             std::vector<DictionaryItemDescriptor> m_children;
333         };
334 
335         class NSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
336         {
337         private:
338             struct DataDescriptor_32
339             {
340                 uint32_t _used : 26;
341                 uint32_t _kvo : 1;
342                 uint32_t _size;
343                 uint32_t _mutations;
344                 uint32_t _objs_addr;
345                 uint32_t _keys_addr;
346             };
347             struct DataDescriptor_64
348             {
349                 uint64_t _used : 58;
350                 uint32_t _kvo : 1;
351                 uint64_t _size;
352                 uint64_t _mutations;
353                 uint64_t _objs_addr;
354                 uint64_t _keys_addr;
355             };
356             struct DictionaryItemDescriptor
357             {
358                 lldb::addr_t key_ptr;
359                 lldb::addr_t val_ptr;
360                 lldb::ValueObjectSP valobj_sp;
361             };
362         public:
363             NSDictionaryMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
364 
365             virtual size_t
366             CalculateNumChildren ();
367 
368             virtual lldb::ValueObjectSP
369             GetChildAtIndex (size_t idx);
370 
371             virtual bool
372             Update();
373 
374             virtual bool
375             MightHaveChildren ();
376 
377             virtual size_t
378             GetIndexOfChildWithName (const ConstString &name);
379 
380             virtual
381             ~NSDictionaryMSyntheticFrontEnd ();
382         private:
383             ExecutionContextRef m_exe_ctx_ref;
384             uint8_t m_ptr_size;
385             lldb::ByteOrder m_order;
386             DataDescriptor_32 *m_data_32;
387             DataDescriptor_64 *m_data_64;
388             ClangASTType m_pair_type;
389             std::vector<DictionaryItemDescriptor> m_children;
390         };
391 
392         class NSDictionaryCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
393         {
394         public:
395             NSDictionaryCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
396 
397             virtual size_t
398             CalculateNumChildren ();
399 
400             virtual lldb::ValueObjectSP
401             GetChildAtIndex (size_t idx);
402 
403             virtual bool
404             Update();
405 
406             virtual bool
407             MightHaveChildren ();
408 
409             virtual size_t
410             GetIndexOfChildWithName (const ConstString &name);
411 
412             virtual
413             ~NSDictionaryCodeRunningSyntheticFrontEnd ();
414         };
415 
416         SyntheticChildrenFrontEnd* NSDictionarySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
417 
418         class NSSetISyntheticFrontEnd : public SyntheticChildrenFrontEnd
419         {
420         private:
421             struct DataDescriptor_32
422             {
423                 uint32_t _used : 26;
424                 uint32_t _szidx : 6;
425             };
426             struct DataDescriptor_64
427             {
428                 uint64_t _used : 58;
429                 uint32_t _szidx : 6;
430             };
431 
432             struct SetItemDescriptor
433             {
434                 lldb::addr_t item_ptr;
435                 lldb::ValueObjectSP valobj_sp;
436             };
437 
438         public:
439             NSSetISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
440 
441             virtual size_t
442             CalculateNumChildren ();
443 
444             virtual lldb::ValueObjectSP
445             GetChildAtIndex (size_t idx);
446 
447             virtual bool
448             Update();
449 
450             virtual bool
451             MightHaveChildren ();
452 
453             virtual size_t
454             GetIndexOfChildWithName (const ConstString &name);
455 
456             virtual
457             ~NSSetISyntheticFrontEnd ();
458         private:
459             ExecutionContextRef m_exe_ctx_ref;
460             uint8_t m_ptr_size;
461             DataDescriptor_32 *m_data_32;
462             DataDescriptor_64 *m_data_64;
463             lldb::addr_t m_data_ptr;
464             std::vector<SetItemDescriptor> m_children;
465         };
466 
467         class NSOrderedSetSyntheticFrontEnd : public SyntheticChildrenFrontEnd
468         {
469         private:
470 
471         public:
472             NSOrderedSetSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
473 
474             virtual size_t
475             CalculateNumChildren ();
476 
477             virtual lldb::ValueObjectSP
478             GetChildAtIndex (size_t idx);
479 
480             virtual bool
481             Update();
482 
483             virtual bool
484             MightHaveChildren ();
485 
486             virtual size_t
487             GetIndexOfChildWithName (const ConstString &name);
488 
489             virtual
490             ~NSOrderedSetSyntheticFrontEnd ();
491         private:
492             uint32_t m_count;
493             std::map<uint32_t,lldb::ValueObjectSP> m_children;
494         };
495 
496         class NSSetMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
497         {
498         private:
499             struct DataDescriptor_32
500             {
501                 uint32_t _used : 26;
502                 uint32_t _size;
503                 uint32_t _mutations;
504                 uint32_t _objs_addr;
505             };
506             struct DataDescriptor_64
507             {
508                 uint64_t _used : 58;
509                 uint64_t _size;
510                 uint64_t _mutations;
511                 uint64_t _objs_addr;
512             };
513             struct SetItemDescriptor
514             {
515                 lldb::addr_t item_ptr;
516                 lldb::ValueObjectSP valobj_sp;
517             };
518         public:
519             NSSetMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
520 
521             virtual size_t
522             CalculateNumChildren ();
523 
524             virtual lldb::ValueObjectSP
525             GetChildAtIndex (size_t idx);
526 
527             virtual bool
528             Update();
529 
530             virtual bool
531             MightHaveChildren ();
532 
533             virtual size_t
534             GetIndexOfChildWithName (const ConstString &name);
535 
536             virtual
537             ~NSSetMSyntheticFrontEnd ();
538         private:
539             ExecutionContextRef m_exe_ctx_ref;
540             uint8_t m_ptr_size;
541             DataDescriptor_32 *m_data_32;
542             DataDescriptor_64 *m_data_64;
543             std::vector<SetItemDescriptor> m_children;
544         };
545 
546         class NSSetCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
547         {
548         public:
549             NSSetCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
550 
551             virtual size_t
552             CalculateNumChildren ();
553 
554             virtual lldb::ValueObjectSP
555             GetChildAtIndex (size_t idx);
556 
557             virtual bool
558             Update();
559 
560             virtual bool
561             MightHaveChildren ();
562 
563             virtual size_t
564             GetIndexOfChildWithName (const ConstString &name);
565 
566             virtual
567             ~NSSetCodeRunningSyntheticFrontEnd ();
568         };
569 
570         SyntheticChildrenFrontEnd* NSSetSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
571 
572         class LibcxxVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd
573         {
574         public:
575             LibcxxVectorBoolSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
576 
577             virtual size_t
578             CalculateNumChildren ();
579 
580             virtual lldb::ValueObjectSP
581             GetChildAtIndex (size_t idx);
582 
583             virtual bool
584             Update();
585 
586             virtual bool
587             MightHaveChildren ();
588 
589             virtual size_t
590             GetIndexOfChildWithName (const ConstString &name);
591 
592             virtual
593             ~LibcxxVectorBoolSyntheticFrontEnd ();
594         private:
595             ExecutionContextRef m_exe_ctx_ref;
596             uint64_t m_count;
597             lldb::addr_t m_base_data_address;
598             EvaluateExpressionOptions m_options;
599         };
600 
601         SyntheticChildrenFrontEnd* LibcxxVectorBoolSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
602 
603         bool
604         LibcxxContainerSummaryProvider (ValueObject& valobj, Stream& stream);
605 
606         class LibstdcppVectorBoolSyntheticFrontEnd : public SyntheticChildrenFrontEnd
607         {
608         public:
609             LibstdcppVectorBoolSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
610 
611             virtual size_t
612             CalculateNumChildren ();
613 
614             virtual lldb::ValueObjectSP
615             GetChildAtIndex (size_t idx);
616 
617             virtual bool
618             Update();
619 
620             virtual bool
621             MightHaveChildren ();
622 
623             virtual size_t
624             GetIndexOfChildWithName (const ConstString &name);
625 
626             virtual
627             ~LibstdcppVectorBoolSyntheticFrontEnd ();
628         private:
629             ExecutionContextRef m_exe_ctx_ref;
630             uint64_t m_count;
631             lldb::addr_t m_base_data_address;
632             EvaluateExpressionOptions m_options;
633         };
634 
635         SyntheticChildrenFrontEnd* LibstdcppVectorBoolSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
636 
637         class LibstdcppMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
638         {
639         public:
640             LibstdcppMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
641 
642             virtual size_t
643             CalculateNumChildren ();
644 
645             virtual lldb::ValueObjectSP
646             GetChildAtIndex (size_t idx);
647 
648             virtual bool
649             Update();
650 
651             virtual bool
652             MightHaveChildren ();
653 
654             virtual size_t
655             GetIndexOfChildWithName (const ConstString &name);
656 
657             virtual
658             ~LibstdcppMapIteratorSyntheticFrontEnd ();
659         private:
660             ExecutionContextRef m_exe_ctx_ref;
661             lldb::addr_t m_pair_address;
662             ClangASTType m_pair_type;
663             EvaluateExpressionOptions m_options;
664             lldb::ValueObjectSP m_pair_sp;
665         };
666 
667         SyntheticChildrenFrontEnd* LibstdcppMapIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
668 
669         class LibCxxMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
670         {
671         public:
672             LibCxxMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
673 
674             virtual size_t
675             CalculateNumChildren ();
676 
677             virtual lldb::ValueObjectSP
678             GetChildAtIndex (size_t idx);
679 
680             virtual bool
681             Update();
682 
683             virtual bool
684             MightHaveChildren ();
685 
686             virtual size_t
687             GetIndexOfChildWithName (const ConstString &name);
688 
689             virtual
690             ~LibCxxMapIteratorSyntheticFrontEnd ();
691         private:
692             ValueObject *m_pair_ptr;
693         };
694 
695         SyntheticChildrenFrontEnd* LibCxxMapIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
696 
697         class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
698         {
699         public:
700             VectorIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp,
701                                              ConstString item_name);
702 
703             virtual size_t
704             CalculateNumChildren ();
705 
706             virtual lldb::ValueObjectSP
707             GetChildAtIndex (size_t idx);
708 
709             virtual bool
710             Update();
711 
712             virtual bool
713             MightHaveChildren ();
714 
715             virtual size_t
716             GetIndexOfChildWithName (const ConstString &name);
717 
718             virtual
719             ~VectorIteratorSyntheticFrontEnd ();
720         private:
721             ExecutionContextRef m_exe_ctx_ref;
722             ConstString m_item_name;
723             lldb::ValueObjectSP m_item_sp;
724         };
725 
726         SyntheticChildrenFrontEnd* LibCxxVectorIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
727 
728         SyntheticChildrenFrontEnd* LibStdcppVectorIteratorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
729 
730         class LibcxxSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd
731         {
732         public:
733             LibcxxSharedPtrSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
734 
735             virtual size_t
736             CalculateNumChildren ();
737 
738             virtual lldb::ValueObjectSP
739             GetChildAtIndex (size_t idx);
740 
741             virtual bool
742             Update();
743 
744             virtual bool
745             MightHaveChildren ();
746 
747             virtual size_t
748             GetIndexOfChildWithName (const ConstString &name);
749 
750             virtual
751             ~LibcxxSharedPtrSyntheticFrontEnd ();
752         private:
753             ValueObject* m_cntrl;
754             lldb::ValueObjectSP m_count_sp;
755             lldb::ValueObjectSP m_weak_count_sp;
756             uint8_t m_ptr_size;
757             lldb::ByteOrder m_byte_order;
758         };
759 
760         SyntheticChildrenFrontEnd* LibcxxSharedPtrSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
761 
762         class LibcxxStdVectorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
763         {
764         public:
765             LibcxxStdVectorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
766 
767             virtual size_t
768             CalculateNumChildren ();
769 
770             virtual lldb::ValueObjectSP
771             GetChildAtIndex (size_t idx);
772 
773             virtual bool
774             Update();
775 
776             virtual bool
777             MightHaveChildren ();
778 
779             virtual size_t
780             GetIndexOfChildWithName (const ConstString &name);
781 
782             virtual
783             ~LibcxxStdVectorSyntheticFrontEnd ();
784         private:
785             ValueObject* m_start;
786             ValueObject* m_finish;
787             ClangASTType m_element_type;
788             uint32_t m_element_size;
789             std::map<size_t,lldb::ValueObjectSP> m_children;
790         };
791 
792         SyntheticChildrenFrontEnd* LibcxxStdVectorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
793 
794         class LibcxxStdListSyntheticFrontEnd : public SyntheticChildrenFrontEnd
795         {
796         public:
797             LibcxxStdListSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
798 
799             virtual size_t
800             CalculateNumChildren ();
801 
802             virtual lldb::ValueObjectSP
803             GetChildAtIndex (size_t idx);
804 
805             virtual bool
806             Update();
807 
808             virtual bool
809             MightHaveChildren ();
810 
811             virtual size_t
812             GetIndexOfChildWithName (const ConstString &name);
813 
814             virtual
815             ~LibcxxStdListSyntheticFrontEnd ();
816         private:
817             bool
818             HasLoop();
819 
820             size_t m_list_capping_size;
821             static const bool g_use_loop_detect = true;
822             lldb::addr_t m_node_address;
823             ValueObject* m_head;
824             ValueObject* m_tail;
825             ClangASTType m_element_type;
826             size_t m_count;
827             std::map<size_t,lldb::ValueObjectSP> m_children;
828         };
829 
830         SyntheticChildrenFrontEnd* LibcxxStdListSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
831 
832         class LibcxxStdMapSyntheticFrontEnd : public SyntheticChildrenFrontEnd
833         {
834         public:
835             LibcxxStdMapSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
836 
837             virtual size_t
838             CalculateNumChildren ();
839 
840             virtual lldb::ValueObjectSP
841             GetChildAtIndex (size_t idx);
842 
843             virtual bool
844             Update();
845 
846             virtual bool
847             MightHaveChildren ();
848 
849             virtual size_t
850             GetIndexOfChildWithName (const ConstString &name);
851 
852             virtual
853             ~LibcxxStdMapSyntheticFrontEnd ();
854         private:
855             bool
856             GetDataType();
857 
858             void
859             GetValueOffset (const lldb::ValueObjectSP& node);
860 
861             ValueObject* m_tree;
862             ValueObject* m_root_node;
863             ClangASTType m_element_type;
864             uint32_t m_skip_size;
865             size_t m_count;
866             std::map<size_t,lldb::ValueObjectSP> m_children;
867         };
868 
869         SyntheticChildrenFrontEnd* LibcxxStdMapSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
870 
871     } // namespace formatters
872 } // namespace lldb_private
873 
874 #endif // liblldb_CXXFormatterFunctions_h_
875