1 //===-- FormatManager.cpp -------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-python.h"
12 #include "lldb/DataFormatters/FormatManager.h"
16 // Other libraries and framework includes
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 #include "llvm/ADT/STLExtras.h"
27 using namespace lldb_private;
33 const char format_char; // One or more format characters that can be used for this format.
34 const char *format_name; // Long format name that can be used to specify the current format
40 { eFormatDefault , '\0' , "default" },
41 { eFormatBoolean , 'B' , "boolean" },
42 { eFormatBinary , 'b' , "binary" },
43 { eFormatBytes , 'y' , "bytes" },
44 { eFormatBytesWithASCII , 'Y' , "bytes with ASCII" },
45 { eFormatChar , 'c' , "character" },
46 { eFormatCharPrintable , 'C' , "printable character" },
47 { eFormatComplexFloat , 'F' , "complex float" },
48 { eFormatCString , 's' , "c-string" },
49 { eFormatDecimal , 'd' , "decimal" },
50 { eFormatEnum , 'E' , "enumeration" },
51 { eFormatHex , 'x' , "hex" },
52 { eFormatHexUppercase , 'X' , "uppercase hex" },
53 { eFormatFloat , 'f' , "float" },
54 { eFormatOctal , 'o' , "octal" },
55 { eFormatOSType , 'O' , "OSType" },
56 { eFormatUnicode16 , 'U' , "unicode16" },
57 { eFormatUnicode32 , '\0' , "unicode32" },
58 { eFormatUnsigned , 'u' , "unsigned decimal" },
59 { eFormatPointer , 'p' , "pointer" },
60 { eFormatVectorOfChar , '\0' , "char[]" },
61 { eFormatVectorOfSInt8 , '\0' , "int8_t[]" },
62 { eFormatVectorOfUInt8 , '\0' , "uint8_t[]" },
63 { eFormatVectorOfSInt16 , '\0' , "int16_t[]" },
64 { eFormatVectorOfUInt16 , '\0' , "uint16_t[]" },
65 { eFormatVectorOfSInt32 , '\0' , "int32_t[]" },
66 { eFormatVectorOfUInt32 , '\0' , "uint32_t[]" },
67 { eFormatVectorOfSInt64 , '\0' , "int64_t[]" },
68 { eFormatVectorOfUInt64 , '\0' , "uint64_t[]" },
69 { eFormatVectorOfFloat32, '\0' , "float32[]" },
70 { eFormatVectorOfFloat64, '\0' , "float64[]" },
71 { eFormatVectorOfUInt128, '\0' , "uint128_t[]" },
72 { eFormatComplexInteger , 'I' , "complex integer" },
73 { eFormatCharArray , 'a' , "character array" },
74 { eFormatAddressInfo , 'A' , "address" },
75 { eFormatHexFloat , '\0' , "hex float" },
76 { eFormatInstruction , 'i' , "instruction" },
77 { eFormatVoid , 'v' , "void" }
80 static uint32_t g_num_format_infos = llvm::array_lengthof(g_format_infos);
83 GetFormatFromFormatChar (char format_char, Format &format)
85 for (uint32_t i=0; i<g_num_format_infos; ++i)
87 if (g_format_infos[i].format_char == format_char)
89 format = g_format_infos[i].format;
93 format = eFormatInvalid;
98 GetFormatFromFormatName (const char *format_name, bool partial_match_ok, Format &format)
101 for (i=0; i<g_num_format_infos; ++i)
103 if (strcasecmp (g_format_infos[i].format_name, format_name) == 0)
105 format = g_format_infos[i].format;
110 if (partial_match_ok)
112 for (i=0; i<g_num_format_infos; ++i)
114 if (strcasestr (g_format_infos[i].format_name, format_name) == g_format_infos[i].format_name)
116 format = g_format_infos[i].format;
121 format = eFormatInvalid;
126 FormatManager::GetFormatFromCString (const char *format_cstr,
127 bool partial_match_ok,
128 lldb::Format &format)
130 bool success = false;
131 if (format_cstr && format_cstr[0])
133 if (format_cstr[1] == '\0')
135 success = GetFormatFromFormatChar (format_cstr[0], format);
140 success = GetFormatFromFormatName (format_cstr, partial_match_ok, format);
143 format = eFormatInvalid;
148 FormatManager::GetFormatAsFormatChar (lldb::Format format)
150 for (uint32_t i=0; i<g_num_format_infos; ++i)
152 if (g_format_infos[i].format == format)
153 return g_format_infos[i].format_char;
159 FormatManager::GetFormatAsCString (Format format)
161 if (format >= eFormatDefault && format < kNumFormats)
162 return g_format_infos[format].format_name;
167 FormatManager::GetPossibleMatches (ValueObject& valobj,
168 ClangASTType clang_type,
170 lldb::DynamicValueType use_dynamic,
171 FormattersMatchVector& entries,
174 bool did_strip_typedef,
177 clang_type = clang_type.RemoveFastQualifiers();
178 ConstString type_name(clang_type.GetConstTypeName());
179 if (valobj.GetBitfieldBitSize() > 0)
181 StreamString sstring;
182 sstring.Printf("%s:%d",type_name.AsCString(),valobj.GetBitfieldBitSize());
183 ConstString bitfieldname = ConstString(sstring.GetData());
184 entries.push_back({bitfieldname,0,did_strip_ptr,did_strip_ref,did_strip_typedef});
185 reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
187 entries.push_back({type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
189 ConstString display_type_name(clang_type.GetDisplayTypeName());
190 if (display_type_name != type_name)
191 entries.push_back({display_type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
193 for (bool is_rvalue_ref = true, j = true; j && clang_type.IsReferenceType(nullptr, &is_rvalue_ref); j = false)
195 ClangASTType non_ref_type = clang_type.GetNonReferenceType();
196 GetPossibleMatches(valobj,
198 reason | lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
204 if (non_ref_type.IsTypedefType())
206 ClangASTType deffed_referenced_type = non_ref_type.GetTypedefedType();
207 deffed_referenced_type = is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType() : deffed_referenced_type.GetLValueReferenceType();
208 GetPossibleMatches(valobj,
209 deffed_referenced_type,
210 reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
215 true); // this is not exactly the usual meaning of stripping typedefs
219 if (clang_type.IsPointerType())
221 ClangASTType non_ptr_type = clang_type.GetPointeeType();
222 GetPossibleMatches(valobj,
224 reason | lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
230 if (non_ptr_type.IsTypedefType())
232 ClangASTType deffed_pointed_type = non_ptr_type.GetTypedefedType().GetPointerType();
233 GetPossibleMatches(valobj,
235 reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
240 true); // this is not exactly the usual meaning of stripping typedefs
243 bool canBeObjCDynamic = clang_type.IsPossibleDynamicType (NULL,
247 if (canBeObjCDynamic)
249 if (use_dynamic != lldb::eNoDynamicValues)
253 lldb::ProcessSP process_sp = valobj.GetProcessSP();
254 ObjCLanguageRuntime* runtime = process_sp->GetObjCLanguageRuntime();
255 if (runtime == nullptr)
257 ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp (runtime->GetClassDescriptor(valobj));
260 ConstString name (objc_class_sp->GetClassName());
261 entries.push_back({name,reason | lldb_private::eFormatterChoiceCriterionDynamicObjCDiscovery,did_strip_ptr,did_strip_ref,did_strip_typedef});
265 ClangASTType non_ptr_type = clang_type.GetPointeeType();
266 GetPossibleMatches(valobj,
268 reason | lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
276 // try to strip typedef chains
277 if (clang_type.IsTypedefType())
279 ClangASTType deffed_type = clang_type.GetTypedefedType();
280 GetPossibleMatches(valobj,
282 reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
293 if (!clang_type.IsValid())
296 ClangASTType unqual_clang_ast_type = clang_type.GetFullyUnqualifiedType();
297 if (!unqual_clang_ast_type.IsValid())
299 if (unqual_clang_ast_type.GetOpaqueQualType() != clang_type.GetOpaqueQualType())
300 GetPossibleMatches (valobj,
301 unqual_clang_ast_type,
311 // if all else fails, go to static type
312 if (valobj.IsDynamic())
314 lldb::ValueObjectSP static_value_sp(valobj.GetStaticValue());
316 GetPossibleMatches(*static_value_sp.get(),
317 static_value_sp->GetClangType(),
318 reason | lldb_private::eFormatterChoiceCriterionWentToStaticValue,
329 lldb::TypeFormatImplSP
330 FormatManager::GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp)
333 return lldb::TypeFormatImplSP();
334 lldb::TypeFormatImplSP format_chosen_sp;
335 uint32_t num_categories = m_categories_map.GetCount();
336 lldb::TypeCategoryImplSP category_sp;
337 uint32_t prio_category = UINT32_MAX;
338 for (uint32_t category_id = 0;
339 category_id < num_categories;
342 category_sp = GetCategoryAtIndex(category_id);
343 if (category_sp->IsEnabled() == false)
345 lldb::TypeFormatImplSP format_current_sp = category_sp->GetFormatForType(type_sp);
346 if (format_current_sp && (format_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
348 prio_category = category_sp->GetEnabledPosition();
349 format_chosen_sp = format_current_sp;
352 return format_chosen_sp;
355 lldb::TypeSummaryImplSP
356 FormatManager::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
359 return lldb::TypeSummaryImplSP();
360 lldb::TypeSummaryImplSP summary_chosen_sp;
361 uint32_t num_categories = m_categories_map.GetCount();
362 lldb::TypeCategoryImplSP category_sp;
363 uint32_t prio_category = UINT32_MAX;
364 for (uint32_t category_id = 0;
365 category_id < num_categories;
368 category_sp = GetCategoryAtIndex(category_id);
369 if (category_sp->IsEnabled() == false)
371 lldb::TypeSummaryImplSP summary_current_sp = category_sp->GetSummaryForType(type_sp);
372 if (summary_current_sp && (summary_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
374 prio_category = category_sp->GetEnabledPosition();
375 summary_chosen_sp = summary_current_sp;
378 return summary_chosen_sp;
381 lldb::TypeFilterImplSP
382 FormatManager::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
385 return lldb::TypeFilterImplSP();
386 lldb::TypeFilterImplSP filter_chosen_sp;
387 uint32_t num_categories = m_categories_map.GetCount();
388 lldb::TypeCategoryImplSP category_sp;
389 uint32_t prio_category = UINT32_MAX;
390 for (uint32_t category_id = 0;
391 category_id < num_categories;
394 category_sp = GetCategoryAtIndex(category_id);
395 if (category_sp->IsEnabled() == false)
397 lldb::TypeFilterImplSP filter_current_sp((TypeFilterImpl*)category_sp->GetFilterForType(type_sp).get());
398 if (filter_current_sp && (filter_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
400 prio_category = category_sp->GetEnabledPosition();
401 filter_chosen_sp = filter_current_sp;
404 return filter_chosen_sp;
407 #ifndef LLDB_DISABLE_PYTHON
408 lldb::ScriptedSyntheticChildrenSP
409 FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
412 return lldb::ScriptedSyntheticChildrenSP();
413 lldb::ScriptedSyntheticChildrenSP synth_chosen_sp;
414 uint32_t num_categories = m_categories_map.GetCount();
415 lldb::TypeCategoryImplSP category_sp;
416 uint32_t prio_category = UINT32_MAX;
417 for (uint32_t category_id = 0;
418 category_id < num_categories;
421 category_sp = GetCategoryAtIndex(category_id);
422 if (category_sp->IsEnabled() == false)
424 lldb::ScriptedSyntheticChildrenSP synth_current_sp((ScriptedSyntheticChildren*)category_sp->GetSyntheticForType(type_sp).get());
425 if (synth_current_sp && (synth_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
427 prio_category = category_sp->GetEnabledPosition();
428 synth_chosen_sp = synth_current_sp;
431 return synth_chosen_sp;
435 #ifndef LLDB_DISABLE_PYTHON
436 lldb::SyntheticChildrenSP
437 FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
440 return lldb::SyntheticChildrenSP();
441 lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
442 lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
443 if (filter_sp->GetRevision() > synth_sp->GetRevision())
444 return lldb::SyntheticChildrenSP(filter_sp.get());
446 return lldb::SyntheticChildrenSP(synth_sp.get());
450 lldb::TypeValidatorImplSP
451 FormatManager::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp)
454 return lldb::TypeValidatorImplSP();
455 lldb::TypeValidatorImplSP validator_chosen_sp;
456 uint32_t num_categories = m_categories_map.GetCount();
457 lldb::TypeCategoryImplSP category_sp;
458 uint32_t prio_category = UINT32_MAX;
459 for (uint32_t category_id = 0;
460 category_id < num_categories;
463 category_sp = GetCategoryAtIndex(category_id);
464 if (category_sp->IsEnabled() == false)
466 lldb::TypeValidatorImplSP validator_current_sp(category_sp->GetValidatorForType(type_sp).get());
467 if (validator_current_sp && (validator_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
469 prio_category = category_sp->GetEnabledPosition();
470 validator_chosen_sp = validator_current_sp;
473 return validator_chosen_sp;
476 lldb::TypeCategoryImplSP
477 FormatManager::GetCategory (const ConstString& category_name,
481 return GetCategory(m_default_category_name);
482 lldb::TypeCategoryImplSP category;
483 if (m_categories_map.Get(category_name, category))
487 return lldb::TypeCategoryImplSP();
489 m_categories_map.Add(category_name,lldb::TypeCategoryImplSP(new TypeCategoryImpl(this, category_name)));
490 return GetCategory(category_name);
494 FormatManager::GetSingleItemFormat(lldb::Format vector_format)
496 switch(vector_format)
498 case eFormatVectorOfChar:
499 return eFormatCharArray;
501 case eFormatVectorOfSInt8:
502 case eFormatVectorOfSInt16:
503 case eFormatVectorOfSInt32:
504 case eFormatVectorOfSInt64:
505 return eFormatDecimal;
507 case eFormatVectorOfUInt8:
508 case eFormatVectorOfUInt16:
509 case eFormatVectorOfUInt32:
510 case eFormatVectorOfUInt64:
511 case eFormatVectorOfUInt128:
514 case eFormatVectorOfFloat32:
515 case eFormatVectorOfFloat64:
519 return lldb::eFormatInvalid;
524 FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj)
526 // if settings say no oneline whatsoever
527 if (valobj.GetTargetSP().get() && valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries() == false)
528 return false; // then don't oneline
530 // if this object has a summary, then ask the summary
531 if (valobj.GetSummaryFormat().get() != nullptr)
532 return valobj.GetSummaryFormat()->IsOneLiner();
534 // no children, no party
535 if (valobj.GetNumChildren() == 0)
538 size_t total_children_name_len = 0;
541 idx < valobj.GetNumChildren();
544 bool is_synth_val = false;
545 ValueObjectSP child_sp(valobj.GetChildAtIndex(idx, true));
546 // something is wrong here - bail out
549 // if we decided to define synthetic children for a type, we probably care enough
550 // to show them, but avoid nesting children in children
551 if (child_sp->GetSyntheticChildren().get() != nullptr)
553 ValueObjectSP synth_sp(child_sp->GetSyntheticValue());
554 // wait.. wat? just get out of here..
557 // but if we only have them to provide a value, keep going
558 if (synth_sp->MightHaveChildren() == false && synth_sp->DoesProvideSyntheticValue())
564 total_children_name_len += child_sp->GetName().GetLength();
566 // 50 itself is a "randomly" chosen number - the idea is that
567 // overly long structs should not get this treatment
568 // FIXME: maybe make this a user-tweakable setting?
569 if (total_children_name_len > 50)
572 // if a summary is there..
573 if (child_sp->GetSummaryFormat())
575 // and it wants children, then bail out
576 if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
580 // if this child has children..
581 if (child_sp->GetNumChildren())
583 // ...and no summary...
584 // (if it had a summary and the summary wanted children, we would have bailed out anyway
585 // so this only makes us bail out if this has no summary and we would then print children)
586 if (!child_sp->GetSummaryFormat() && !is_synth_val) // but again only do that if not a synthetic valued child
587 return false; // then bail out
594 FormatManager::GetValidTypeName (const ConstString& type)
596 return ::GetValidTypeName_Impl(type);
600 GetTypeForCache (ValueObject& valobj,
601 lldb::DynamicValueType use_dynamic)
603 if (use_dynamic == lldb::eNoDynamicValues)
605 if (valobj.IsDynamic())
607 if (valobj.GetStaticValue())
608 return valobj.GetStaticValue()->GetQualifiedTypeName();
610 return ConstString();
613 return valobj.GetQualifiedTypeName();
615 if (valobj.IsDynamic())
616 return valobj.GetQualifiedTypeName();
617 if (valobj.GetDynamicValue(use_dynamic))
618 return valobj.GetDynamicValue(use_dynamic)->GetQualifiedTypeName();
619 return ConstString();
622 lldb::TypeFormatImplSP
623 FormatManager::GetHardcodedFormat (ValueObject& valobj,
624 lldb::DynamicValueType use_dynamic)
626 for (const auto& candidate: m_hardcoded_formats)
628 auto result = candidate(valobj,use_dynamic,*this);
635 lldb::TypeFormatImplSP
636 FormatManager::GetFormat (ValueObject& valobj,
637 lldb::DynamicValueType use_dynamic)
639 TypeFormatImplSP retval;
640 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
641 ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
645 log->Printf("\n\n[FormatManager::GetFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
646 if (m_format_cache.GetFormat(valobj_type,retval))
650 log->Printf("[FormatManager::GetFormat] Cache search success. Returning.");
652 log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
657 log->Printf("[FormatManager::GetFormat] Cache search failed. Going normal route");
659 retval = m_categories_map.GetFormat(valobj, use_dynamic);
663 log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded a chance.");
664 retval = GetHardcodedFormat(valobj, use_dynamic);
666 else if (valobj_type)
669 log->Printf("[FormatManager::GetFormat] Caching %p for type %s",
670 static_cast<void*>(retval.get()),
671 valobj_type.AsCString("<invalid>"));
672 m_format_cache.SetFormat(valobj_type,retval);
674 if (log && log->GetDebug())
675 log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
679 lldb::TypeSummaryImplSP
680 FormatManager::GetHardcodedSummaryFormat (ValueObject& valobj,
681 lldb::DynamicValueType use_dynamic)
683 for (const auto& candidate: m_hardcoded_summaries)
685 auto result = candidate(valobj,use_dynamic,*this);
692 lldb::TypeSummaryImplSP
693 FormatManager::GetSummaryFormat (ValueObject& valobj,
694 lldb::DynamicValueType use_dynamic)
696 TypeSummaryImplSP retval;
697 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
698 ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
702 log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
703 if (m_format_cache.GetSummary(valobj_type,retval))
707 log->Printf("[FormatManager::GetSummaryFormat] Cache search success. Returning.");
709 log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
714 log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
716 retval = m_categories_map.GetSummaryFormat(valobj, use_dynamic);
720 log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving hardcoded a chance.");
721 retval = GetHardcodedSummaryFormat(valobj, use_dynamic);
723 else if (valobj_type)
726 log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",
727 static_cast<void*>(retval.get()),
728 valobj_type.AsCString("<invalid>"));
729 m_format_cache.SetSummary(valobj_type,retval);
731 if (log && log->GetDebug())
732 log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
736 #ifndef LLDB_DISABLE_PYTHON
737 lldb::SyntheticChildrenSP
738 FormatManager::GetHardcodedSyntheticChildren (ValueObject& valobj,
739 lldb::DynamicValueType use_dynamic)
741 for (const auto& candidate: m_hardcoded_synthetics)
743 auto result = candidate(valobj,use_dynamic,*this);
750 lldb::SyntheticChildrenSP
751 FormatManager::GetSyntheticChildren (ValueObject& valobj,
752 lldb::DynamicValueType use_dynamic)
754 SyntheticChildrenSP retval;
755 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
756 ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
760 log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
761 if (m_format_cache.GetSynthetic(valobj_type,retval))
765 log->Printf("[FormatManager::GetSyntheticChildren] Cache search success. Returning.");
767 log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
772 log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route");
774 retval = m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
778 log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving hardcoded a chance.");
779 retval = GetHardcodedSyntheticChildren(valobj, use_dynamic);
781 else if (valobj_type)
784 log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s",
785 static_cast<void*>(retval.get()),
786 valobj_type.AsCString("<invalid>"));
787 m_format_cache.SetSynthetic(valobj_type,retval);
789 if (log && log->GetDebug())
790 log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
795 lldb::TypeValidatorImplSP
796 FormatManager::GetValidator (ValueObject& valobj,
797 lldb::DynamicValueType use_dynamic)
799 TypeValidatorImplSP retval;
800 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
801 ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
805 log->Printf("\n\n[FormatManager::GetValidator] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
806 if (m_format_cache.GetValidator(valobj_type,retval))
810 log->Printf("[FormatManager::GetValidator] Cache search success. Returning.");
812 log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
817 log->Printf("[FormatManager::GetValidator] Cache search failed. Going normal route");
819 retval = m_categories_map.GetValidator(valobj, use_dynamic);
823 log->Printf("[FormatManager::GetValidator] Search failed. Giving hardcoded a chance.");
824 retval = GetHardcodedValidator(valobj, use_dynamic);
826 else if (valobj_type)
829 log->Printf("[FormatManager::GetValidator] Caching %p for type %s",
830 static_cast<void*>(retval.get()),
831 valobj_type.AsCString("<invalid>"));
832 m_format_cache.SetValidator(valobj_type,retval);
834 if (log && log->GetDebug())
835 log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
839 lldb::TypeValidatorImplSP
840 FormatManager::GetHardcodedValidator (ValueObject& valobj,
841 lldb::DynamicValueType use_dynamic)
843 for (const auto& candidate: m_hardcoded_validators)
845 auto result = candidate(valobj,use_dynamic,*this);
852 FormatManager::FormatManager() :
854 m_named_summaries_map(this),
856 m_categories_map(this),
857 m_default_category_name(ConstString("default")),
858 m_system_category_name(ConstString("system")),
859 m_gnu_cpp_category_name(ConstString("gnu-libstdc++")),
860 m_libcxx_category_name(ConstString("libcxx")),
861 m_objc_category_name(ConstString("objc")),
862 m_corefoundation_category_name(ConstString("CoreFoundation")),
863 m_coregraphics_category_name(ConstString("CoreGraphics")),
864 m_coreservices_category_name(ConstString("CoreServices")),
865 m_vectortypes_category_name(ConstString("VectorTypes")),
866 m_appkit_category_name(ConstString("AppKit")),
867 m_hardcoded_formats(),
868 m_hardcoded_summaries(),
869 m_hardcoded_synthetics(),
870 m_hardcoded_validators()
873 LoadSystemFormatters();
874 LoadLibStdcppFormatters();
875 LoadLibcxxFormatters();
876 LoadObjCFormatters();
877 LoadHardcodedFormatters();
879 EnableCategory(m_objc_category_name,TypeCategoryMap::Last);
880 EnableCategory(m_corefoundation_category_name,TypeCategoryMap::Last);
881 EnableCategory(m_appkit_category_name,TypeCategoryMap::Last);
882 EnableCategory(m_coreservices_category_name,TypeCategoryMap::Last);
883 EnableCategory(m_coregraphics_category_name,TypeCategoryMap::Last);
884 EnableCategory(m_gnu_cpp_category_name,TypeCategoryMap::Last);
885 EnableCategory(m_libcxx_category_name,TypeCategoryMap::Last);
886 EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last);
887 EnableCategory(m_system_category_name,TypeCategoryMap::Last);
891 AddFormat (TypeCategoryImpl::SharedPointer category_sp,
893 ConstString type_name,
894 TypeFormatImpl::Flags flags,
897 lldb::TypeFormatImplSP format_sp(new TypeFormatImpl_Format(format, flags));
900 category_sp->GetRegexTypeFormatsContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),format_sp);
902 category_sp->GetTypeFormatsContainer()->Add(type_name, format_sp);
907 AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
909 ConstString type_name,
910 TypeSummaryImpl::Flags flags,
913 lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags,
917 category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
919 category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
923 AddOneLineSummary (TypeCategoryImpl::SharedPointer category_sp,
924 ConstString type_name,
925 TypeSummaryImpl::Flags flags,
928 flags.SetShowMembersOneLiner(true);
929 lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, ""));
932 category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
934 category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
937 #ifndef LLDB_DISABLE_PYTHON
939 AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
940 CXXFunctionSummaryFormat::Callback funct,
941 const char* description,
942 ConstString type_name,
943 TypeSummaryImpl::Flags flags,
946 lldb::TypeSummaryImplSP summary_sp(new CXXFunctionSummaryFormat(flags,funct,description));
948 category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
950 category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
954 #ifndef LLDB_DISABLE_PYTHON
955 static void AddCXXSynthetic (TypeCategoryImpl::SharedPointer category_sp,
956 CXXSyntheticChildren::CreateFrontEndCallback generator,
957 const char* description,
958 ConstString type_name,
959 ScriptedSyntheticChildren::Flags flags,
962 lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
964 category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), synth_sp);
966 category_sp->GetTypeSyntheticsContainer()->Add(type_name,synth_sp);
970 #ifndef LLDB_DISABLE_PYTHON
971 static void AddFilter (TypeCategoryImpl::SharedPointer category_sp,
972 std::vector<std::string> children,
973 const char* description,
974 ConstString type_name,
975 ScriptedSyntheticChildren::Flags flags,
978 TypeFilterImplSP filter_sp(new TypeFilterImpl(flags));
979 for (auto child : children)
980 filter_sp->AddExpressionPath(child);
982 category_sp->GetRegexTypeFiltersContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), filter_sp);
984 category_sp->GetTypeFiltersContainer()->Add(type_name,filter_sp);
989 FormatManager::LoadLibStdcppFormatters()
991 TypeSummaryImpl::Flags stl_summary_flags;
992 stl_summary_flags.SetCascades(true)
993 .SetSkipPointers(false)
994 .SetSkipReferences(false)
995 .SetDontShowChildren(true)
996 .SetDontShowValue(true)
997 .SetShowMembersOneLiner(false)
998 .SetHideItemNames(false);
1000 lldb::TypeSummaryImplSP std_string_summary_sp(new StringSummaryFormat(stl_summary_flags,
1001 "${var._M_dataplus._M_p}"));
1003 TypeCategoryImpl::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name);
1005 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::string"),
1006 std_string_summary_sp);
1007 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<char>"),
1008 std_string_summary_sp);
1009 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
1010 std_string_summary_sp);
1011 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"),
1012 std_string_summary_sp);
1014 // making sure we force-pick the summary for printing wstring (_M_p is a wchar_t*)
1015 lldb::TypeSummaryImplSP std_wstring_summary_sp(new StringSummaryFormat(stl_summary_flags,
1016 "${var._M_dataplus._M_p%S}"));
1018 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::wstring"),
1019 std_wstring_summary_sp);
1020 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<wchar_t>"),
1021 std_wstring_summary_sp);
1022 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >"),
1023 std_wstring_summary_sp);
1024 gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >"),
1025 std_wstring_summary_sp);
1028 #ifndef LLDB_DISABLE_PYTHON
1030 SyntheticChildren::Flags stl_synth_flags;
1031 stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
1033 gnu_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
1034 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
1035 "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
1036 gnu_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
1037 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
1038 "lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
1039 gnu_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
1040 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
1041 "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
1043 stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
1044 gnu_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
1045 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
1046 "size=${svar%#}")));
1047 gnu_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
1048 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
1049 "size=${svar%#}")));
1050 gnu_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
1051 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
1052 "size=${svar%#}")));
1054 AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibStdcppVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^__gnu_cxx::__normal_iterator<.+>$"), stl_synth_flags, true);
1056 AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::_Rb_tree_iterator<.+>$"), stl_synth_flags, true);
1061 FormatManager::LoadLibcxxFormatters()
1063 TypeSummaryImpl::Flags stl_summary_flags;
1064 stl_summary_flags.SetCascades(true)
1065 .SetSkipPointers(false)
1066 .SetSkipReferences(false)
1067 .SetDontShowChildren(true)
1068 .SetDontShowValue(true)
1069 .SetShowMembersOneLiner(false)
1070 .SetHideItemNames(false);
1072 #ifndef LLDB_DISABLE_PYTHON
1073 //std::string code(" lldb.formatters.cpp.libcxx.stdstring_SummaryProvider(valobj,internal_dict)");
1074 //lldb::TypeSummaryImplSP std_string_summary_sp(new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.libcxx.stdstring_SummaryProvider",code.c_str()));
1076 lldb::TypeSummaryImplSP std_string_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxStringSummaryProvider, "std::string summary provider"));
1077 lldb::TypeSummaryImplSP std_wstring_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider"));
1079 TypeCategoryImpl::SharedPointer libcxx_category_sp = GetCategory(m_libcxx_category_name);
1081 libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::string"),
1082 std_string_summary_sp);
1083 libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"),
1084 std_string_summary_sp);
1086 libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::wstring"),
1087 std_wstring_summary_sp);
1088 libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >"),
1089 std_wstring_summary_sp);
1091 SyntheticChildren::Flags stl_synth_flags;
1092 stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
1094 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator, "libc++ std::vector synthetic children", ConstString("^std::__1::vector<.+>(( )?&)?$"), stl_synth_flags, true);
1095 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator, "libc++ std::list synthetic children", ConstString("^std::__1::list<.+>(( )?&)?$"), stl_synth_flags, true);
1096 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::map synthetic children", ConstString("^std::__1::map<.+> >(( )?&)?$"), stl_synth_flags, true);
1097 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);
1098 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEndCreator, "libc++ std::vector<bool> synthetic children", ConstString("std::__1::vector<bool, std::__1::allocator<bool> >"), stl_synth_flags);
1099 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::set synthetic children", ConstString("^std::__1::set<.+> >(( )?&)?$"), stl_synth_flags, true);
1100 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::multiset synthetic children", ConstString("^std::__1::multiset<.+> >(( )?&)?$"), stl_synth_flags, true);
1101 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::multimap synthetic children", ConstString("^std::__1::multimap<.+> >(( )?&)?$"), stl_synth_flags, true);
1102 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEndCreator, "libc++ std::unordered containers synthetic children", ConstString("^(std::__1::)unordered_(multi)?(map|set)<.+> >$"), stl_synth_flags, true);
1103 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxInitializerListSyntheticFrontEndCreator, "libc++ std::initializer_list synthetic children", ConstString("^std::initializer_list<.+>(( )?&)?$"), stl_synth_flags, true);
1105 libcxx_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")),
1106 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
1107 "lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
1109 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator, "shared_ptr synthetic children", ConstString("^(std::__1::)shared_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1110 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxSharedPtrSyntheticFrontEndCreator, "weak_ptr synthetic children", ConstString("^(std::__1::)weak_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
1112 stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(false);
1113 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEndCreator, "libc++ std::vector<bool> synthetic children", ConstString("std::__1::vector<bool, std::__1::allocator<bool> >"), stl_synth_flags);
1115 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::vector summary provider", ConstString("^std::__1::vector<.+>(( )?&)?$"), stl_summary_flags, true);
1116 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::list summary provider", ConstString("^std::__1::list<.+>(( )?&)?$"), stl_summary_flags, true);
1117 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::map summary provider", ConstString("^std::__1::map<.+>(( )?&)?$"), stl_summary_flags, true);
1118 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::deque summary provider", ConstString("^std::__1::deque<.+>(( )?&)?$"), stl_summary_flags, true);
1119 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);
1120 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::vector<bool> summary provider", ConstString("std::__1::vector<bool, std::__1::allocator<bool> >"), stl_summary_flags);
1121 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::set summary provider", ConstString("^std::__1::set<.+>(( )?&)?$"), stl_summary_flags, true);
1122 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::multiset summary provider", ConstString("^std::__1::multiset<.+>(( )?&)?$"), stl_summary_flags, true);
1123 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::multimap summary provider", ConstString("^std::__1::multimap<.+>(( )?&)?$"), stl_summary_flags, true);
1124 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::unordered containers summary provider", ConstString("^(std::__1::)unordered_(multi)?(map|set)<.+> >$"), stl_summary_flags, true);
1126 stl_summary_flags.SetSkipPointers(true);
1128 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxSmartPointerSummaryProvider, "libc++ std::shared_ptr summary provider", ConstString("^std::__1::shared_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
1129 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxSmartPointerSummaryProvider, "libc++ std::weak_ptr summary provider", ConstString("^std::__1::weak_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
1131 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^std::__1::__wrap_iter<.+>$"), stl_synth_flags, true);
1133 AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::vector<bool> summary provider", ConstString("std::__1::vector<bool, std::__1::allocator<bool> >"), stl_summary_flags);
1134 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::__1::__map_iterator<.+>$"), stl_synth_flags, true);
1136 AddFilter(libcxx_category_sp, {"__a_"}, "libc++ std::atomic filter", ConstString("^std::__1::atomic<.*>$"), stl_synth_flags, true);
1141 FormatManager::LoadSystemFormatters()
1144 TypeSummaryImpl::Flags string_flags;
1145 string_flags.SetCascades(true)
1146 .SetSkipPointers(true)
1147 .SetSkipReferences(false)
1148 .SetDontShowChildren(true)
1149 .SetDontShowValue(false)
1150 .SetShowMembersOneLiner(false)
1151 .SetHideItemNames(false);
1153 lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(string_flags, "${var%s}"));
1156 lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
1157 .SetSkipPointers(true)
1158 .SetSkipReferences(false)
1159 .SetDontShowChildren(true)
1160 .SetDontShowValue(true)
1161 .SetShowMembersOneLiner(false)
1162 .SetHideItemNames(false),
1165 lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
1167 TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
1169 sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("char *"), string_format);
1170 sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("unsigned char *"), string_format);
1171 sys_category_sp->GetRegexTypeSummariesContainer()->Add(any_size_char_arr, string_array_format);
1173 lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
1174 .SetSkipPointers(true)
1175 .SetSkipReferences(true)
1176 .SetDontShowChildren(true)
1177 .SetDontShowValue(false)
1178 .SetShowMembersOneLiner(false)
1179 .SetHideItemNames(false),
1182 sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"), ostype_summary);
1184 #ifndef LLDB_DISABLE_PYTHON
1185 // FIXME because of a bug in the FormattersContainer we need to add a summary for both X* and const X* (<rdar://problem/12717717>)
1186 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("char16_t *"), string_flags);
1188 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags);
1190 AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
1192 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("unichar *"), string_flags);
1194 TypeSummaryImpl::Flags widechar_flags;
1195 widechar_flags.SetDontShowValue(true)
1196 .SetSkipPointers(true)
1197 .SetSkipReferences(false)
1199 .SetDontShowChildren(true)
1200 .SetHideItemNames(true)
1201 .SetShowMembersOneLiner(false);
1203 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "char16_t summary provider", ConstString("char16_t"), widechar_flags);
1204 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32SummaryProvider, "char32_t summary provider", ConstString("char32_t"), widechar_flags);
1205 AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharSummaryProvider, "wchar_t summary provider", ConstString("wchar_t"), widechar_flags);
1207 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "unichar summary provider", ConstString("unichar"), widechar_flags);
1209 TypeFormatImpl::Flags fourchar_flags;
1210 fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(true);
1212 AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"), fourchar_flags);
1218 FormatManager::LoadObjCFormatters()
1220 TypeSummaryImpl::Flags objc_flags;
1221 objc_flags.SetCascades(false)
1222 .SetSkipPointers(true)
1223 .SetSkipReferences(true)
1224 .SetDontShowChildren(true)
1225 .SetDontShowValue(true)
1226 .SetShowMembersOneLiner(false)
1227 .SetHideItemNames(false);
1229 TypeCategoryImpl::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
1230 TypeCategoryImpl::SharedPointer appkit_category_sp = GetCategory(m_appkit_category_name);
1231 TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name);
1232 TypeCategoryImpl::SharedPointer coregraphics_category_sp = GetCategory(m_coregraphics_category_name);
1233 TypeCategoryImpl::SharedPointer coreservices_category_sp = GetCategory(m_coreservices_category_name);
1235 lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider,""));
1236 objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL"),
1238 objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL &"),
1240 objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL *"),
1243 #ifndef LLDB_DISABLE_PYTHON
1244 // we need to skip pointers here since we are special casing a SEL* when retrieving its value
1245 objc_flags.SetSkipPointers(true);
1246 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("SEL"), objc_flags);
1247 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("struct objc_selector"), objc_flags);
1248 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("objc_selector"), objc_flags);
1249 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("objc_selector *"), objc_flags);
1250 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("SEL *"), objc_flags);
1252 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCClassSummaryProvider, "Class summary provider", ConstString("Class"), objc_flags);
1254 SyntheticChildren::Flags class_synth_flags;
1255 class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
1257 AddCXXSynthetic(objc_category_sp, lldb_private::formatters::ObjCClassSyntheticFrontEndCreator, "Class synthetic children", ConstString("Class"), class_synth_flags);
1258 #endif // LLDB_DISABLE_PYTHON
1260 objc_flags.SetSkipPointers(false);
1261 objc_flags.SetCascades(true);
1262 objc_flags.SetSkipReferences(false);
1264 AddStringSummary (objc_category_sp,
1265 "${var.__FuncPtr%A}",
1266 ConstString("__block_literal_generic"),
1269 AddStringSummary(corefoundation_category_sp,
1270 "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds",
1271 ConstString("CFGregorianUnits"),
1273 AddStringSummary(corefoundation_category_sp,
1274 "location=${var.location} length=${var.length}",
1275 ConstString("CFRange"),
1278 AddStringSummary(appkit_category_sp,
1279 "location=${var.location}, length=${var.length}",
1280 ConstString("NSRange"),
1282 AddStringSummary(appkit_category_sp,
1283 "(${var.origin}, ${var.size}), ...",
1284 ConstString("NSRectArray"),
1287 AddOneLineSummary (appkit_category_sp,
1288 ConstString("NSPoint"),
1290 AddOneLineSummary (appkit_category_sp,
1291 ConstString("NSSize"),
1293 AddOneLineSummary (appkit_category_sp,
1294 ConstString("NSRect"),
1297 AddOneLineSummary (coregraphics_category_sp,
1298 ConstString("CGSize"),
1300 AddOneLineSummary (coregraphics_category_sp,
1301 ConstString("CGPoint"),
1303 AddOneLineSummary (coregraphics_category_sp,
1304 ConstString("CGRect"),
1307 AddStringSummary(coreservices_category_sp,
1308 "red=${var.red} green=${var.green} blue=${var.blue}",
1309 ConstString("RGBColor"),
1311 AddStringSummary(coreservices_category_sp,
1312 "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
1313 ConstString("Rect"),
1315 AddStringSummary(coreservices_category_sp,
1316 "(v=${var.v}, h=${var.h})",
1317 ConstString("Point"),
1319 AddStringSummary(coreservices_category_sp,
1320 "${var.month}/${var.day}/${var.year} ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
1321 ConstString("DateTimeRect *"),
1323 AddStringSummary(coreservices_category_sp,
1324 "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}",
1325 ConstString("LongDateRect"),
1327 AddStringSummary(coreservices_category_sp,
1328 "(x=${var.x}, y=${var.y})",
1329 ConstString("HIPoint"),
1331 AddStringSummary(coreservices_category_sp,
1332 "origin=${var.origin} size=${var.size}",
1333 ConstString("HIRect"),
1336 TypeSummaryImpl::Flags appkit_flags;
1337 appkit_flags.SetCascades(true)
1338 .SetSkipPointers(false)
1339 .SetSkipReferences(false)
1340 .SetDontShowChildren(true)
1341 .SetDontShowValue(false)
1342 .SetShowMembersOneLiner(false)
1343 .SetHideItemNames(false);
1345 appkit_flags.SetDontShowChildren(false);
1348 #ifndef LLDB_DISABLE_PYTHON
1349 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags);
1350 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
1351 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
1352 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
1353 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
1354 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
1355 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags);
1357 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags);
1358 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSMutableDictionary"), appkit_flags);
1359 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags);
1360 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags);
1361 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags);
1362 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags);
1363 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags);
1365 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSSet summary", ConstString("NSSet"), appkit_flags);
1366 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
1367 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFSetRef summary", ConstString("CFSetRef"), appkit_flags);
1368 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags);
1369 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags);
1370 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetI summary", ConstString("__NSSetI"), appkit_flags);
1371 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetM summary", ConstString("__NSSetM"), appkit_flags);
1372 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags);
1373 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
1374 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSOrderedSet summary", ConstString("NSOrderedSet"), appkit_flags);
1375 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetI summary", ConstString("__NSOrderedSetI"), appkit_flags);
1376 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetM summary", ConstString("__NSOrderedSetM"), appkit_flags);
1378 // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}", ConstString("$_lldb_typegen_nspair"), appkit_flags);
1380 appkit_flags.SetDontShowChildren(true);
1382 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags());
1383 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags());
1384 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags());
1385 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags());
1386 AddCXXSynthetic(corefoundation_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags());
1387 AddCXXSynthetic(corefoundation_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags());
1388 AddCXXSynthetic(corefoundation_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFArrayRef"), ScriptedSyntheticChildren::Flags());
1390 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags());
1391 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags());
1392 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSCFDictionary"), ScriptedSyntheticChildren::Flags());
1393 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags());
1394 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags());
1395 AddCXXSynthetic(corefoundation_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags());
1396 AddCXXSynthetic(corefoundation_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags());
1398 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("NSSet"), ScriptedSyntheticChildren::Flags());
1399 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetI synthetic children", ConstString("__NSSetI"), ScriptedSyntheticChildren::Flags());
1400 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetM synthetic children", ConstString("__NSSetM"), ScriptedSyntheticChildren::Flags());
1401 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSMutableSet synthetic children", ConstString("NSMutableSet"), ScriptedSyntheticChildren::Flags());
1402 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSOrderedSet synthetic children", ConstString("NSOrderedSet"), ScriptedSyntheticChildren::Flags());
1403 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetI synthetic children", ConstString("__NSOrderedSetI"), ScriptedSyntheticChildren::Flags());
1404 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetM synthetic children", ConstString("__NSOrderedSetM"), ScriptedSyntheticChildren::Flags());
1406 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSIndexPathSyntheticFrontEndCreator, "NSIndexPath synthetic children", ConstString("NSIndexPath"), ScriptedSyntheticChildren::Flags());
1408 AddCXXSummary(corefoundation_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFBagRef"), appkit_flags);
1409 AddCXXSummary(corefoundation_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("__CFBag"), appkit_flags);
1410 AddCXXSummary(corefoundation_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("const struct __CFBag"), appkit_flags);
1411 AddCXXSummary(corefoundation_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFMutableBagRef"), appkit_flags);
1413 AddCXXSummary(corefoundation_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("CFBinaryHeapRef"), appkit_flags);
1414 AddCXXSummary(corefoundation_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("__CFBinaryHeap"), appkit_flags);
1416 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
1417 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
1418 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__CFString"), appkit_flags);
1419 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
1420 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags);
1421 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
1422 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
1423 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags);
1424 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags);
1425 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
1427 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSAttributedStringSummaryProvider, "NSAttributedString summary provider", ConstString("NSAttributedString"), appkit_flags);
1428 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSMutableAttributedString"), appkit_flags);
1429 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSConcreteMutableAttributedString"), appkit_flags);
1431 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSBundleSummaryProvider, "NSBundle summary provider", ConstString("NSBundle"), appkit_flags);
1433 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags);
1434 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
1435 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags);
1436 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSMutableData"), appkit_flags);
1437 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
1438 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
1439 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
1441 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMachPortSummaryProvider, "NSMachPort summary provider", ConstString("NSMachPort"), appkit_flags);
1443 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSNotification"), appkit_flags);
1444 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSConcreteNotification"), appkit_flags);
1446 AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags);
1447 AddStringSummary(appkit_category_sp,"name:${var.name%S} reason:${var.reason%S}",ConstString("NSException"),appkit_flags);
1449 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
1450 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "CFNumberRef summary provider", ConstString("CFNumberRef"), appkit_flags);
1451 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
1452 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
1453 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
1454 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
1456 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSDecimalNumber summary provider", ConstString("NSDecimalNumber"), appkit_flags);
1457 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSHost summary provider", ConstString("NSHost"), appkit_flags);
1458 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags);
1459 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags);
1461 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("NSURL"), appkit_flags);
1462 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("CFURLRef"), appkit_flags);
1464 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSDate"), appkit_flags);
1465 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSDate"), appkit_flags);
1466 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSTaggedDate"), appkit_flags);
1467 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags);
1469 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags);
1470 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("CFTimeZoneRef"), appkit_flags);
1471 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags);
1473 // CFAbsoluteTime is actually a double rather than a pointer to an object
1474 // we do not care about the numeric value, since it is probably meaningless to users
1475 appkit_flags.SetDontShowValue(true);
1476 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::CFAbsoluteTimeSummaryProvider, "CFAbsoluteTime summary provider", ConstString("CFAbsoluteTime"), appkit_flags);
1477 appkit_flags.SetDontShowValue(false);
1479 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags);
1480 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSMutableIndexSet"), appkit_flags);
1482 AddStringSummary(corefoundation_category_sp,
1483 "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"",
1484 ConstString("CFGregorianDate"),
1487 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFBitVectorRef"), appkit_flags);
1488 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFMutableBitVectorRef"), appkit_flags);
1489 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFBitVector"), appkit_flags);
1490 AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFMutableBitVector"), appkit_flags);
1491 #endif // LLDB_DISABLE_PYTHON
1493 TypeCategoryImpl::SharedPointer vectors_category_sp = GetCategory(m_vectortypes_category_name);
1495 TypeSummaryImpl::Flags vector_flags;
1496 vector_flags.SetCascades(true)
1497 .SetSkipPointers(true)
1498 .SetSkipReferences(false)
1499 .SetDontShowChildren(true)
1500 .SetDontShowValue(false)
1501 .SetShowMembersOneLiner(true)
1502 .SetHideItemNames(true);
1504 AddStringSummary(vectors_category_sp,
1506 ConstString("builtin_type_vec128"),
1509 AddStringSummary(vectors_category_sp,
1511 ConstString("float [4]"),
1513 AddStringSummary(vectors_category_sp,
1515 ConstString("int32_t [4]"),
1517 AddStringSummary(vectors_category_sp,
1519 ConstString("int16_t [8]"),
1521 AddStringSummary(vectors_category_sp,
1523 ConstString("vDouble"),
1525 AddStringSummary(vectors_category_sp,
1527 ConstString("vFloat"),
1529 AddStringSummary(vectors_category_sp,
1531 ConstString("vSInt8"),
1533 AddStringSummary(vectors_category_sp,
1535 ConstString("vSInt16"),
1537 AddStringSummary(vectors_category_sp,
1539 ConstString("vSInt32"),
1541 AddStringSummary(vectors_category_sp,
1543 ConstString("vUInt16"),
1545 AddStringSummary(vectors_category_sp,
1547 ConstString("vUInt8"),
1549 AddStringSummary(vectors_category_sp,
1551 ConstString("vUInt16"),
1553 AddStringSummary(vectors_category_sp,
1555 ConstString("vUInt32"),
1557 AddStringSummary(vectors_category_sp,
1559 ConstString("vBool32"),
1564 FormatManager::LoadHardcodedFormatters()
1567 // insert code to load formats here
1570 // insert code to load summaries here
1571 m_hardcoded_summaries.push_back(
1572 [](lldb_private::ValueObject& valobj,
1573 lldb::DynamicValueType,
1574 FormatManager&) -> TypeSummaryImpl::SharedPointer {
1575 static CXXFunctionSummaryFormat::SharedPointer formatter_sp(new CXXFunctionSummaryFormat(TypeSummaryImpl::Flags(), lldb_private::formatters::FunctionPointerSummaryProvider, "Function pointer summary provider"));
1576 if (valobj.GetClangType().IsFunctionPointerType())
1578 return formatter_sp;
1584 // insert code to load synthetics here
1587 // insert code to load validators here