• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- FormatManager.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/FormatManager.h"
13 
14 // C Includes
15 // C++ Includes
16 // Other libraries and framework includes
17 // Project includes
18 
19 #include "lldb/Core/Debugger.h"
20 #include "lldb/DataFormatters/CXXFormatterFunctions.h"
21 #include "lldb/Interpreter/ScriptInterpreterPython.h"
22 #include "lldb/Target/ExecutionContext.h"
23 #include "lldb/Target/Platform.h"
24 
25 using namespace lldb;
26 using namespace lldb_private;
27 
28 
29 struct FormatInfo
30 {
31     Format format;
32     const char format_char; // One or more format characters that can be used for this format.
33     const char *format_name;    // Long format name that can be used to specify the current format
34 };
35 
36 static FormatInfo
37 g_format_infos[] =
38 {
39     { eFormatDefault        , '\0'  , "default"             },
40     { eFormatBoolean        , 'B'   , "boolean"             },
41     { eFormatBinary         , 'b'   , "binary"              },
42     { eFormatBytes          , 'y'   , "bytes"               },
43     { eFormatBytesWithASCII , 'Y'   , "bytes with ASCII"    },
44     { eFormatChar           , 'c'   , "character"           },
45     { eFormatCharPrintable  , 'C'   , "printable character" },
46     { eFormatComplexFloat   , 'F'   , "complex float"       },
47     { eFormatCString        , 's'   , "c-string"            },
48     { eFormatDecimal        , 'd'   , "decimal"             },
49     { eFormatEnum           , 'E'   , "enumeration"         },
50     { eFormatHex            , 'x'   , "hex"                 },
51     { eFormatHexUppercase   , 'X'   , "uppercase hex"       },
52     { eFormatFloat          , 'f'   , "float"               },
53     { eFormatOctal          , 'o'   , "octal"               },
54     { eFormatOSType         , 'O'   , "OSType"              },
55     { eFormatUnicode16      , 'U'   , "unicode16"           },
56     { eFormatUnicode32      , '\0'  , "unicode32"           },
57     { eFormatUnsigned       , 'u'   , "unsigned decimal"    },
58     { eFormatPointer        , 'p'   , "pointer"             },
59     { eFormatVectorOfChar   , '\0'  , "char[]"              },
60     { eFormatVectorOfSInt8  , '\0'  , "int8_t[]"            },
61     { eFormatVectorOfUInt8  , '\0'  , "uint8_t[]"           },
62     { eFormatVectorOfSInt16 , '\0'  , "int16_t[]"           },
63     { eFormatVectorOfUInt16 , '\0'  , "uint16_t[]"          },
64     { eFormatVectorOfSInt32 , '\0'  , "int32_t[]"           },
65     { eFormatVectorOfUInt32 , '\0'  , "uint32_t[]"          },
66     { eFormatVectorOfSInt64 , '\0'  , "int64_t[]"           },
67     { eFormatVectorOfUInt64 , '\0'  , "uint64_t[]"          },
68     { eFormatVectorOfFloat32, '\0'  , "float32[]"           },
69     { eFormatVectorOfFloat64, '\0'  , "float64[]"           },
70     { eFormatVectorOfUInt128, '\0'  , "uint128_t[]"         },
71     { eFormatComplexInteger , 'I'   , "complex integer"     },
72     { eFormatCharArray      , 'a'   , "character array"     },
73     { eFormatAddressInfo    , 'A'   , "address"             },
74     { eFormatHexFloat       , '\0'  , "hex float"           },
75     { eFormatInstruction    , 'i'   , "instruction"         },
76     { eFormatVoid           , 'v'   , "void"                }
77 };
78 
79 static uint32_t
80 g_num_format_infos = sizeof(g_format_infos)/sizeof(FormatInfo);
81 
82 static bool
GetFormatFromFormatChar(char format_char,Format & format)83 GetFormatFromFormatChar (char format_char, Format &format)
84 {
85     for (uint32_t i=0; i<g_num_format_infos; ++i)
86     {
87         if (g_format_infos[i].format_char == format_char)
88         {
89             format = g_format_infos[i].format;
90             return true;
91         }
92     }
93     format = eFormatInvalid;
94     return false;
95 }
96 
97 static bool
GetFormatFromFormatName(const char * format_name,bool partial_match_ok,Format & format)98 GetFormatFromFormatName (const char *format_name, bool partial_match_ok, Format &format)
99 {
100     uint32_t i;
101     for (i=0; i<g_num_format_infos; ++i)
102     {
103         if (strcasecmp (g_format_infos[i].format_name, format_name) == 0)
104         {
105             format = g_format_infos[i].format;
106             return true;
107         }
108     }
109 
110     if (partial_match_ok)
111     {
112         for (i=0; i<g_num_format_infos; ++i)
113         {
114             if (strcasestr (g_format_infos[i].format_name, format_name) == g_format_infos[i].format_name)
115             {
116                 format = g_format_infos[i].format;
117                 return true;
118             }
119         }
120     }
121     format = eFormatInvalid;
122     return false;
123 }
124 
125 bool
GetFormatFromCString(const char * format_cstr,bool partial_match_ok,lldb::Format & format)126 FormatManager::GetFormatFromCString (const char *format_cstr,
127                                      bool partial_match_ok,
128                                      lldb::Format &format)
129 {
130     bool success = false;
131     if (format_cstr && format_cstr[0])
132     {
133         if (format_cstr[1] == '\0')
134         {
135             success = GetFormatFromFormatChar (format_cstr[0], format);
136             if (success)
137                 return true;
138         }
139 
140         success = GetFormatFromFormatName (format_cstr, partial_match_ok, format);
141     }
142     if (!success)
143         format = eFormatInvalid;
144     return success;
145 }
146 
147 char
GetFormatAsFormatChar(lldb::Format format)148 FormatManager::GetFormatAsFormatChar (lldb::Format format)
149 {
150     for (uint32_t i=0; i<g_num_format_infos; ++i)
151     {
152         if (g_format_infos[i].format == format)
153             return g_format_infos[i].format_char;
154     }
155     return '\0';
156 }
157 
158 const char *
GetFormatAsCString(Format format)159 FormatManager::GetFormatAsCString (Format format)
160 {
161     if (format >= eFormatDefault && format < kNumFormats)
162         return g_format_infos[format].format_name;
163     return NULL;
164 }
165 
166 lldb::TypeSummaryImplSP
GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)167 FormatManager::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
168 {
169     if (!type_sp)
170         return lldb::TypeSummaryImplSP();
171     lldb::TypeSummaryImplSP summary_chosen_sp;
172     uint32_t num_categories = m_categories_map.GetCount();
173     lldb::TypeCategoryImplSP category_sp;
174     uint32_t prio_category = UINT32_MAX;
175     for (uint32_t category_id = 0;
176          category_id < num_categories;
177          category_id++)
178     {
179         category_sp = GetCategoryAtIndex(category_id);
180         if (category_sp->IsEnabled() == false)
181             continue;
182         lldb::TypeSummaryImplSP summary_current_sp = category_sp->GetSummaryForType(type_sp);
183         if (summary_current_sp && (summary_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
184         {
185             prio_category = category_sp->GetEnabledPosition();
186             summary_chosen_sp = summary_current_sp;
187         }
188     }
189     return summary_chosen_sp;
190 }
191 
192 lldb::TypeFilterImplSP
GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)193 FormatManager::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
194 {
195     if (!type_sp)
196         return lldb::TypeFilterImplSP();
197     lldb::TypeFilterImplSP filter_chosen_sp;
198     uint32_t num_categories = m_categories_map.GetCount();
199     lldb::TypeCategoryImplSP category_sp;
200     uint32_t prio_category = UINT32_MAX;
201     for (uint32_t category_id = 0;
202          category_id < num_categories;
203          category_id++)
204     {
205         category_sp = GetCategoryAtIndex(category_id);
206         if (category_sp->IsEnabled() == false)
207             continue;
208         lldb::TypeFilterImplSP filter_current_sp((TypeFilterImpl*)category_sp->GetFilterForType(type_sp).get());
209         if (filter_current_sp && (filter_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
210         {
211             prio_category = category_sp->GetEnabledPosition();
212             filter_chosen_sp = filter_current_sp;
213         }
214     }
215     return filter_chosen_sp;
216 }
217 
218 #ifndef LLDB_DISABLE_PYTHON
219 lldb::ScriptedSyntheticChildrenSP
GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)220 FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
221 {
222     if (!type_sp)
223         return lldb::ScriptedSyntheticChildrenSP();
224     lldb::ScriptedSyntheticChildrenSP synth_chosen_sp;
225     uint32_t num_categories = m_categories_map.GetCount();
226     lldb::TypeCategoryImplSP category_sp;
227     uint32_t prio_category = UINT32_MAX;
228     for (uint32_t category_id = 0;
229          category_id < num_categories;
230          category_id++)
231     {
232         category_sp = GetCategoryAtIndex(category_id);
233         if (category_sp->IsEnabled() == false)
234             continue;
235         lldb::ScriptedSyntheticChildrenSP synth_current_sp((ScriptedSyntheticChildren*)category_sp->GetSyntheticForType(type_sp).get());
236         if (synth_current_sp && (synth_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
237         {
238             prio_category = category_sp->GetEnabledPosition();
239             synth_chosen_sp = synth_current_sp;
240         }
241     }
242     return synth_chosen_sp;
243 }
244 #endif
245 
246 #ifndef LLDB_DISABLE_PYTHON
247 lldb::SyntheticChildrenSP
GetSyntheticChildrenForType(lldb::TypeNameSpecifierImplSP type_sp)248 FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
249 {
250     if (!type_sp)
251         return lldb::SyntheticChildrenSP();
252     lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
253     lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
254     if (filter_sp->GetRevision() > synth_sp->GetRevision())
255         return lldb::SyntheticChildrenSP(filter_sp.get());
256     else
257         return lldb::SyntheticChildrenSP(synth_sp.get());
258 }
259 #endif
260 
261 lldb::TypeCategoryImplSP
GetCategory(const ConstString & category_name,bool can_create)262 FormatManager::GetCategory (const ConstString& category_name,
263                          bool can_create)
264 {
265     if (!category_name)
266         return GetCategory(m_default_category_name);
267     lldb::TypeCategoryImplSP category;
268     if (m_categories_map.Get(category_name, category))
269         return category;
270 
271     if (!can_create)
272         return lldb::TypeCategoryImplSP();
273 
274     m_categories_map.Add(category_name,lldb::TypeCategoryImplSP(new TypeCategoryImpl(this, category_name)));
275     return GetCategory(category_name);
276 }
277 
278 lldb::Format
GetSingleItemFormat(lldb::Format vector_format)279 FormatManager::GetSingleItemFormat(lldb::Format vector_format)
280 {
281     switch(vector_format)
282     {
283         case eFormatVectorOfChar:
284             return eFormatCharArray;
285 
286         case eFormatVectorOfSInt8:
287         case eFormatVectorOfSInt16:
288         case eFormatVectorOfSInt32:
289         case eFormatVectorOfSInt64:
290             return eFormatDecimal;
291 
292         case eFormatVectorOfUInt8:
293         case eFormatVectorOfUInt16:
294         case eFormatVectorOfUInt32:
295         case eFormatVectorOfUInt64:
296         case eFormatVectorOfUInt128:
297             return eFormatHex;
298 
299         case eFormatVectorOfFloat32:
300         case eFormatVectorOfFloat64:
301             return eFormatFloat;
302 
303         default:
304             return lldb::eFormatInvalid;
305     }
306 }
307 
308 ConstString
GetValidTypeName(const ConstString & type)309 FormatManager::GetValidTypeName (const ConstString& type)
310 {
311     return ::GetValidTypeName_Impl(type);
312 }
313 
314 ConstString
GetTypeForCache(ValueObject & valobj,lldb::DynamicValueType use_dynamic)315 GetTypeForCache (ValueObject& valobj,
316                  lldb::DynamicValueType use_dynamic)
317 {
318     if (use_dynamic == lldb::eNoDynamicValues)
319     {
320         if (valobj.IsDynamic())
321         {
322             if (valobj.GetStaticValue())
323                 return valobj.GetStaticValue()->GetQualifiedTypeName();
324             else
325                 return ConstString();
326         }
327         else
328             return valobj.GetQualifiedTypeName();
329     }
330     if (valobj.IsDynamic())
331         return valobj.GetQualifiedTypeName();
332     if (valobj.GetDynamicValue(use_dynamic))
333         return valobj.GetDynamicValue(use_dynamic)->GetQualifiedTypeName();
334     return ConstString();
335 }
336 
337 lldb::TypeSummaryImplSP
GetSummaryFormat(ValueObject & valobj,lldb::DynamicValueType use_dynamic)338 FormatManager::GetSummaryFormat (ValueObject& valobj,
339                                  lldb::DynamicValueType use_dynamic)
340 {
341     TypeSummaryImplSP retval;
342     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
343     ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
344     if (valobj_type)
345     {
346         if (log)
347             log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
348         if (m_format_cache.GetSummary(valobj_type,retval))
349         {
350             if (log)
351             {
352                 log->Printf("[FormatManager::GetSummaryFormat] Cache search success. Returning.");
353                 if (log->GetDebug())
354                     log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
355             }
356             return retval;
357         }
358         if (log)
359             log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
360     }
361     retval = m_categories_map.GetSummaryFormat(valobj, use_dynamic);
362     if (valobj_type)
363     {
364         if (log)
365             log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
366         m_format_cache.SetSummary(valobj_type,retval);
367     }
368     if (log && log->GetDebug())
369         log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
370     return retval;
371 }
372 
373 #ifndef LLDB_DISABLE_PYTHON
374 lldb::SyntheticChildrenSP
GetSyntheticChildren(ValueObject & valobj,lldb::DynamicValueType use_dynamic)375 FormatManager::GetSyntheticChildren (ValueObject& valobj,
376                                      lldb::DynamicValueType use_dynamic)
377 {
378     SyntheticChildrenSP retval;
379     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
380     ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
381     if (valobj_type)
382     {
383         if (log)
384             log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
385         if (m_format_cache.GetSynthetic(valobj_type,retval))
386         {
387             if (log)
388             {
389                 log->Printf("[FormatManager::GetSyntheticChildren] Cache search success. Returning.");
390                 if (log->GetDebug())
391                     log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
392             }
393             return retval;
394         }
395         if (log)
396             log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route");
397     }
398     retval = m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
399     if (valobj_type)
400     {
401         if (log)
402             log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
403         m_format_cache.SetSynthetic(valobj_type,retval);
404     }
405     if (log && log->GetDebug())
406         log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
407     return retval;
408 }
409 #endif
410 
FormatManager()411 FormatManager::FormatManager() :
412     m_format_cache(),
413     m_value_nav("format",this),
414     m_named_summaries_map(this),
415     m_last_revision(0),
416     m_categories_map(this),
417     m_default_category_name(ConstString("default")),
418     m_system_category_name(ConstString("system")),
419     m_gnu_cpp_category_name(ConstString("gnu-libstdc++")),
420     m_libcxx_category_name(ConstString("libcxx")),
421     m_objc_category_name(ConstString("objc")),
422     m_corefoundation_category_name(ConstString("CoreFoundation")),
423     m_coregraphics_category_name(ConstString("CoreGraphics")),
424     m_coreservices_category_name(ConstString("CoreServices")),
425     m_vectortypes_category_name(ConstString("VectorTypes")),
426     m_appkit_category_name(ConstString("AppKit"))
427 {
428     LoadSystemFormatters();
429     LoadLibStdcppFormatters();
430     LoadLibcxxFormatters();
431     LoadObjCFormatters();
432 
433     EnableCategory(m_objc_category_name,TypeCategoryMap::Last);
434     EnableCategory(m_corefoundation_category_name,TypeCategoryMap::Last);
435     EnableCategory(m_appkit_category_name,TypeCategoryMap::Last);
436     EnableCategory(m_coreservices_category_name,TypeCategoryMap::Last);
437     EnableCategory(m_coregraphics_category_name,TypeCategoryMap::Last);
438     EnableCategory(m_gnu_cpp_category_name,TypeCategoryMap::Last);
439     EnableCategory(m_libcxx_category_name,TypeCategoryMap::Last);
440     EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last);
441     EnableCategory(m_system_category_name,TypeCategoryMap::Last);
442 }
443 
444 static void
AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,const char * string,ConstString type_name,TypeSummaryImpl::Flags flags,bool regex=false)445 AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
446                  const char* string,
447                  ConstString type_name,
448                  TypeSummaryImpl::Flags flags,
449                  bool regex = false)
450 {
451     lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags,
452                                                                string));
453 
454     if (regex)
455         category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
456     else
457         category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
458 }
459 
460 #ifndef LLDB_DISABLE_PYTHON
461 static void
AddScriptSummary(TypeCategoryImpl::SharedPointer category_sp,const char * funct_name,ConstString type_name,TypeSummaryImpl::Flags flags,bool regex=false)462 AddScriptSummary(TypeCategoryImpl::SharedPointer category_sp,
463                  const char* funct_name,
464                  ConstString type_name,
465                  TypeSummaryImpl::Flags flags,
466                  bool regex = false)
467 {
468 
469     std::string code("     ");
470     code.append(funct_name).append("(valobj,internal_dict)");
471 
472     lldb::TypeSummaryImplSP summary_sp(new ScriptSummaryFormat(flags,
473                                                                funct_name,
474                                                                code.c_str()));
475     if (regex)
476         category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
477     else
478         category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
479 }
480 #endif
481 
482 #ifndef LLDB_DISABLE_PYTHON
483 static void
AddCXXSummary(TypeCategoryImpl::SharedPointer category_sp,CXXFunctionSummaryFormat::Callback funct,const char * description,ConstString type_name,TypeSummaryImpl::Flags flags,bool regex=false)484 AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
485                CXXFunctionSummaryFormat::Callback funct,
486                const char* description,
487                ConstString type_name,
488                TypeSummaryImpl::Flags flags,
489                bool regex = false)
490 {
491     lldb::TypeSummaryImplSP summary_sp(new CXXFunctionSummaryFormat(flags,funct,description));
492     if (regex)
493         category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
494     else
495         category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
496 }
497 #endif
498 
499 #ifndef LLDB_DISABLE_PYTHON
AddCXXSynthetic(TypeCategoryImpl::SharedPointer category_sp,CXXSyntheticChildren::CreateFrontEndCallback generator,const char * description,ConstString type_name,ScriptedSyntheticChildren::Flags flags,bool regex=false)500 static void AddCXXSynthetic  (TypeCategoryImpl::SharedPointer category_sp,
501                               CXXSyntheticChildren::CreateFrontEndCallback generator,
502                               const char* description,
503                               ConstString type_name,
504                               ScriptedSyntheticChildren::Flags flags,
505                               bool regex = false)
506 {
507     lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
508     if (regex)
509         category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), synth_sp);
510     else
511         category_sp->GetSyntheticNavigator()->Add(type_name,synth_sp);
512 }
513 #endif
514 
515 void
LoadLibStdcppFormatters()516 FormatManager::LoadLibStdcppFormatters()
517 {
518     TypeSummaryImpl::Flags stl_summary_flags;
519     stl_summary_flags.SetCascades(true)
520     .SetSkipPointers(false)
521     .SetSkipReferences(false)
522     .SetDontShowChildren(true)
523     .SetDontShowValue(true)
524     .SetShowMembersOneLiner(false)
525     .SetHideItemNames(false);
526 
527     lldb::TypeSummaryImplSP std_string_summary_sp(new StringSummaryFormat(stl_summary_flags,
528                                                                           "${var._M_dataplus._M_p}"));
529 
530     TypeCategoryImpl::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name);
531 
532     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::string"),
533                                                 std_string_summary_sp);
534     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char>"),
535                                                 std_string_summary_sp);
536     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
537                                                 std_string_summary_sp);
538     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"),
539                                                 std_string_summary_sp);
540 
541     // making sure we force-pick the summary for printing wstring (_M_p is a wchar_t*)
542     lldb::TypeSummaryImplSP std_wstring_summary_sp(new StringSummaryFormat(stl_summary_flags,
543                                                                            "${var._M_dataplus._M_p%S}"));
544 
545     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::wstring"),
546                                                 std_wstring_summary_sp);
547     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t>"),
548                                                 std_wstring_summary_sp);
549     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >"),
550                                                 std_wstring_summary_sp);
551     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >"),
552                                                 std_wstring_summary_sp);
553 
554 
555 #ifndef LLDB_DISABLE_PYTHON
556 
557     SyntheticChildren::Flags stl_synth_flags;
558     stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
559 
560     gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
561                                                        SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
562                                                                                                  "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
563     gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
564                                                        SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
565                                                                                                  "lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
566     gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
567                                                        SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
568                                                                                                  "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
569 
570     stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
571     gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
572                                                      TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
573                                                                                                "size=${svar%#}")));
574     gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
575                                                      TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
576                                                                                                "size=${svar%#}")));
577     gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
578                                                      TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
579                                                                                                "size=${svar%#}")));
580 
581     AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibStdcppVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^__gnu_cxx::__normal_iterator<.+>$"), stl_synth_flags, true);
582 
583     AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::_Rb_tree_iterator<.+>$"), stl_synth_flags, true);
584 
585     gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"),
586                                                    TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
587 
588     gnu_category_sp->GetSyntheticNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"),
589                                                      SyntheticChildrenSP(new CXXSyntheticChildren(stl_synth_flags,"libc++ std::vector<bool> synthetic children",lldb_private::formatters::LibstdcppVectorBoolSyntheticFrontEndCreator)));
590 
591 #endif
592 }
593 
594 void
LoadLibcxxFormatters()595 FormatManager::LoadLibcxxFormatters()
596 {
597     TypeSummaryImpl::Flags stl_summary_flags;
598     stl_summary_flags.SetCascades(true)
599     .SetSkipPointers(false)
600     .SetSkipReferences(false)
601     .SetDontShowChildren(true)
602     .SetDontShowValue(true)
603     .SetShowMembersOneLiner(false)
604     .SetHideItemNames(false);
605 
606 #ifndef LLDB_DISABLE_PYTHON
607     //std::string code("     lldb.formatters.cpp.libcxx.stdstring_SummaryProvider(valobj,internal_dict)");
608     //lldb::TypeSummaryImplSP std_string_summary_sp(new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.libcxx.stdstring_SummaryProvider",code.c_str()));
609 
610     lldb::TypeSummaryImplSP std_string_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxStringSummaryProvider, "std::string summary provider"));
611     lldb::TypeSummaryImplSP std_wstring_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider"));
612 
613     TypeCategoryImpl::SharedPointer libcxx_category_sp = GetCategory(m_libcxx_category_name);
614 
615     libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::string"),
616                                                    std_string_summary_sp);
617     libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"),
618                                                    std_string_summary_sp);
619 
620     libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::wstring"),
621                                                    std_wstring_summary_sp);
622     libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >"),
623                                                    std_wstring_summary_sp);
624 
625     SyntheticChildren::Flags stl_synth_flags;
626     stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
627 
628     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator, "libc++ std::vector synthetic children", ConstString("^std::__1::vector<.+>(( )?&)?$"), stl_synth_flags, true);
629     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator, "libc++ std::list synthetic children", ConstString("^std::__1::list<.+>(( )?&)?$"), stl_synth_flags, true);
630     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::map synthetic children", ConstString("^std::__1::map<.+> >(( )?&)?$"), stl_synth_flags, true);
631     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEndCreator, "libc++ std::vector<bool> synthetic children", ConstString("std::__1::vector<std::__1::allocator<bool> >"), stl_synth_flags);
632     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::set synthetic children", ConstString("^std::__1::set<.+> >(( )?&)?$"), stl_synth_flags, true);
633     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::multiset synthetic children", ConstString("^std::__1::multiset<.+> >(( )?&)?$"), stl_synth_flags, true);
634     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::multimap synthetic children", ConstString("^std::__1::multimap<.+> >(( )?&)?$"), stl_synth_flags, true);
635 
636     libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")),
637                                                           SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
638                                                                                                     "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
639 
640     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator, "shared_ptr synthetic children", ConstString("^(std::__1::)shared_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
641     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator, "weak_ptr synthetic children", ConstString("^(std::__1::)weak_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
642 
643     stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(false);
644 
645     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::vector summary provider", ConstString("^std::__1::vector<.+>(( )?&)?$"), stl_summary_flags, true);
646     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::list summary provider", ConstString("^std::__1::list<.+>(( )?&)?$"), stl_summary_flags, true);
647     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::map summary provider", ConstString("^std::__1::map<.+>(( )?&)?$"), stl_summary_flags, true);
648     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::deque summary provider", ConstString("^std::__1::deque<.+>(( )?&)?$"), stl_summary_flags, true);
649     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::vector<bool> summary provider", ConstString("std::__1::vector<std::__1::allocator<bool> >"), stl_summary_flags);
650     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::set summary provider", ConstString("^std::__1::set<.+>(( )?&)?$"), stl_summary_flags, true);
651     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::multiset summary provider", ConstString("^std::__1::multiset<.+>(( )?&)?$"), stl_summary_flags, true);
652     AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::multimap summary provider", ConstString("^std::__1::multimap<.+>(( )?&)?$"), stl_summary_flags, true);
653 
654     stl_summary_flags.SetSkipPointers(true);
655     AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::shared_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
656     AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::weak_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
657 
658     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^std::__1::__wrap_iter<.+>$"), stl_synth_flags, true);
659 
660     AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::__1::__map_iterator<.+>$"), stl_synth_flags, true);
661 
662 #endif
663 }
664 
665 void
LoadSystemFormatters()666 FormatManager::LoadSystemFormatters()
667 {
668 
669     TypeSummaryImpl::Flags string_flags;
670     string_flags.SetCascades(true)
671     .SetSkipPointers(true)
672     .SetSkipReferences(false)
673     .SetDontShowChildren(true)
674     .SetDontShowValue(false)
675     .SetShowMembersOneLiner(false)
676     .SetHideItemNames(false);
677 
678     lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(string_flags, "${var%s}"));
679 
680 
681     lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
682                                                                         .SetSkipPointers(true)
683                                                                         .SetSkipReferences(false)
684                                                                         .SetDontShowChildren(true)
685                                                                         .SetDontShowValue(true)
686                                                                         .SetShowMembersOneLiner(false)
687                                                                         .SetHideItemNames(false),
688                                                                         "${var%s}"));
689 
690     lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
691 
692     TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
693 
694     sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
695     sys_category_sp->GetSummaryNavigator()->Add(ConstString("unsigned char *"), string_format);
696     sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format);
697 
698     lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
699                                                                    .SetSkipPointers(true)
700                                                                    .SetSkipReferences(true)
701                                                                    .SetDontShowChildren(true)
702                                                                    .SetDontShowValue(false)
703                                                                    .SetShowMembersOneLiner(false)
704                                                                    .SetHideItemNames(false),
705                                                                    "${var%O}"));
706 
707     sys_category_sp->GetSummaryNavigator()->Add(ConstString("OSType"), ostype_summary);
708 
709 #ifndef LLDB_DISABLE_PYTHON
710     // FIXME because of a bug in the FormatNavigator we need to add a summary for both X* and const X* (<rdar://problem/12717717>)
711     AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("char16_t *"), string_flags);
712 
713     AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags);
714 
715     AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
716 
717     AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("unichar *"), string_flags);
718 
719     TypeSummaryImpl::Flags widechar_flags;
720     widechar_flags.SetDontShowValue(true)
721     .SetSkipPointers(true)
722     .SetSkipReferences(false)
723     .SetCascades(true)
724     .SetDontShowChildren(true)
725     .SetHideItemNames(true)
726     .SetShowMembersOneLiner(false);
727 
728     AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "char16_t summary provider", ConstString("char16_t"), widechar_flags);
729     AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32SummaryProvider, "char32_t summary provider", ConstString("char32_t"), widechar_flags);
730     AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharSummaryProvider, "wchar_t summary provider", ConstString("wchar_t"), widechar_flags);
731 
732     AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "unichar summary provider", ConstString("unichar"), widechar_flags);
733 
734 #endif
735 }
736 
737 void
LoadObjCFormatters()738 FormatManager::LoadObjCFormatters()
739 {
740     TypeSummaryImpl::Flags objc_flags;
741     objc_flags.SetCascades(false)
742     .SetSkipPointers(true)
743     .SetSkipReferences(true)
744     .SetDontShowChildren(true)
745     .SetDontShowValue(true)
746     .SetShowMembersOneLiner(false)
747     .SetHideItemNames(false);
748 
749     TypeCategoryImpl::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
750 
751     lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider,""));
752     objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL"),
753                                                  ObjC_BOOL_summary);
754     objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL &"),
755                                                  ObjC_BOOL_summary);
756     objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL *"),
757                                                  ObjC_BOOL_summary);
758 
759 #ifndef LLDB_DISABLE_PYTHON
760     // we need to skip pointers here since we are special casing a SEL* when retrieving its value
761     objc_flags.SetSkipPointers(true);
762     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("SEL"), objc_flags);
763     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("struct objc_selector"), objc_flags);
764     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("objc_selector"), objc_flags);
765     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("objc_selector *"), objc_flags);
766     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("SEL *"), objc_flags);
767 
768     AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCClassSummaryProvider, "Class summary provider", ConstString("Class"), objc_flags);
769 
770     SyntheticChildren::Flags class_synth_flags;
771     class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
772 
773     AddCXXSynthetic(objc_category_sp, lldb_private::formatters::ObjCClassSyntheticFrontEndCreator, "Class synthetic children", ConstString("Class"), class_synth_flags);
774 #endif // LLDB_DISABLE_PYTHON
775 
776     objc_flags.SetSkipPointers(false);
777     objc_flags.SetCascades(true);
778     objc_flags.SetSkipReferences(false);
779 
780     AddStringSummary (objc_category_sp,
781                       "${var.__FuncPtr%A}",
782                       ConstString("__block_literal_generic"),
783                       objc_flags);
784 
785     TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name);
786 
787     AddStringSummary(corefoundation_category_sp,
788                      "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds",
789                      ConstString("CFGregorianUnits"),
790                      objc_flags);
791     AddStringSummary(corefoundation_category_sp,
792                      "location=${var.location} length=${var.length}",
793                      ConstString("CFRange"),
794                      objc_flags);
795     AddStringSummary(corefoundation_category_sp,
796                      "(x=${var.x}, y=${var.y})",
797                      ConstString("NSPoint"),
798                      objc_flags);
799     AddStringSummary(corefoundation_category_sp,
800                      "location=${var.location}, length=${var.length}",
801                      ConstString("NSRange"),
802                      objc_flags);
803     AddStringSummary(corefoundation_category_sp,
804                      "${var.origin}, ${var.size}",
805                      ConstString("NSRect"),
806                      objc_flags);
807     AddStringSummary(corefoundation_category_sp,
808                      "(${var.origin}, ${var.size}), ...",
809                      ConstString("NSRectArray"),
810                      objc_flags);
811     AddStringSummary(objc_category_sp,
812                      "(width=${var.width}, height=${var.height})",
813                      ConstString("NSSize"),
814                      objc_flags);
815 
816     TypeCategoryImpl::SharedPointer coregraphics_category_sp = GetCategory(m_coregraphics_category_name);
817 
818     AddStringSummary(coregraphics_category_sp,
819                      "(width=${var.width}, height=${var.height})",
820                      ConstString("CGSize"),
821                      objc_flags);
822     AddStringSummary(coregraphics_category_sp,
823                      "(x=${var.x}, y=${var.y})",
824                      ConstString("CGPoint"),
825                      objc_flags);
826     AddStringSummary(coregraphics_category_sp,
827                      "origin=${var.origin} size=${var.size}",
828                      ConstString("CGRect"),
829                      objc_flags);
830 
831     TypeCategoryImpl::SharedPointer coreservices_category_sp = GetCategory(m_coreservices_category_name);
832 
833     AddStringSummary(coreservices_category_sp,
834                      "red=${var.red} green=${var.green} blue=${var.blue}",
835                      ConstString("RGBColor"),
836                      objc_flags);
837     AddStringSummary(coreservices_category_sp,
838                      "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
839                      ConstString("Rect"),
840                      objc_flags);
841     AddStringSummary(coreservices_category_sp,
842                      "(v=${var.v}, h=${var.h})",
843                      ConstString("Point"),
844                      objc_flags);
845     AddStringSummary(coreservices_category_sp,
846                      "${var.month}/${var.day}/${var.year}  ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
847                      ConstString("DateTimeRect *"),
848                      objc_flags);
849     AddStringSummary(coreservices_category_sp,
850                      "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}",
851                      ConstString("LongDateRect"),
852                      objc_flags);
853     AddStringSummary(coreservices_category_sp,
854                      "(x=${var.x}, y=${var.y})",
855                      ConstString("HIPoint"),
856                      objc_flags);
857     AddStringSummary(coreservices_category_sp,
858                      "origin=${var.origin} size=${var.size}",
859                      ConstString("HIRect"),
860                      objc_flags);
861 
862     TypeCategoryImpl::SharedPointer appkit_category_sp = GetCategory(m_appkit_category_name);
863 
864     TypeSummaryImpl::Flags appkit_flags;
865     appkit_flags.SetCascades(true)
866     .SetSkipPointers(false)
867     .SetSkipReferences(false)
868     .SetDontShowChildren(true)
869     .SetDontShowValue(false)
870     .SetShowMembersOneLiner(false)
871     .SetHideItemNames(false);
872 
873     appkit_flags.SetDontShowChildren(false);
874 
875 
876 #ifndef LLDB_DISABLE_PYTHON
877     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags);
878     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
879     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
880     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
881     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
882     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
883     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags);
884 
885     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags);
886     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSMutableDictionary"), appkit_flags);
887     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags);
888     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags);
889     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags);
890     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags);
891     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags);
892 
893     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSSet summary", ConstString("NSSet"), appkit_flags);
894     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
895     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFSetRef summary", ConstString("CFSetRef"), appkit_flags);
896     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags);
897     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags);
898     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetI summary", ConstString("__NSSetI"), appkit_flags);
899     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetM summary", ConstString("__NSSetM"), appkit_flags);
900     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags);
901     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
902     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSOrderedSet summary", ConstString("NSOrderedSet"), appkit_flags);
903     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetI summary", ConstString("__NSOrderedSetI"), appkit_flags);
904     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetM summary", ConstString("__NSOrderedSetM"), appkit_flags);
905 
906     // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}", ConstString("$_lldb_typegen_nspair"), appkit_flags);
907 
908     appkit_flags.SetDontShowChildren(true);
909 
910     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags());
911     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags());
912     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags());
913     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags());
914     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags());
915     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags());
916     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFArrayRef"), ScriptedSyntheticChildren::Flags());
917 
918     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags());
919     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags());
920     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags());
921     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags());
922     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags());
923     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags());
924 
925     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("NSSet"), ScriptedSyntheticChildren::Flags());
926     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetI synthetic children", ConstString("__NSSetI"), ScriptedSyntheticChildren::Flags());
927     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetM synthetic children", ConstString("__NSSetM"), ScriptedSyntheticChildren::Flags());
928     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSMutableSet synthetic children", ConstString("NSMutableSet"), ScriptedSyntheticChildren::Flags());
929     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSOrderedSet synthetic children", ConstString("NSOrderedSet"), ScriptedSyntheticChildren::Flags());
930     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetI synthetic children", ConstString("__NSOrderedSetI"), ScriptedSyntheticChildren::Flags());
931     AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetM synthetic children", ConstString("__NSOrderedSetM"), ScriptedSyntheticChildren::Flags());
932 
933     AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFBagRef"), appkit_flags);
934     AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("__CFBag"), appkit_flags);
935     AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("const struct __CFBag"), appkit_flags);
936     AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFMutableBagRef"), appkit_flags);
937 
938     AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("CFBinaryHeapRef"), appkit_flags);
939     AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("__CFBinaryHeap"), appkit_flags);
940 
941     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
942     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
943     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
944     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags);
945     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
946     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
947     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags);
948     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags);
949     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
950 
951     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSAttributedStringSummaryProvider, "NSAttributedString summary provider", ConstString("NSAttributedString"), appkit_flags);
952     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSMutableAttributedString"), appkit_flags);
953     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSConcreteMutableAttributedString"), appkit_flags);
954 
955     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSBundleSummaryProvider, "NSBundle summary provider", ConstString("NSBundle"), appkit_flags);
956 
957     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags);
958     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
959     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags);
960     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
961     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
962     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
963 
964     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMachPortSummaryProvider, "NSMachPort summary provider", ConstString("NSMachPort"), appkit_flags);
965 
966     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSNotification"), appkit_flags);
967     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSConcreteNotification"), appkit_flags);
968 
969     AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags);
970     AddStringSummary(appkit_category_sp,"name:${var.name%S} reason:${var.reason%S}",ConstString("NSException"),appkit_flags);
971 
972     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
973     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
974     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
975     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
976     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
977 
978     AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSDecimalNumber summary provider", ConstString("NSDecimalNumber"), appkit_flags);
979     AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSHost summary provider", ConstString("NSHost"), appkit_flags);
980     AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags);
981     AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags);
982 
983     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("NSURL"), appkit_flags);
984     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("CFURLRef"), appkit_flags);
985 
986     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSDate"), appkit_flags);
987     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSDate"), appkit_flags);
988     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSTaggedDate"), appkit_flags);
989     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags);
990 
991     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags);
992     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("CFTimeZoneRef"), appkit_flags);
993     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags);
994 
995     // CFAbsoluteTime is actually a double rather than a pointer to an object
996     // we do not care about the numeric value, since it is probably meaningless to users
997     appkit_flags.SetDontShowValue(true);
998     AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFAbsoluteTimeSummaryProvider, "CFAbsoluteTime summary provider", ConstString("CFAbsoluteTime"), appkit_flags);
999     appkit_flags.SetDontShowValue(false);
1000 
1001     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags);
1002     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSMutableIndexSet"), appkit_flags);
1003 
1004     AddStringSummary(appkit_category_sp,
1005                      "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"",
1006                      ConstString("CFGregorianDate"),
1007                      appkit_flags);
1008 
1009     AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFBitVectorRef"), appkit_flags);
1010     AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFMutableBitVectorRef"), appkit_flags);
1011     AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFBitVector"), appkit_flags);
1012     AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFMutableBitVector"), appkit_flags);
1013 #endif // LLDB_DISABLE_PYTHON
1014 
1015     TypeCategoryImpl::SharedPointer vectors_category_sp = GetCategory(m_vectortypes_category_name);
1016 
1017     TypeSummaryImpl::Flags vector_flags;
1018     vector_flags.SetCascades(true)
1019     .SetSkipPointers(true)
1020     .SetSkipReferences(false)
1021     .SetDontShowChildren(true)
1022     .SetDontShowValue(false)
1023     .SetShowMembersOneLiner(true)
1024     .SetHideItemNames(true);
1025 
1026     AddStringSummary(vectors_category_sp,
1027                      "${var.uint128}",
1028                      ConstString("builtin_type_vec128"),
1029                      objc_flags);
1030 
1031     AddStringSummary(vectors_category_sp,
1032                      "",
1033                      ConstString("float [4]"),
1034                      vector_flags);
1035     AddStringSummary(vectors_category_sp,
1036                      "",
1037                      ConstString("int32_t [4]"),
1038                      vector_flags);
1039     AddStringSummary(vectors_category_sp,
1040                      "",
1041                      ConstString("int16_t [8]"),
1042                      vector_flags);
1043     AddStringSummary(vectors_category_sp,
1044                      "",
1045                      ConstString("vDouble"),
1046                      vector_flags);
1047     AddStringSummary(vectors_category_sp,
1048                      "",
1049                      ConstString("vFloat"),
1050                      vector_flags);
1051     AddStringSummary(vectors_category_sp,
1052                      "",
1053                      ConstString("vSInt8"),
1054                      vector_flags);
1055     AddStringSummary(vectors_category_sp,
1056                      "",
1057                      ConstString("vSInt16"),
1058                      vector_flags);
1059     AddStringSummary(vectors_category_sp,
1060                      "",
1061                      ConstString("vSInt32"),
1062                      vector_flags);
1063     AddStringSummary(vectors_category_sp,
1064                      "",
1065                      ConstString("vUInt16"),
1066                      vector_flags);
1067     AddStringSummary(vectors_category_sp,
1068                      "",
1069                      ConstString("vUInt8"),
1070                      vector_flags);
1071     AddStringSummary(vectors_category_sp,
1072                      "",
1073                      ConstString("vUInt16"),
1074                      vector_flags);
1075     AddStringSummary(vectors_category_sp,
1076                      "",
1077                      ConstString("vUInt32"),
1078                      vector_flags);
1079     AddStringSummary(vectors_category_sp,
1080                      "",
1081                      ConstString("vBool32"),
1082                      vector_flags);
1083 }
1084