]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
Update LLDB snapshot to upstream r216948 (git 50f7fe44)
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / DataFormatters / CXXFormatterFunctions.cpp
1 //===-- CXXFormatterFunctions.cpp---------------------------------*- 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 #include "lldb/lldb-python.h"
11
12 #include "lldb/DataFormatters/CXXFormatterFunctions.h"
13
14 #include "llvm/Support/ConvertUTF.h"
15
16 #include "lldb/Core/DataBufferHeap.h"
17 #include "lldb/Core/Error.h"
18 #include "lldb/Core/Stream.h"
19 #include "lldb/Core/ValueObject.h"
20 #include "lldb/Core/ValueObjectConstResult.h"
21 #include "lldb/Host/Endian.h"
22 #include "lldb/Symbol/ClangASTContext.h"
23 #include "lldb/Target/Target.h"
24 #include "lldb/Target/Thread.h"
25
26 #include <algorithm>
27
28 using namespace lldb;
29 using namespace lldb_private;
30 using namespace lldb_private::formatters;
31
32 StackFrame*
33 lldb_private::formatters::GetViableFrame (ExecutionContext exe_ctx)
34 {
35     StackFrame* frame = exe_ctx.GetFramePtr();
36     if (frame)
37         return frame;
38     
39     Process* process = exe_ctx.GetProcessPtr();
40     if (!process)
41         return nullptr;
42     
43     ThreadSP thread_sp(process->GetThreadList().GetSelectedThread());
44     if (thread_sp)
45         return thread_sp->GetSelectedFrame().get();
46     return nullptr;
47 }
48
49 bool
50 lldb_private::formatters::ExtractValueFromObjCExpression (ValueObject &valobj,
51                                                           const char* target_type,
52                                                           const char* selector,
53                                                           uint64_t &value)
54 {
55     if (!target_type || !*target_type)
56         return false;
57     if (!selector || !*selector)
58         return false;
59     StreamString expr;
60     expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
61     ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
62     lldb::ValueObjectSP result_sp;
63     Target* target = exe_ctx.GetTargetPtr();
64     StackFrame* stack_frame = GetViableFrame(exe_ctx);
65     if (!target || !stack_frame)
66         return false;
67     
68     EvaluateExpressionOptions options;
69     options.SetCoerceToId(false);
70     options.SetUnwindOnError(true);
71     options.SetKeepInMemory(true);
72     
73     target->EvaluateExpression(expr.GetData(),
74                                stack_frame,
75                                result_sp,
76                                options);
77     if (!result_sp)
78         return false;
79     value = result_sp->GetValueAsUnsigned(0);
80     return true;
81 }
82
83 bool
84 lldb_private::formatters::ExtractSummaryFromObjCExpression (ValueObject &valobj,
85                                                             const char* target_type,
86                                                             const char* selector,
87                                                             Stream &stream)
88 {
89     if (!target_type || !*target_type)
90         return false;
91     if (!selector || !*selector)
92         return false;
93     StreamString expr;
94     expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
95     ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
96     lldb::ValueObjectSP result_sp;
97     Target* target = exe_ctx.GetTargetPtr();
98     StackFrame* stack_frame = GetViableFrame(exe_ctx);
99     if (!target || !stack_frame)
100         return false;
101     
102     EvaluateExpressionOptions options;
103     options.SetCoerceToId(false);
104     options.SetUnwindOnError(true);
105     options.SetKeepInMemory(true);
106     options.SetUseDynamic(lldb::eDynamicCanRunTarget);
107     
108     target->EvaluateExpression(expr.GetData(),
109                                stack_frame,
110                                result_sp,
111                                options);
112     if (!result_sp)
113         return false;
114     stream.Printf("%s",result_sp->GetSummaryAsCString());
115     return true;
116 }
117
118 lldb::ValueObjectSP
119 lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
120                                                 const char* return_type,
121                                                 const char* selector,
122                                                 uint64_t index)
123 {
124     lldb::ValueObjectSP valobj_sp;
125     if (!return_type || !*return_type)
126         return valobj_sp;
127     if (!selector || !*selector)
128         return valobj_sp;
129     StreamString expr_path_stream;
130     valobj.GetExpressionPath(expr_path_stream, false);
131     StreamString expr;
132     expr.Printf("(%s)[%s %s:%" PRId64 "]",return_type,expr_path_stream.GetData(),selector,index);
133     ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
134     lldb::ValueObjectSP result_sp;
135     Target* target = exe_ctx.GetTargetPtr();
136     StackFrame* stack_frame = GetViableFrame(exe_ctx);
137     if (!target || !stack_frame)
138         return valobj_sp;
139     
140     EvaluateExpressionOptions options;
141     options.SetCoerceToId(false);
142     options.SetUnwindOnError(true);
143     options.SetKeepInMemory(true);
144     options.SetUseDynamic(lldb::eDynamicCanRunTarget);
145     
146     target->EvaluateExpression(expr.GetData(),
147                                stack_frame,
148                                valobj_sp,
149                                options);
150     return valobj_sp;
151 }
152
153 lldb::ValueObjectSP
154 lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
155                                                 const char* return_type,
156                                                 const char* selector,
157                                                 const char* key)
158 {
159     lldb::ValueObjectSP valobj_sp;
160     if (!return_type || !*return_type)
161         return valobj_sp;
162     if (!selector || !*selector)
163         return valobj_sp;
164     if (!key || !*key)
165         return valobj_sp;
166     StreamString expr_path_stream;
167     valobj.GetExpressionPath(expr_path_stream, false);
168     StreamString expr;
169     expr.Printf("(%s)[%s %s:%s]",return_type,expr_path_stream.GetData(),selector,key);
170     ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
171     lldb::ValueObjectSP result_sp;
172     Target* target = exe_ctx.GetTargetPtr();
173     StackFrame* stack_frame = GetViableFrame(exe_ctx);
174     if (!target || !stack_frame)
175         return valobj_sp;
176     
177     EvaluateExpressionOptions options;
178     options.SetCoerceToId(false);
179     options.SetUnwindOnError(true);
180     options.SetKeepInMemory(true);
181     options.SetUseDynamic(lldb::eDynamicCanRunTarget);
182     
183     target->EvaluateExpression(expr.GetData(),
184                                stack_frame,
185                                valobj_sp,
186                                options);
187     return valobj_sp;
188 }
189
190 // use this call if you already have an LLDB-side buffer for the data
191 template<typename SourceDataType>
192 static bool
193 DumpUTFBufferToStream (ConversionResult (*ConvertFunction) (const SourceDataType**,
194                                                             const SourceDataType*,
195                                                             UTF8**,
196                                                             UTF8*,
197                                                             ConversionFlags),
198                        DataExtractor& data,
199                        Stream& stream,
200                        char prefix_token = '@',
201                        char quote = '"',
202                        uint32_t sourceSize = 0)
203 {
204     if (prefix_token != 0)
205         stream.Printf("%c",prefix_token);
206     if (quote != 0)
207         stream.Printf("%c",quote);
208     if (data.GetByteSize() && data.GetDataStart() && data.GetDataEnd())
209     {
210         const int bufferSPSize = data.GetByteSize();
211         if (sourceSize == 0)
212         {
213             const int origin_encoding = 8*sizeof(SourceDataType);
214             sourceSize = bufferSPSize/(origin_encoding / 4);
215         }
216         
217         SourceDataType *data_ptr = (SourceDataType*)data.GetDataStart();
218         SourceDataType *data_end_ptr = data_ptr + sourceSize;
219         
220         while (data_ptr < data_end_ptr)
221         {
222             if (!*data_ptr)
223             {
224                 data_end_ptr = data_ptr;
225                 break;
226             }
227             data_ptr++;
228         }
229         
230         data_ptr = (SourceDataType*)data.GetDataStart();
231         
232         lldb::DataBufferSP utf8_data_buffer_sp;
233         UTF8* utf8_data_ptr = nullptr;
234         UTF8* utf8_data_end_ptr = nullptr;
235         
236         if (ConvertFunction)
237         {
238             utf8_data_buffer_sp.reset(new DataBufferHeap(4*bufferSPSize,0));
239             utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
240             utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize();
241             ConvertFunction ( (const SourceDataType**)&data_ptr, data_end_ptr, &utf8_data_ptr, utf8_data_end_ptr, lenientConversion );
242             utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes(); // needed because the ConvertFunction will change the value of the data_ptr
243         }
244         else
245         {
246             // just copy the pointers - the cast is necessary to make the compiler happy
247             // but this should only happen if we are reading UTF8 data
248             utf8_data_ptr = (UTF8*)data_ptr;
249             utf8_data_end_ptr = (UTF8*)data_end_ptr;
250         }
251         
252         // since we tend to accept partial data (and even partially malformed data)
253         // we might end up with no NULL terminator before the end_ptr
254         // hence we need to take a slower route and ensure we stay within boundaries
255         for (;utf8_data_ptr != utf8_data_end_ptr; utf8_data_ptr++)
256         {
257             if (!*utf8_data_ptr)
258                 break;
259             stream.Printf("%c",*utf8_data_ptr);
260         }
261     }
262     if (quote != 0)
263         stream.Printf("%c",quote);
264     return true;
265 }
266
267 template<typename SourceDataType>
268 class ReadUTFBufferAndDumpToStreamOptions
269 {
270 public:
271     typedef ConversionResult (*ConvertFunctionType) (const SourceDataType**,
272                                                      const SourceDataType*,
273                                                      UTF8**,
274                                                      UTF8*,
275                                                      ConversionFlags);
276     
277     ReadUTFBufferAndDumpToStreamOptions () :
278     m_conversion_function(NULL),
279     m_location(0),
280     m_process_sp(),
281     m_stream(NULL),
282     m_prefix_token('@'),
283     m_quote('"'),
284     m_source_size(0),
285     m_needs_zero_termination(true)
286     {
287     }
288     
289     ReadUTFBufferAndDumpToStreamOptions&
290     SetConversionFunction (ConvertFunctionType f)
291     {
292         m_conversion_function = f;
293         return *this;
294     }
295     
296     ConvertFunctionType
297     GetConversionFunction () const
298     {
299         return m_conversion_function;
300     }
301     
302     ReadUTFBufferAndDumpToStreamOptions&
303     SetLocation (uint64_t l)
304     {
305         m_location = l;
306         return *this;
307     }
308     
309     uint64_t
310     GetLocation () const
311     {
312         return m_location;
313     }
314     
315     ReadUTFBufferAndDumpToStreamOptions&
316     SetProcessSP (ProcessSP p)
317     {
318         m_process_sp = p;
319         return *this;
320     }
321     
322     ProcessSP
323     GetProcessSP () const
324     {
325         return m_process_sp;
326     }
327     
328     ReadUTFBufferAndDumpToStreamOptions&
329     SetStream (Stream* s)
330     {
331         m_stream = s;
332         return *this;
333     }
334     
335     Stream*
336     GetStream () const
337     {
338         return m_stream;
339     }
340     
341     ReadUTFBufferAndDumpToStreamOptions&
342     SetPrefixToken (char p)
343     {
344         m_prefix_token = p;
345         return *this;
346     }
347     
348     char
349     GetPrefixToken () const
350     {
351         return m_prefix_token;
352     }
353     
354     ReadUTFBufferAndDumpToStreamOptions&
355     SetQuote (char q)
356     {
357         m_quote = q;
358         return *this;
359     }
360     
361     char
362     GetQuote () const
363     {
364         return m_quote;
365     }
366     
367     ReadUTFBufferAndDumpToStreamOptions&
368     SetSourceSize (uint32_t s)
369     {
370         m_source_size = s;
371         return *this;
372     }
373     
374     uint32_t
375     GetSourceSize () const
376     {
377         return m_source_size;
378     }
379     
380     ReadUTFBufferAndDumpToStreamOptions&
381     SetNeedsZeroTermination (bool z)
382     {
383         m_needs_zero_termination = z;
384         return *this;
385     }
386     
387     bool
388     GetNeedsZeroTermination () const
389     {
390         return m_needs_zero_termination;
391     }
392     
393 private:
394     ConvertFunctionType m_conversion_function;
395     uint64_t m_location;
396     ProcessSP m_process_sp;
397     Stream* m_stream;
398     char m_prefix_token;
399     char m_quote;
400     uint32_t m_source_size;
401     bool m_needs_zero_termination;
402 };
403
404 template<typename SourceDataType>
405 static bool
406 ReadUTFBufferAndDumpToStream (const ReadUTFBufferAndDumpToStreamOptions<SourceDataType>& options)
407 {
408     if (options.GetLocation() == 0 || options.GetLocation() == LLDB_INVALID_ADDRESS)
409         return false;
410     
411     ProcessSP process_sp(options.GetProcessSP());
412     
413     if (!process_sp)
414         return false;
415
416     const int type_width = sizeof(SourceDataType);
417     const int origin_encoding = 8 * type_width ;
418     if (origin_encoding != 8 && origin_encoding != 16 && origin_encoding != 32)
419         return false;
420     // if not UTF8, I need a conversion function to return proper UTF8
421     if (origin_encoding != 8 && !options.GetConversionFunction())
422         return false;
423     
424     if (!options.GetStream())
425         return false;
426
427     uint32_t sourceSize = options.GetSourceSize();
428     bool needs_zero_terminator = options.GetNeedsZeroTermination();
429     
430     if (!sourceSize)
431     {
432         sourceSize = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
433         needs_zero_terminator = true;
434     }
435     else
436         sourceSize = std::min(sourceSize,process_sp->GetTarget().GetMaximumSizeOfStringSummary());
437     
438     const int bufferSPSize = sourceSize * type_width;
439
440     lldb::DataBufferSP buffer_sp(new DataBufferHeap(bufferSPSize,0));
441     
442     if (!buffer_sp->GetBytes())
443         return false;
444     
445     Error error;
446     char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes()); 
447
448     size_t data_read = 0;
449     if (needs_zero_terminator)
450         data_read = process_sp->ReadStringFromMemory(options.GetLocation(), buffer, bufferSPSize, error, type_width);
451     else
452         data_read = process_sp->ReadMemoryFromInferior(options.GetLocation(), (char*)buffer_sp->GetBytes(), bufferSPSize, error);
453
454     if (error.Fail() || data_read == 0)
455     {
456         options.GetStream()->Printf("unable to read data");
457         return true;
458     }
459     
460     DataExtractor data(buffer_sp, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
461     
462     return DumpUTFBufferToStream(options.GetConversionFunction(), data, *options.GetStream(), options.GetPrefixToken(), options.GetQuote(), sourceSize);
463 }
464
465 bool
466 lldb_private::formatters::Char16StringSummaryProvider (ValueObject& valobj, Stream& stream)
467 {
468     ProcessSP process_sp = valobj.GetProcessSP();
469     if (!process_sp)
470         return false;
471     
472     lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
473     
474     if (!valobj_addr)
475         return false;
476     
477     ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
478     options.SetLocation(valobj_addr);
479     options.SetConversionFunction(ConvertUTF16toUTF8);
480     options.SetProcessSP(process_sp);
481     options.SetStream(&stream);
482     options.SetPrefixToken('u');
483     
484     if (!ReadUTFBufferAndDumpToStream(options))
485     {
486         stream.Printf("Summary Unavailable");
487         return true;
488     }
489
490     return true;
491 }
492
493 bool
494 lldb_private::formatters::Char32StringSummaryProvider (ValueObject& valobj, Stream& stream)
495 {
496     ProcessSP process_sp = valobj.GetProcessSP();
497     if (!process_sp)
498         return false;
499     
500     lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
501     
502     if (!valobj_addr)
503         return false;
504     
505     ReadUTFBufferAndDumpToStreamOptions<UTF32> options;
506     options.SetLocation(valobj_addr);
507     options.SetConversionFunction(ConvertUTF32toUTF8);
508     options.SetProcessSP(process_sp);
509     options.SetStream(&stream);
510     options.SetPrefixToken('U');
511     
512     if (!ReadUTFBufferAndDumpToStream(options))
513     {
514         stream.Printf("Summary Unavailable");
515         return true;
516     }
517     
518     return true;
519 }
520
521 bool
522 lldb_private::formatters::WCharStringSummaryProvider (ValueObject& valobj, Stream& stream)
523 {
524     ProcessSP process_sp = valobj.GetProcessSP();
525     if (!process_sp)
526         return false;
527
528     lldb::addr_t data_addr = 0;
529     
530     if (valobj.IsPointerType())
531         data_addr = valobj.GetValueAsUnsigned(0);
532     else if (valobj.IsArrayType())
533         data_addr = valobj.GetAddressOf();
534
535     if (data_addr == 0 || data_addr == LLDB_INVALID_ADDRESS)
536         return false;
537
538     clang::ASTContext* ast = valobj.GetClangType().GetASTContext();
539     
540     if (!ast)
541         return false;
542
543     ClangASTType wchar_clang_type = ClangASTContext::GetBasicType(ast, lldb::eBasicTypeWChar);
544     const uint32_t wchar_size = wchar_clang_type.GetBitSize();
545
546     switch (wchar_size)
547     {
548         case 8:
549         {
550             // utf 8
551             
552             ReadUTFBufferAndDumpToStreamOptions<UTF8> options;
553             options.SetLocation(data_addr);
554             options.SetConversionFunction(nullptr);
555             options.SetProcessSP(process_sp);
556             options.SetStream(&stream);
557             options.SetPrefixToken('L');
558
559             return ReadUTFBufferAndDumpToStream(options);
560         }
561         case 16:
562         {
563             // utf 16
564             ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
565             options.SetLocation(data_addr);
566             options.SetConversionFunction(ConvertUTF16toUTF8);
567             options.SetProcessSP(process_sp);
568             options.SetStream(&stream);
569             options.SetPrefixToken('L');
570             
571             return ReadUTFBufferAndDumpToStream(options);
572         }
573         case 32:
574         {
575             // utf 32
576             ReadUTFBufferAndDumpToStreamOptions<UTF32> options;
577             options.SetLocation(data_addr);
578             options.SetConversionFunction(ConvertUTF32toUTF8);
579             options.SetProcessSP(process_sp);
580             options.SetStream(&stream);
581             options.SetPrefixToken('L');
582             
583             return ReadUTFBufferAndDumpToStream(options);
584         }
585         default:
586             stream.Printf("size for wchar_t is not valid");
587             return true;
588     }
589     return true;
590 }
591
592 bool
593 lldb_private::formatters::Char16SummaryProvider (ValueObject& valobj, Stream& stream)
594 {
595     DataExtractor data;
596     Error error;
597     valobj.GetData(data, error);
598     
599     if (error.Fail())
600         return false;
601     
602     std::string value;
603     valobj.GetValueAsCString(lldb::eFormatUnicode16, value);
604     if (!value.empty())
605         stream.Printf("%s ", value.c_str());
606
607     return DumpUTFBufferToStream<UTF16>(ConvertUTF16toUTF8,data,stream, 'u','\'',1);
608 }
609
610 bool
611 lldb_private::formatters::Char32SummaryProvider (ValueObject& valobj, Stream& stream)
612 {
613     DataExtractor data;
614     Error error;
615     valobj.GetData(data, error);
616     
617     if (error.Fail())
618         return false;
619     
620     std::string value;
621     valobj.GetValueAsCString(lldb::eFormatUnicode32, value);
622     if (!value.empty())
623         stream.Printf("%s ", value.c_str());
624     
625     return DumpUTFBufferToStream<UTF32>(ConvertUTF32toUTF8,data,stream, 'U','\'',1);
626 }
627
628 bool
629 lldb_private::formatters::WCharSummaryProvider (ValueObject& valobj, Stream& stream)
630 {
631     DataExtractor data;
632     Error error;
633     valobj.GetData(data, error);
634     
635     if (error.Fail())
636         return false;
637     
638     clang::ASTContext* ast = valobj.GetClangType().GetASTContext();
639     
640     if (!ast)
641         return false;
642     
643     ClangASTType wchar_clang_type = ClangASTContext::GetBasicType(ast, lldb::eBasicTypeWChar);
644     const uint32_t wchar_size = wchar_clang_type.GetBitSize();
645     std::string value;
646     
647     switch (wchar_size)
648     {
649         case 8:
650             // utf 8
651             valobj.GetValueAsCString(lldb::eFormatChar, value);
652             if (!value.empty())
653                 stream.Printf("%s ", value.c_str());
654             return DumpUTFBufferToStream<UTF8>(nullptr,
655                                                data,
656                                                stream,
657                                                'L',
658                                                '\'',
659                                                1);
660         case 16:
661             // utf 16
662             valobj.GetValueAsCString(lldb::eFormatUnicode16, value);
663             if (!value.empty())
664                 stream.Printf("%s ", value.c_str());
665             return DumpUTFBufferToStream<UTF16>(ConvertUTF16toUTF8,
666                                                 data,
667                                                 stream,
668                                                 'L',
669                                                 '\'',
670                                                 1);
671         case 32:
672             // utf 32
673             valobj.GetValueAsCString(lldb::eFormatUnicode32, value);
674             if (!value.empty())
675                 stream.Printf("%s ", value.c_str());
676             return DumpUTFBufferToStream<UTF32>(ConvertUTF32toUTF8,
677                                                 data,
678                                                 stream,
679                                                 'L',
680                                                 '\'',
681                                                 1);
682         default:
683             stream.Printf("size for wchar_t is not valid");
684             return true;
685     }
686     return true;
687 }
688
689 // the field layout in a libc++ string (cap, side, data or data, size, cap)
690 enum LibcxxStringLayoutMode
691 {
692     eLibcxxStringLayoutModeCSD = 0,
693     eLibcxxStringLayoutModeDSC = 1,
694     eLibcxxStringLayoutModeInvalid = 0xffff
695 };
696
697 // this function abstracts away the layout and mode details of a libc++ string
698 // and returns the address of the data and the size ready for callers to consume
699 static bool
700 ExtractLibcxxStringInfo (ValueObject& valobj,
701                          ValueObjectSP &location_sp,
702                          uint64_t& size)
703 {
704     ValueObjectSP D(valobj.GetChildAtIndexPath({0,0,0,0}));
705     if (!D)
706         return false;
707     
708     ValueObjectSP layout_decider(D->GetChildAtIndexPath({0,0}));
709     
710     // this child should exist
711     if (!layout_decider)
712         return false;
713     
714     ConstString g_data_name("__data_");
715     ConstString g_size_name("__size_");
716     bool short_mode = false; // this means the string is in short-mode and the data is stored inline
717     LibcxxStringLayoutMode layout = (layout_decider->GetName() == g_data_name) ? eLibcxxStringLayoutModeDSC : eLibcxxStringLayoutModeCSD;
718     uint64_t size_mode_value = 0;
719     
720     if (layout == eLibcxxStringLayoutModeDSC)
721     {
722         ValueObjectSP size_mode(D->GetChildAtIndexPath({1,1,0}));
723         if (!size_mode)
724             return false;
725         
726         if (size_mode->GetName() != g_size_name)
727         {
728             // we are hitting the padding structure, move along
729             size_mode = D->GetChildAtIndexPath({1,1,1});
730             if (!size_mode)
731                 return false;
732         }
733         
734         size_mode_value = (size_mode->GetValueAsUnsigned(0));
735         short_mode = ((size_mode_value & 0x80) == 0);
736     }
737     else
738     {
739         ValueObjectSP size_mode(D->GetChildAtIndexPath({1,0,0}));
740         if (!size_mode)
741             return false;
742         
743         size_mode_value = (size_mode->GetValueAsUnsigned(0));
744         short_mode = ((size_mode_value & 1) == 0);
745     }
746     
747     if (short_mode)
748     {
749         ValueObjectSP s(D->GetChildAtIndex(1, true));
750         if (!s)
751             return false;
752         location_sp = s->GetChildAtIndex((layout == eLibcxxStringLayoutModeDSC) ? 0 : 1, true);
753         size = (layout == eLibcxxStringLayoutModeDSC) ? size_mode_value : ((size_mode_value >> 1) % 256);
754         return (location_sp.get() != nullptr);
755     }
756     else
757     {
758         ValueObjectSP l(D->GetChildAtIndex(0, true));
759         if (!l)
760             return false;
761         // we can use the layout_decider object as the data pointer
762         location_sp = (layout == eLibcxxStringLayoutModeDSC) ? layout_decider : l->GetChildAtIndex(2, true);
763         ValueObjectSP size_vo(l->GetChildAtIndex(1, true));
764         if (!size_vo || !location_sp)
765             return false;
766         size = size_vo->GetValueAsUnsigned(0);
767         return true;
768     }
769 }
770
771 bool
772 lldb_private::formatters::LibcxxWStringSummaryProvider (ValueObject& valobj, Stream& stream)
773 {
774     uint64_t size = 0;
775     ValueObjectSP location_sp((ValueObject*)nullptr);
776     if (!ExtractLibcxxStringInfo(valobj, location_sp, size))
777         return false;
778     if (size == 0)
779     {
780         stream.Printf("L\"\"");
781         return true;
782     }   
783     if (!location_sp)
784         return false;
785     return WCharStringSummaryProvider(*location_sp.get(), stream);
786 }
787
788 bool
789 lldb_private::formatters::LibcxxStringSummaryProvider (ValueObject& valobj, Stream& stream)
790 {
791     uint64_t size = 0;
792     ValueObjectSP location_sp((ValueObject*)nullptr);
793     if (!ExtractLibcxxStringInfo(valobj, location_sp, size))
794         return false;
795     if (size == 0)
796     {
797         stream.Printf("\"\"");
798         return true;
799     }
800     if (!location_sp)
801         return false;
802     Error error;
803     if (location_sp->ReadPointedString(stream,
804                                        error,
805                                        0, // max length is decided by the settings
806                                        false) == 0) // do not honor array (terminates on first 0 byte even for a char[])
807         stream.Printf("\"\""); // if nothing was read, print an empty string
808     return error.Success();
809 }
810
811 bool
812 lldb_private::formatters::ObjCClassSummaryProvider (ValueObject& valobj, Stream& stream)
813 {
814     ProcessSP process_sp = valobj.GetProcessSP();
815     if (!process_sp)
816         return false;
817     
818     ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
819     
820     if (!runtime)
821         return false;
822     
823     ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptorFromISA(valobj.GetValueAsUnsigned(0)));
824     
825     if (!descriptor.get() || !descriptor->IsValid())
826         return false;
827
828     const char* class_name = descriptor->GetClassName().GetCString();
829     
830     if (!class_name || !*class_name)
831         return false;
832     
833     stream.Printf("%s",class_name);
834     return true;
835 }
836
837 class ObjCClassSyntheticChildrenFrontEnd : public SyntheticChildrenFrontEnd
838 {
839 public:
840     ObjCClassSyntheticChildrenFrontEnd (lldb::ValueObjectSP valobj_sp) :
841     SyntheticChildrenFrontEnd(*valobj_sp.get())
842     {
843     }
844     
845     virtual size_t
846     CalculateNumChildren ()
847     {
848         return 0;
849     }
850     
851     virtual lldb::ValueObjectSP
852     GetChildAtIndex (size_t idx)
853     {
854         return lldb::ValueObjectSP();
855     }
856     
857     virtual bool
858     Update()
859     {
860         return false;
861     }
862     
863     virtual bool
864     MightHaveChildren ()
865     {
866         return false;
867     }
868     
869     virtual size_t
870     GetIndexOfChildWithName (const ConstString &name)
871     {
872         return UINT32_MAX;
873     }
874     
875     virtual
876     ~ObjCClassSyntheticChildrenFrontEnd ()
877     {
878     }
879 };
880
881 SyntheticChildrenFrontEnd*
882 lldb_private::formatters::ObjCClassSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
883 {
884     return new ObjCClassSyntheticChildrenFrontEnd(valobj_sp);
885 }
886
887 template<bool needs_at>
888 bool
889 lldb_private::formatters::NSDataSummaryProvider (ValueObject& valobj, Stream& stream)
890 {
891     ProcessSP process_sp = valobj.GetProcessSP();
892     if (!process_sp)
893         return false;
894     
895     ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
896     
897     if (!runtime)
898         return false;
899     
900     ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
901     
902     if (!descriptor.get() || !descriptor->IsValid())
903         return false;
904     
905     bool is_64bit = (process_sp->GetAddressByteSize() == 8);
906     lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
907     
908     if (!valobj_addr)
909         return false;
910     
911     uint64_t value = 0;
912     
913     const char* class_name = descriptor->GetClassName().GetCString();
914     
915     if (!class_name || !*class_name)
916         return false;
917     
918     if (!strcmp(class_name,"NSConcreteData") ||
919         !strcmp(class_name,"NSConcreteMutableData") ||
920         !strcmp(class_name,"__NSCFData"))
921     {
922         uint32_t offset = (is_64bit ? 16 : 8);
923         Error error;
924         value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + offset, is_64bit ? 8 : 4, 0, error);
925         if (error.Fail())
926             return false;
927     }
928     else
929     {
930         if (!ExtractValueFromObjCExpression(valobj, "int", "length", value))
931             return false;
932     }
933     
934     stream.Printf("%s%" PRIu64 " byte%s%s",
935                   (needs_at ? "@\"" : ""),
936                   value,
937                   (value != 1 ? "s" : ""),
938                   (needs_at ? "\"" : ""));
939     
940     return true;
941 }
942
943 static bool
944 ReadAsciiBufferAndDumpToStream (lldb::addr_t location,
945                                 lldb::ProcessSP& process_sp,
946                                 Stream& dest,
947                                 uint32_t size = 0,
948                                 Error* error = NULL,
949                                 size_t *data_read = NULL,
950                                 char prefix_token = '@',
951                                 char quote = '"')
952 {
953     Error my_error;
954     size_t my_data_read;
955     if (!process_sp || location == 0)
956         return false;
957     
958     if (!size)
959         size = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
960     else
961         size = std::min(size,process_sp->GetTarget().GetMaximumSizeOfStringSummary());
962     
963     lldb::DataBufferSP buffer_sp(new DataBufferHeap(size,0));
964     
965     my_data_read = process_sp->ReadCStringFromMemory(location, (char*)buffer_sp->GetBytes(), size, my_error);
966
967     if (error)
968         *error = my_error;
969     if (data_read)
970         *data_read = my_data_read;
971     
972     if (my_error.Fail())
973         return false;
974     
975     dest.Printf("%c%c",prefix_token,quote);
976     
977     if (my_data_read)
978         dest.Printf("%s",(char*)buffer_sp->GetBytes());
979     
980     dest.Printf("%c",quote);
981     
982     return true;
983 }
984
985 bool
986 lldb_private::formatters::NSTaggedString_SummaryProvider (ObjCLanguageRuntime::ClassDescriptorSP descriptor, Stream& stream)
987 {
988     if (!descriptor)
989         return false;
990     uint64_t len_bits = 0, data_bits = 0;
991     if (!descriptor->GetTaggedPointerInfo(&len_bits,&data_bits,nullptr))
992         return false;
993     
994     static const int g_MaxNonBitmaskedLen = 7; //TAGGED_STRING_UNPACKED_MAXLEN
995     static const int g_SixbitMaxLen = 9;
996     static const int g_fiveBitMaxLen = 11;
997     
998     static const char *sixBitToCharLookup = "eilotrm.apdnsIc ufkMShjTRxgC4013" "bDNvwyUL2O856P-B79AFKEWV_zGJ/HYX";
999     
1000     if (len_bits > g_fiveBitMaxLen)
1001         return false;
1002     
1003     // this is a fairly ugly trick - pretend that the numeric value is actually a char*
1004     // this works under a few assumptions:
1005     // little endian architecture
1006     // sizeof(uint64_t) > g_MaxNonBitmaskedLen
1007     if (len_bits <= g_MaxNonBitmaskedLen)
1008     {
1009         stream.Printf("@\"%s\"",(const char*)&data_bits);
1010         return true;
1011     }
1012     
1013     // if the data is bitmasked, we need to actually process the bytes
1014     uint8_t bitmask = 0;
1015     uint8_t shift_offset = 0;
1016     
1017     if (len_bits <= g_SixbitMaxLen)
1018     {
1019         bitmask = 0x03f;
1020         shift_offset = 6;
1021     }
1022     else
1023     {
1024         bitmask = 0x01f;
1025         shift_offset = 5;
1026     }
1027     
1028     std::vector<uint8_t> bytes;
1029     bytes.resize(len_bits);
1030     for (; len_bits > 0; data_bits >>= shift_offset, --len_bits)
1031     {
1032         uint8_t packed = data_bits & bitmask;
1033         bytes.insert(bytes.begin(), sixBitToCharLookup[packed]);
1034     }
1035     
1036     stream.Printf("@\"%s\"",&bytes[0]);
1037     return true;
1038 }
1039
1040 bool
1041 lldb_private::formatters::NSStringSummaryProvider (ValueObject& valobj, Stream& stream)
1042 {
1043     ProcessSP process_sp = valobj.GetProcessSP();
1044     if (!process_sp)
1045         return false;
1046     
1047     ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
1048     
1049     if (!runtime)
1050         return false;
1051     
1052     ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
1053     
1054     if (!descriptor.get() || !descriptor->IsValid())
1055         return false;
1056     
1057     uint32_t ptr_size = process_sp->GetAddressByteSize();
1058     
1059     lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
1060     
1061     if (!valobj_addr)
1062         return false;
1063     
1064     const char* class_name = descriptor->GetClassName().GetCString();
1065     
1066     if (!class_name || !*class_name)
1067         return false;
1068     
1069     bool is_tagged_ptr = (0 == strcmp(class_name,"NSTaggedPointerString")) && descriptor->GetTaggedPointerInfo();
1070     // for a tagged pointer, the descriptor has everything we need
1071     if (is_tagged_ptr)
1072         return NSTaggedString_SummaryProvider(descriptor, stream);
1073     
1074     // if not a tagged pointer that we know about, try the normal route
1075     uint64_t info_bits_location = valobj_addr + ptr_size;
1076     if (process_sp->GetByteOrder() != lldb::eByteOrderLittle)
1077         info_bits_location += 3;
1078         
1079     Error error;
1080     
1081     uint8_t info_bits = process_sp->ReadUnsignedIntegerFromMemory(info_bits_location, 1, 0, error);
1082     if (error.Fail())
1083         return false;
1084     
1085     bool is_mutable = (info_bits & 1) == 1;
1086     bool is_inline = (info_bits & 0x60) == 0;
1087     bool has_explicit_length = (info_bits & (1 | 4)) != 4;
1088     bool is_unicode = (info_bits & 0x10) == 0x10;
1089     bool is_special = strcmp(class_name,"NSPathStore2") == 0;
1090     bool has_null = (info_bits & 8) == 8;
1091     
1092     size_t explicit_length = 0;
1093     if (!has_null && has_explicit_length && !is_special)
1094     {
1095         lldb::addr_t explicit_length_offset = 2*ptr_size;
1096         if (is_mutable && !is_inline)
1097             explicit_length_offset = explicit_length_offset + ptr_size; //  notInlineMutable.length;
1098         else if (is_inline)
1099             explicit_length = explicit_length + 0; // inline1.length;
1100         else if (!is_inline && !is_mutable)
1101             explicit_length_offset = explicit_length_offset + ptr_size; // notInlineImmutable1.length;
1102         else
1103             explicit_length_offset = 0;
1104
1105         if (explicit_length_offset)
1106         {
1107             explicit_length_offset = valobj_addr + explicit_length_offset;
1108             explicit_length = process_sp->ReadUnsignedIntegerFromMemory(explicit_length_offset, 4, 0, error);
1109         }
1110     }
1111     
1112     if (strcmp(class_name,"NSString") &&
1113         strcmp(class_name,"CFStringRef") &&
1114         strcmp(class_name,"CFMutableStringRef") &&
1115         strcmp(class_name,"__NSCFConstantString") &&
1116         strcmp(class_name,"__NSCFString") &&
1117         strcmp(class_name,"NSCFConstantString") &&
1118         strcmp(class_name,"NSCFString") &&
1119         strcmp(class_name,"NSPathStore2"))
1120     {
1121         // not one of us - but tell me class name
1122         stream.Printf("class name = %s",class_name);
1123         return true;
1124     }
1125     
1126     if (is_mutable)
1127     {
1128         uint64_t location = 2 * ptr_size + valobj_addr;
1129         location = process_sp->ReadPointerFromMemory(location, error);
1130         if (error.Fail())
1131             return false;
1132         if (has_explicit_length && is_unicode)
1133         {
1134             ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
1135             options.SetConversionFunction(ConvertUTF16toUTF8);
1136             options.SetLocation(location);
1137             options.SetProcessSP(process_sp);
1138             options.SetStream(&stream);
1139             options.SetPrefixToken('@');
1140             options.SetQuote('"');
1141             options.SetSourceSize(explicit_length);
1142             options.SetNeedsZeroTermination(false);
1143             return ReadUTFBufferAndDumpToStream (options);
1144         }
1145         else
1146             return ReadAsciiBufferAndDumpToStream(location+1,process_sp,stream, explicit_length);
1147     }
1148     else if (is_inline && has_explicit_length && !is_unicode && !is_special && !is_mutable)
1149     {
1150         uint64_t location = 3 * ptr_size + valobj_addr;
1151         return ReadAsciiBufferAndDumpToStream(location,process_sp,stream,explicit_length);
1152     }
1153     else if (is_unicode)
1154     {
1155         uint64_t location = valobj_addr + 2*ptr_size;
1156         if (is_inline)
1157         {
1158             if (!has_explicit_length)
1159             {
1160                 stream.Printf("found new combo");
1161                 return true;
1162             }
1163             else
1164                 location += ptr_size;
1165         }
1166         else
1167         {
1168             location = process_sp->ReadPointerFromMemory(location, error);
1169             if (error.Fail())
1170                 return false;
1171         }
1172         ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
1173         options.SetConversionFunction(ConvertUTF16toUTF8);
1174         options.SetLocation(location);
1175         options.SetProcessSP(process_sp);
1176         options.SetStream(&stream);
1177         options.SetPrefixToken('@');
1178         options.SetQuote('"');
1179         options.SetSourceSize(explicit_length);
1180         options.SetNeedsZeroTermination(has_explicit_length == false);
1181         return ReadUTFBufferAndDumpToStream (options);
1182     }
1183     else if (is_special)
1184     {
1185         uint64_t location = valobj_addr + (ptr_size == 8 ? 12 : 8);
1186         ReadUTFBufferAndDumpToStreamOptions<UTF16> options;
1187         options.SetConversionFunction(ConvertUTF16toUTF8);
1188         options.SetLocation(location);
1189         options.SetProcessSP(process_sp);
1190         options.SetStream(&stream);
1191         options.SetPrefixToken('@');
1192         options.SetQuote('"');
1193         options.SetSourceSize(explicit_length);
1194         options.SetNeedsZeroTermination(has_explicit_length == false);
1195         return ReadUTFBufferAndDumpToStream (options);
1196     }
1197     else if (is_inline)
1198     {
1199         uint64_t location = valobj_addr + 2*ptr_size;
1200         if (!has_explicit_length)
1201             location++;
1202         return ReadAsciiBufferAndDumpToStream(location,process_sp,stream,explicit_length);
1203     }
1204     else
1205     {
1206         uint64_t location = valobj_addr + 2*ptr_size;
1207         location = process_sp->ReadPointerFromMemory(location, error);
1208         if (error.Fail())
1209             return false;
1210         if (has_explicit_length && !has_null)
1211             explicit_length++; // account for the fact that there is no NULL and we need to have one added
1212         return ReadAsciiBufferAndDumpToStream(location,process_sp,stream,explicit_length);
1213     }
1214     
1215     stream.Printf("class name = %s",class_name);
1216     return true;
1217     
1218 }
1219
1220 bool
1221 lldb_private::formatters::NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream)
1222 {
1223     TargetSP target_sp(valobj.GetTargetSP());
1224     if (!target_sp)
1225         return false;
1226     uint32_t addr_size = target_sp->GetArchitecture().GetAddressByteSize();
1227     uint64_t pointer_value = valobj.GetValueAsUnsigned(0);
1228     if (!pointer_value)
1229         return false;
1230     pointer_value += addr_size;
1231     ClangASTType type(valobj.GetClangType());
1232     ExecutionContext exe_ctx(target_sp,false);
1233     ValueObjectSP child_ptr_sp(valobj.CreateValueObjectFromAddress("string_ptr", pointer_value, exe_ctx, type));
1234     if (!child_ptr_sp)
1235         return false;
1236     DataExtractor data;
1237     Error error;
1238     child_ptr_sp->GetData(data, error);
1239     if (error.Fail())
1240         return false;
1241     ValueObjectSP child_sp(child_ptr_sp->CreateValueObjectFromData("string_data", data, exe_ctx, type));
1242     child_sp->GetValueAsUnsigned(0);
1243     if (child_sp)
1244         return NSStringSummaryProvider(*child_sp, stream);
1245     return false;
1246 }
1247
1248 bool
1249 lldb_private::formatters::NSMutableAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream)
1250 {
1251     return NSAttributedStringSummaryProvider(valobj, stream);
1252 }
1253
1254 bool
1255 lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream)
1256 {
1257     stream.Printf("%s",valobj.GetObjectDescription());
1258     return true;
1259 }
1260
1261 bool
1262 lldb_private::formatters::ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream)
1263 {
1264     const uint32_t type_info = valobj.GetClangType().GetTypeInfo();
1265     
1266     ValueObjectSP real_guy_sp = valobj.GetSP();
1267     
1268     if (type_info & ClangASTType::eTypeIsPointer)
1269     {
1270         Error err;
1271         real_guy_sp = valobj.Dereference(err);
1272         if (err.Fail() || !real_guy_sp)
1273             return false;
1274     }
1275     else if (type_info & ClangASTType::eTypeIsReference)
1276     {
1277         real_guy_sp =  valobj.GetChildAtIndex(0, true);
1278         if (!real_guy_sp)
1279             return false;
1280     }
1281     uint64_t value = real_guy_sp->GetValueAsUnsigned(0);
1282     if (value == 0)
1283     {
1284         stream.Printf("NO");
1285         return true;
1286     }
1287     stream.Printf("YES");
1288     return true;
1289 }
1290
1291 template <bool is_sel_ptr>
1292 bool
1293 lldb_private::formatters::ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream)
1294 {
1295     lldb::ValueObjectSP valobj_sp;
1296
1297     ClangASTType charstar (valobj.GetClangType().GetBasicTypeFromAST(eBasicTypeChar).GetPointerType());
1298     
1299     if (!charstar)
1300         return false;
1301
1302     ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
1303     
1304     if (is_sel_ptr)
1305     {
1306         lldb::addr_t data_address = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
1307         if (data_address == LLDB_INVALID_ADDRESS)
1308             return false;
1309         valobj_sp = ValueObject::CreateValueObjectFromAddress("text", data_address, exe_ctx, charstar);
1310     }
1311     else
1312     {
1313         DataExtractor data;
1314         Error error;
1315         valobj.GetData(data, error);
1316         if (error.Fail())
1317             return false;
1318         valobj_sp = ValueObject::CreateValueObjectFromData("text", data, exe_ctx, charstar);
1319     }
1320     
1321     if (!valobj_sp)
1322         return false;
1323     
1324     stream.Printf("%s",valobj_sp->GetSummaryAsCString());
1325     return true;
1326 }
1327
1328 // POSIX has an epoch on Jan-1-1970, but Cocoa prefers Jan-1-2001
1329 // this call gives the POSIX equivalent of the Cocoa epoch
1330 time_t
1331 lldb_private::formatters::GetOSXEpoch ()
1332 {
1333     static time_t epoch = 0;
1334     if (!epoch)
1335     {
1336 #ifndef _WIN32
1337         tzset();
1338         tm tm_epoch;
1339         tm_epoch.tm_sec = 0;
1340         tm_epoch.tm_hour = 0;
1341         tm_epoch.tm_min = 0;
1342         tm_epoch.tm_mon = 0;
1343         tm_epoch.tm_mday = 1;
1344         tm_epoch.tm_year = 2001-1900; // for some reason, we need to subtract 1900 from this field. not sure why.
1345         tm_epoch.tm_isdst = -1;
1346         tm_epoch.tm_gmtoff = 0;
1347         tm_epoch.tm_zone = NULL;
1348         epoch = timegm(&tm_epoch);
1349 #endif
1350     }
1351     return epoch;
1352 }
1353
1354 size_t
1355 lldb_private::formatters::ExtractIndexFromString (const char* item_name)
1356 {
1357     if (!item_name || !*item_name)
1358         return UINT32_MAX;
1359     if (*item_name != '[')
1360         return UINT32_MAX;
1361     item_name++;
1362     char* endptr = NULL;
1363     unsigned long int idx = ::strtoul(item_name, &endptr, 0);
1364     if (idx == 0 && endptr == item_name)
1365         return UINT32_MAX;
1366     if (idx == ULONG_MAX)
1367         return UINT32_MAX;
1368     return idx;
1369 }
1370
1371 lldb_private::formatters::VectorIteratorSyntheticFrontEnd::VectorIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp,
1372                                                                                             ConstString item_name) :
1373 SyntheticChildrenFrontEnd(*valobj_sp.get()),
1374 m_exe_ctx_ref(),
1375 m_item_name(item_name),
1376 m_item_sp()
1377 {
1378     if (valobj_sp)
1379         Update();
1380 }
1381
1382 bool
1383 lldb_private::formatters::VectorIteratorSyntheticFrontEnd::Update()
1384 {
1385     m_item_sp.reset();
1386
1387     ValueObjectSP valobj_sp = m_backend.GetSP();
1388     if (!valobj_sp)
1389         return false;
1390     
1391     if (!valobj_sp)
1392         return false;
1393     
1394     ValueObjectSP item_ptr(valobj_sp->GetChildMemberWithName(m_item_name,true));
1395     if (!item_ptr)
1396         return false;
1397     if (item_ptr->GetValueAsUnsigned(0) == 0)
1398         return false;
1399     Error err;
1400     m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
1401     m_item_sp = ValueObject::CreateValueObjectFromAddress("item", item_ptr->GetValueAsUnsigned(0), m_exe_ctx_ref, item_ptr->GetClangType().GetPointeeType());
1402     if (err.Fail())
1403         m_item_sp.reset();
1404     return false;
1405 }
1406
1407 size_t
1408 lldb_private::formatters::VectorIteratorSyntheticFrontEnd::CalculateNumChildren ()
1409 {
1410     return 1;
1411 }
1412
1413 lldb::ValueObjectSP
1414 lldb_private::formatters::VectorIteratorSyntheticFrontEnd::GetChildAtIndex (size_t idx)
1415 {
1416     if (idx == 0)
1417         return m_item_sp;
1418     return lldb::ValueObjectSP();
1419 }
1420
1421 bool
1422 lldb_private::formatters::VectorIteratorSyntheticFrontEnd::MightHaveChildren ()
1423 {
1424     return true;
1425 }
1426
1427 size_t
1428 lldb_private::formatters::VectorIteratorSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
1429 {
1430     if (name == ConstString("item"))
1431         return 0;
1432     return UINT32_MAX;
1433 }
1434
1435 lldb_private::formatters::VectorIteratorSyntheticFrontEnd::~VectorIteratorSyntheticFrontEnd ()
1436 {
1437 }
1438
1439 template bool
1440 lldb_private::formatters::NSDataSummaryProvider<true> (ValueObject&, Stream&) ;
1441
1442 template bool
1443 lldb_private::formatters::NSDataSummaryProvider<false> (ValueObject&, Stream&) ;
1444
1445 template bool
1446 lldb_private::formatters::ObjCSELSummaryProvider<true> (ValueObject&, Stream&) ;
1447
1448 template bool
1449 lldb_private::formatters::ObjCSELSummaryProvider<false> (ValueObject&, Stream&) ;