FormatManager.cpp revision 0c9166c1234dbe6906cd9e4df3132269e35d4b8f
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
25using namespace lldb;
26using namespace lldb_private;
27
28
29struct 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
36static FormatInfo
37g_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
79static uint32_t
80g_num_format_infos = sizeof(g_format_infos)/sizeof(FormatInfo);
81
82static bool
83GetFormatFromFormatChar (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
97static bool
98GetFormatFromFormatName (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
125bool
126FormatManager::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
147char
148FormatManager::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
158const char *
159FormatManager::GetFormatAsCString (Format format)
160{
161    if (format >= eFormatDefault && format < kNumFormats)
162        return g_format_infos[format].format_name;
163    return NULL;
164}
165
166lldb::TypeSummaryImplSP
167FormatManager::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
192lldb::TypeFilterImplSP
193FormatManager::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
219lldb::ScriptedSyntheticChildrenSP
220FormatManager::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
247lldb::SyntheticChildrenSP
248FormatManager::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
261lldb::TypeCategoryImplSP
262FormatManager::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
278lldb::Format
279FormatManager::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
308ConstString
309FormatManager::GetValidTypeName (const ConstString& type)
310{
311    return ::GetValidTypeName_Impl(type);
312}
313
314ConstString
315GetTypeForCache (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#define USE_CACHE 1
338lldb::TypeSummaryImplSP
339FormatManager::GetSummaryFormat (ValueObject& valobj,
340                                 lldb::DynamicValueType use_dynamic)
341{
342    TypeSummaryImplSP retval;
343#if USE_CACHE
344    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
345    ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
346    if (valobj_type)
347    {
348        if (log)
349            log->Printf("[FormatManager::GetSummaryFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
350        if (m_format_cache.GetSummary(valobj_type,retval))
351            return retval;
352        if (log)
353            log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
354    }
355#endif
356    retval = m_categories_map.GetSummaryFormat(valobj, use_dynamic);
357#if USE_CACHE
358    if (valobj_type)
359    {
360        if (log)
361            log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
362        m_format_cache.SetSummary(valobj_type,retval);
363    }
364#ifdef LLDB_CONFIGURATION_DEBUG
365    if (log)
366        log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
367#endif
368#endif
369    return retval;
370}
371
372#ifndef LLDB_DISABLE_PYTHON
373lldb::SyntheticChildrenSP
374FormatManager::GetSyntheticChildren (ValueObject& valobj,
375                      lldb::DynamicValueType use_dynamic)
376{
377    SyntheticChildrenSP retval;
378#if USE_CACHE
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("[FormatManager::GetSyntheticChildren] Looking into cache for type %s\n", valobj_type.AsCString("<invalid>"));
385        if (m_format_cache.GetSynthetic(valobj_type,retval))
386            return retval;
387        if (log)
388            log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route\n");
389    }
390#endif
391    retval = m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
392#if USE_CACHE
393    if (valobj_type)
394    {
395        if (log)
396            log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s\n",retval.get(),valobj_type.AsCString("<invalid>"));
397        m_format_cache.SetSynthetic(valobj_type,retval);
398    }
399#ifdef LLDB_CONFIGURATION_DEBUG
400    if (log)
401        log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
402#endif
403#endif
404    return retval;
405}
406#endif
407#undef USE_CACHE
408
409FormatManager::FormatManager() :
410    m_format_cache(),
411    m_value_nav("format",this),
412    m_named_summaries_map(this),
413    m_last_revision(0),
414    m_categories_map(this),
415    m_default_category_name(ConstString("default")),
416    m_system_category_name(ConstString("system")),
417    m_gnu_cpp_category_name(ConstString("gnu-libstdc++")),
418    m_libcxx_category_name(ConstString("libcxx")),
419    m_objc_category_name(ConstString("objc")),
420    m_corefoundation_category_name(ConstString("CoreFoundation")),
421    m_coregraphics_category_name(ConstString("CoreGraphics")),
422    m_coreservices_category_name(ConstString("CoreServices")),
423    m_vectortypes_category_name(ConstString("VectorTypes")),
424    m_appkit_category_name(ConstString("AppKit"))
425{
426    LoadSystemFormatters();
427    LoadLibStdcppFormatters();
428    LoadLibcxxFormatters();
429    LoadObjCFormatters();
430
431    EnableCategory(m_objc_category_name,TypeCategoryMap::Last);
432    EnableCategory(m_corefoundation_category_name,TypeCategoryMap::Last);
433    EnableCategory(m_appkit_category_name,TypeCategoryMap::Last);
434    EnableCategory(m_coreservices_category_name,TypeCategoryMap::Last);
435    EnableCategory(m_coregraphics_category_name,TypeCategoryMap::Last);
436    EnableCategory(m_gnu_cpp_category_name,TypeCategoryMap::Last);
437    EnableCategory(m_libcxx_category_name,TypeCategoryMap::Last);
438    EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last);
439    EnableCategory(m_system_category_name,TypeCategoryMap::Last);
440}
441
442static void
443AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
444                 const char* string,
445                 ConstString type_name,
446                 TypeSummaryImpl::Flags flags,
447                 bool regex = false)
448{
449    lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags,
450                                                               string));
451
452    if (regex)
453        category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
454    else
455        category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
456}
457
458#ifndef LLDB_DISABLE_PYTHON
459static void
460AddScriptSummary(TypeCategoryImpl::SharedPointer category_sp,
461                 const char* funct_name,
462                 ConstString type_name,
463                 TypeSummaryImpl::Flags flags,
464                 bool regex = false)
465{
466
467    std::string code("     ");
468    code.append(funct_name).append("(valobj,internal_dict)");
469
470    lldb::TypeSummaryImplSP summary_sp(new ScriptSummaryFormat(flags,
471                                                               funct_name,
472                                                               code.c_str()));
473    if (regex)
474        category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
475    else
476        category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
477}
478#endif
479
480#ifndef LLDB_DISABLE_PYTHON
481static void
482AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
483               CXXFunctionSummaryFormat::Callback funct,
484               const char* description,
485               ConstString type_name,
486               TypeSummaryImpl::Flags flags,
487               bool regex = false)
488{
489    lldb::TypeSummaryImplSP summary_sp(new CXXFunctionSummaryFormat(flags,funct,description));
490    if (regex)
491        category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
492    else
493        category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
494}
495#endif
496
497#ifndef LLDB_DISABLE_PYTHON
498static void AddCXXSynthetic  (TypeCategoryImpl::SharedPointer category_sp,
499                              CXXSyntheticChildren::CreateFrontEndCallback generator,
500                              const char* description,
501                              ConstString type_name,
502                              ScriptedSyntheticChildren::Flags flags,
503                              bool regex = false)
504{
505    lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
506    if (regex)
507        category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), synth_sp);
508    else
509        category_sp->GetSyntheticNavigator()->Add(type_name,synth_sp);
510}
511#endif
512
513void
514FormatManager::LoadLibStdcppFormatters()
515{
516    TypeSummaryImpl::Flags stl_summary_flags;
517    stl_summary_flags.SetCascades(true)
518    .SetSkipPointers(false)
519    .SetSkipReferences(false)
520    .SetDontShowChildren(true)
521    .SetDontShowValue(true)
522    .SetShowMembersOneLiner(false)
523    .SetHideItemNames(false);
524
525    lldb::TypeSummaryImplSP std_string_summary_sp(new StringSummaryFormat(stl_summary_flags,
526                                                                          "${var._M_dataplus._M_p}"));
527
528    TypeCategoryImpl::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name);
529
530    gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::string"),
531                                                std_string_summary_sp);
532    gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char>"),
533                                                std_string_summary_sp);
534    gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<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
539    // making sure we force-pick the summary for printing wstring (_M_p is a wchar_t*)
540    lldb::TypeSummaryImplSP std_wstring_summary_sp(new StringSummaryFormat(stl_summary_flags,
541                                                                           "${var._M_dataplus._M_p%S}"));
542
543    gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::wstring"),
544                                                std_wstring_summary_sp);
545    gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t>"),
546                                                std_wstring_summary_sp);
547    gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<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
552
553#ifndef LLDB_DISABLE_PYTHON
554
555    SyntheticChildren::Flags stl_synth_flags;
556    stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
557
558    gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
559                                                       SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
560                                                                                                 "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
561    gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
562                                                       SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
563                                                                                                 "lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
564    gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
565                                                       SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
566                                                                                                 "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
567
568    stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
569    gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
570                                                     TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
571                                                                                               "size=${svar%#}")));
572    gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
573                                                     TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
574                                                                                               "size=${svar%#}")));
575    gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
576                                                     TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
577                                                                                               "size=${svar%#}")));
578
579    AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibStdcppVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^__gnu_cxx::__normal_iterator<.+>$"), stl_synth_flags, true);
580
581    AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::_Rb_tree_iterator<.+>$"), stl_synth_flags, true);
582
583    gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"),
584                                                   TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
585
586    gnu_category_sp->GetSyntheticNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"),
587                                                     SyntheticChildrenSP(new CXXSyntheticChildren(stl_synth_flags,"libc++ std::vector<bool> synthetic children",lldb_private::formatters::LibstdcppVectorBoolSyntheticFrontEndCreator)));
588
589#endif
590}
591
592void
593FormatManager::LoadLibcxxFormatters()
594{
595    TypeSummaryImpl::Flags stl_summary_flags;
596    stl_summary_flags.SetCascades(true)
597    .SetSkipPointers(false)
598    .SetSkipReferences(false)
599    .SetDontShowChildren(true)
600    .SetDontShowValue(true)
601    .SetShowMembersOneLiner(false)
602    .SetHideItemNames(false);
603
604#ifndef LLDB_DISABLE_PYTHON
605    //std::string code("     lldb.formatters.cpp.libcxx.stdstring_SummaryProvider(valobj,internal_dict)");
606    //lldb::TypeSummaryImplSP std_string_summary_sp(new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.libcxx.stdstring_SummaryProvider",code.c_str()));
607
608    lldb::TypeSummaryImplSP std_string_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxStringSummaryProvider, "std::string summary provider"));
609    lldb::TypeSummaryImplSP std_wstring_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider"));
610
611    TypeCategoryImpl::SharedPointer libcxx_category_sp = GetCategory(m_libcxx_category_name);
612
613    libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::string"),
614                                                   std_string_summary_sp);
615    libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"),
616                                                   std_string_summary_sp);
617
618    libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::wstring"),
619                                                   std_wstring_summary_sp);
620    libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >"),
621                                                   std_wstring_summary_sp);
622
623    SyntheticChildren::Flags stl_synth_flags;
624    stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
625
626    AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator, "libc++ std::vector synthetic children", ConstString("^std::__1::vector<.+>(( )?&)?$"), stl_synth_flags, true);
627    AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator, "libc++ std::list synthetic children", ConstString("^std::__1::list<.+>(( )?&)?$"), stl_synth_flags, true);
628    AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::map synthetic children", ConstString("^std::__1::map<.+> >(( )?&)?$"), stl_synth_flags, true);
629    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);
630
631    libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")),
632                                                          SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
633                                                                                                    "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
634
635    AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator, "shared_ptr synthetic children", ConstString("^(std::__1::)shared_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
636    AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator, "weak_ptr synthetic children", ConstString("^(std::__1::)weak_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
637
638    stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(false);
639
640    AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::vector summary provider", ConstString("^std::__1::vector<.+>(( )?&)?$"), stl_summary_flags, true);
641    AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::list summary provider", ConstString("^std::__1::list<.+>(( )?&)?$"), stl_summary_flags, true);
642    AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::map summary provider", ConstString("^std::__1::map<.+>(( )?&)?$"), stl_summary_flags, true);
643    AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::deque summary provider", ConstString("^std::__1::deque<.+>(( )?&)?$"), stl_summary_flags, true);
644    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);
645
646    stl_summary_flags.SetSkipPointers(true);
647    AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::shared_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
648    AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::weak_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
649
650    AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^std::__1::__wrap_iter<.+>$"), stl_synth_flags, true);
651
652    AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::__1::__map_iterator<.+>$"), stl_synth_flags, true);
653
654#endif
655}
656
657void
658FormatManager::LoadSystemFormatters()
659{
660
661    TypeSummaryImpl::Flags string_flags;
662    string_flags.SetCascades(true)
663    .SetSkipPointers(true)
664    .SetSkipReferences(false)
665    .SetDontShowChildren(true)
666    .SetDontShowValue(false)
667    .SetShowMembersOneLiner(false)
668    .SetHideItemNames(false);
669
670    lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(string_flags, "${var%s}"));
671
672
673    lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
674                                                                        .SetSkipPointers(true)
675                                                                        .SetSkipReferences(false)
676                                                                        .SetDontShowChildren(true)
677                                                                        .SetDontShowValue(true)
678                                                                        .SetShowMembersOneLiner(false)
679                                                                        .SetHideItemNames(false),
680                                                                        "${var%s}"));
681
682    lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
683
684    TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
685
686    sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
687    sys_category_sp->GetSummaryNavigator()->Add(ConstString("const char *"), string_format);
688    sys_category_sp->GetSummaryNavigator()->Add(ConstString("unsigned char *"), string_format);
689    sys_category_sp->GetSummaryNavigator()->Add(ConstString("const unsigned char *"), string_format);
690    sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format);
691
692    lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
693                                                                   .SetSkipPointers(true)
694                                                                   .SetSkipReferences(true)
695                                                                   .SetDontShowChildren(true)
696                                                                   .SetDontShowValue(false)
697                                                                   .SetShowMembersOneLiner(false)
698                                                                   .SetHideItemNames(false),
699                                                                   "${var%O}"));
700
701    sys_category_sp->GetSummaryNavigator()->Add(ConstString("OSType"), ostype_summary);
702
703#ifndef LLDB_DISABLE_PYTHON
704    // FIXME because of a bug in the FormatNavigator we need to add a summary for both X* and const X* (<rdar://problem/12717717>)
705    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("char16_t *"), string_flags);
706    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("const char16_t *"), string_flags);
707
708    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags);
709    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("const char32_t *"), string_flags);
710
711    AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
712    AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("const wchar_t *"), string_flags);
713
714    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("unichar *"), string_flags);
715    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("const unichar *"), string_flags);
716
717    TypeSummaryImpl::Flags widechar_flags;
718    widechar_flags.SetDontShowValue(true)
719    .SetSkipPointers(true)
720    .SetSkipReferences(false)
721    .SetCascades(true)
722    .SetDontShowChildren(true)
723    .SetHideItemNames(true)
724    .SetShowMembersOneLiner(false);
725
726    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "char16_t summary provider", ConstString("char16_t"), widechar_flags);
727    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32SummaryProvider, "char32_t summary provider", ConstString("char32_t"), widechar_flags);
728    AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharSummaryProvider, "wchar_t summary provider", ConstString("wchar_t"), widechar_flags);
729
730    AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "unichar summary provider", ConstString("unichar"), widechar_flags);
731
732#endif
733}
734
735void
736FormatManager::LoadObjCFormatters()
737{
738    TypeSummaryImpl::Flags objc_flags;
739    objc_flags.SetCascades(false)
740    .SetSkipPointers(true)
741    .SetSkipReferences(true)
742    .SetDontShowChildren(true)
743    .SetDontShowValue(true)
744    .SetShowMembersOneLiner(false)
745    .SetHideItemNames(false);
746
747    TypeCategoryImpl::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
748
749    lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider,""));
750    objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL"),
751                                                 ObjC_BOOL_summary);
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
757#ifndef LLDB_DISABLE_PYTHON
758    // we need to skip pointers here since we are special casing a SEL* when retrieving its value
759    objc_flags.SetSkipPointers(true);
760    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("SEL"), objc_flags);
761    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("struct objc_selector"), objc_flags);
762    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("objc_selector"), objc_flags);
763    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("objc_selector *"), objc_flags);
764    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("SEL *"), objc_flags);
765
766    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCClassSummaryProvider, "Class summary provider", ConstString("Class"), objc_flags);
767
768    SyntheticChildren::Flags class_synth_flags;
769    class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
770
771    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::ObjCClassSyntheticFrontEndCreator, "Class synthetic children", ConstString("Class"), class_synth_flags);
772#endif // LLDB_DISABLE_PYTHON
773
774    objc_flags.SetSkipPointers(false);
775
776    TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name);
777
778    AddStringSummary(corefoundation_category_sp,
779                     "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds",
780                     ConstString("CFGregorianUnits"),
781                     objc_flags);
782    AddStringSummary(corefoundation_category_sp,
783                     "location=${var.location} length=${var.length}",
784                     ConstString("CFRange"),
785                     objc_flags);
786    AddStringSummary(corefoundation_category_sp,
787                     "(x=${var.x}, y=${var.y})",
788                     ConstString("NSPoint"),
789                     objc_flags);
790    AddStringSummary(corefoundation_category_sp,
791                     "location=${var.location}, length=${var.length}",
792                     ConstString("NSRange"),
793                     objc_flags);
794    AddStringSummary(corefoundation_category_sp,
795                     "${var.origin}, ${var.size}",
796                     ConstString("NSRect"),
797                     objc_flags);
798    AddStringSummary(corefoundation_category_sp,
799                     "(${var.origin}, ${var.size}), ...",
800                     ConstString("NSRectArray"),
801                     objc_flags);
802    AddStringSummary(objc_category_sp,
803                     "(width=${var.width}, height=${var.height})",
804                     ConstString("NSSize"),
805                     objc_flags);
806
807    TypeCategoryImpl::SharedPointer coregraphics_category_sp = GetCategory(m_coregraphics_category_name);
808
809    AddStringSummary(coregraphics_category_sp,
810                     "(width=${var.width}, height=${var.height})",
811                     ConstString("CGSize"),
812                     objc_flags);
813    AddStringSummary(coregraphics_category_sp,
814                     "(x=${var.x}, y=${var.y})",
815                     ConstString("CGPoint"),
816                     objc_flags);
817    AddStringSummary(coregraphics_category_sp,
818                     "origin=${var.origin} size=${var.size}",
819                     ConstString("CGRect"),
820                     objc_flags);
821
822    TypeCategoryImpl::SharedPointer coreservices_category_sp = GetCategory(m_coreservices_category_name);
823
824    AddStringSummary(coreservices_category_sp,
825                     "red=${var.red} green=${var.green} blue=${var.blue}",
826                     ConstString("RGBColor"),
827                     objc_flags);
828    AddStringSummary(coreservices_category_sp,
829                     "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
830                     ConstString("Rect"),
831                     objc_flags);
832    AddStringSummary(coreservices_category_sp,
833                     "(v=${var.v}, h=${var.h})",
834                     ConstString("Point"),
835                     objc_flags);
836    AddStringSummary(coreservices_category_sp,
837                     "${var.month}/${var.day}/${var.year}  ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
838                     ConstString("DateTimeRect *"),
839                     objc_flags);
840    AddStringSummary(coreservices_category_sp,
841                     "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}",
842                     ConstString("LongDateRect"),
843                     objc_flags);
844    AddStringSummary(coreservices_category_sp,
845                     "(x=${var.x}, y=${var.y})",
846                     ConstString("HIPoint"),
847                     objc_flags);
848    AddStringSummary(coreservices_category_sp,
849                     "origin=${var.origin} size=${var.size}",
850                     ConstString("HIRect"),
851                     objc_flags);
852
853    TypeCategoryImpl::SharedPointer appkit_category_sp = GetCategory(m_appkit_category_name);
854
855    TypeSummaryImpl::Flags appkit_flags;
856    appkit_flags.SetCascades(true)
857    .SetSkipPointers(false)
858    .SetSkipReferences(false)
859    .SetDontShowChildren(true)
860    .SetDontShowValue(false)
861    .SetShowMembersOneLiner(false)
862    .SetHideItemNames(false);
863
864    appkit_flags.SetDontShowChildren(false);
865
866
867#ifndef LLDB_DISABLE_PYTHON
868    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags);
869    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
870    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
871    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
872    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
873    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
874    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags);
875
876    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags);
877    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSMutableDictionary"), appkit_flags);
878    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags);
879    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags);
880    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags);
881    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags);
882    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags);
883
884    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSSet summary", ConstString("NSSet"), appkit_flags);
885    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
886    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFSetRef summary", ConstString("CFSetRef"), appkit_flags);
887    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags);
888    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags);
889    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetI summary", ConstString("__NSSetI"), appkit_flags);
890    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetM summary", ConstString("__NSSetM"), appkit_flags);
891    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags);
892    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
893    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSOrderedSet summary", ConstString("NSOrderedSet"), appkit_flags);
894    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetI summary", ConstString("__NSOrderedSetI"), appkit_flags);
895    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetM summary", ConstString("__NSOrderedSetM"), appkit_flags);
896
897    // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}", ConstString("$_lldb_typegen_nspair"), appkit_flags);
898
899    appkit_flags.SetDontShowChildren(true);
900
901    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags());
902    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags());
903    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags());
904    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags());
905    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags());
906    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags());
907    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFArrayRef"), ScriptedSyntheticChildren::Flags());
908
909    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags());
910    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags());
911    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags());
912    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags());
913    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags());
914    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags());
915
916    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("NSSet"), ScriptedSyntheticChildren::Flags());
917    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetI synthetic children", ConstString("__NSSetI"), ScriptedSyntheticChildren::Flags());
918    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetM synthetic children", ConstString("__NSSetM"), ScriptedSyntheticChildren::Flags());
919    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSMutableSet synthetic children", ConstString("NSMutableSet"), ScriptedSyntheticChildren::Flags());
920    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSOrderedSet synthetic children", ConstString("NSOrderedSet"), ScriptedSyntheticChildren::Flags());
921    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetI synthetic children", ConstString("__NSOrderedSetI"), ScriptedSyntheticChildren::Flags());
922    AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetM synthetic children", ConstString("__NSOrderedSetM"), ScriptedSyntheticChildren::Flags());
923
924    AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFBagRef"), appkit_flags);
925    AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("__CFBag"), appkit_flags);
926    AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("const struct __CFBag"), appkit_flags);
927    AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFMutableBagRef"), appkit_flags);
928
929    AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("CFBinaryHeapRef"), appkit_flags);
930    AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("__CFBinaryHeap"), appkit_flags);
931
932    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
933    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
934    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
935    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags);
936    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
937    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
938    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags);
939    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags);
940    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
941
942    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSAttributedStringSummaryProvider, "NSAttributedString summary provider", ConstString("NSAttributedString"), appkit_flags);
943    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSMutableAttributedString"), appkit_flags);
944    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSConcreteMutableAttributedString"), appkit_flags);
945
946    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSBundleSummaryProvider, "NSBundle summary provider", ConstString("NSBundle"), appkit_flags);
947
948    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags);
949    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
950    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags);
951    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
952    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
953    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
954
955    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMachPortSummaryProvider, "NSMachPort summary provider", ConstString("NSMachPort"), appkit_flags);
956
957    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSNotification"), appkit_flags);
958    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSConcreteNotification"), appkit_flags);
959
960    AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags);
961    AddStringSummary(appkit_category_sp,"name:${var.name%S} reason:${var.reason%S}",ConstString("NSException"),appkit_flags);
962
963    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
964    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
965    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
966    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
967    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
968
969    AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSDecimalNumber summary provider", ConstString("NSDecimalNumber"), appkit_flags);
970    AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSHost summary provider", ConstString("NSHost"), appkit_flags);
971    AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags);
972    AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags);
973
974    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("NSURL"), appkit_flags);
975    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("CFURLRef"), appkit_flags);
976
977    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSDate"), appkit_flags);
978    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSDate"), appkit_flags);
979    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSTaggedDate"), appkit_flags);
980    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags);
981
982    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags);
983    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("CFTimeZoneRef"), appkit_flags);
984    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags);
985
986    // CFAbsoluteTime is actually a double rather than a pointer to an object
987    // we do not care about the numeric value, since it is probably meaningless to users
988    appkit_flags.SetDontShowValue(true);
989    AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFAbsoluteTimeSummaryProvider, "CFAbsoluteTime summary provider", ConstString("CFAbsoluteTime"), appkit_flags);
990    appkit_flags.SetDontShowValue(false);
991
992    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags);
993    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSMutableIndexSet"), appkit_flags);
994
995    AddStringSummary(appkit_category_sp,
996                     "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"",
997                     ConstString("CFGregorianDate"),
998                     appkit_flags);
999
1000    AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFBitVectorRef"), appkit_flags);
1001    AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFMutableBitVectorRef"), appkit_flags);
1002    AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFBitVector"), appkit_flags);
1003    AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFMutableBitVector"), appkit_flags);
1004#endif // LLDB_DISABLE_PYTHON
1005
1006    TypeCategoryImpl::SharedPointer vectors_category_sp = GetCategory(m_vectortypes_category_name);
1007
1008    TypeSummaryImpl::Flags vector_flags;
1009    vector_flags.SetCascades(true)
1010    .SetSkipPointers(true)
1011    .SetSkipReferences(false)
1012    .SetDontShowChildren(true)
1013    .SetDontShowValue(false)
1014    .SetShowMembersOneLiner(true)
1015    .SetHideItemNames(true);
1016
1017    AddStringSummary(vectors_category_sp,
1018                     "${var.uint128}",
1019                     ConstString("builtin_type_vec128"),
1020                     objc_flags);
1021
1022    AddStringSummary(vectors_category_sp,
1023                     "",
1024                     ConstString("float [4]"),
1025                     vector_flags);
1026    AddStringSummary(vectors_category_sp,
1027                     "",
1028                     ConstString("int32_t [4]"),
1029                     vector_flags);
1030    AddStringSummary(vectors_category_sp,
1031                     "",
1032                     ConstString("int16_t [8]"),
1033                     vector_flags);
1034    AddStringSummary(vectors_category_sp,
1035                     "",
1036                     ConstString("vDouble"),
1037                     vector_flags);
1038    AddStringSummary(vectors_category_sp,
1039                     "",
1040                     ConstString("vFloat"),
1041                     vector_flags);
1042    AddStringSummary(vectors_category_sp,
1043                     "",
1044                     ConstString("vSInt8"),
1045                     vector_flags);
1046    AddStringSummary(vectors_category_sp,
1047                     "",
1048                     ConstString("vSInt16"),
1049                     vector_flags);
1050    AddStringSummary(vectors_category_sp,
1051                     "",
1052                     ConstString("vSInt32"),
1053                     vector_flags);
1054    AddStringSummary(vectors_category_sp,
1055                     "",
1056                     ConstString("vUInt16"),
1057                     vector_flags);
1058    AddStringSummary(vectors_category_sp,
1059                     "",
1060                     ConstString("vUInt8"),
1061                     vector_flags);
1062    AddStringSummary(vectors_category_sp,
1063                     "",
1064                     ConstString("vUInt16"),
1065                     vector_flags);
1066    AddStringSummary(vectors_category_sp,
1067                     "",
1068                     ConstString("vUInt32"),
1069                     vector_flags);
1070    AddStringSummary(vectors_category_sp,
1071                     "",
1072                     ConstString("vBool32"),
1073                     vector_flags);
1074}
1075