FormatManager.cpp revision ea68753ef4b8cca81cf3f5aef7bbf1ebb152a832
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 LogSP 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 LogSP 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{ 448 lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, 449 string)); 450 category_sp->GetSummaryNavigator()->Add(type_name, 451 summary_sp); 452} 453 454#ifndef LLDB_DISABLE_PYTHON 455static void 456AddScriptSummary(TypeCategoryImpl::SharedPointer category_sp, 457 const char* funct_name, 458 ConstString type_name, 459 TypeSummaryImpl::Flags flags) 460{ 461 462 std::string code(" "); 463 code.append(funct_name).append("(valobj,internal_dict)"); 464 465 lldb::TypeSummaryImplSP summary_sp(new ScriptSummaryFormat(flags, 466 funct_name, 467 code.c_str())); 468 category_sp->GetSummaryNavigator()->Add(type_name, 469 summary_sp); 470} 471#endif 472 473#ifndef LLDB_DISABLE_PYTHON 474static void 475AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp, 476 CXXFunctionSummaryFormat::Callback funct, 477 const char* description, 478 ConstString type_name, 479 TypeSummaryImpl::Flags flags) 480{ 481 lldb::TypeSummaryImplSP summary_sp(new CXXFunctionSummaryFormat(flags,funct,description)); 482 category_sp->GetSummaryNavigator()->Add(type_name, 483 summary_sp); 484} 485#endif 486 487#ifndef LLDB_DISABLE_PYTHON 488static void AddCXXSynthetic (TypeCategoryImpl::SharedPointer category_sp, 489 CXXSyntheticChildren::CreateFrontEndCallback generator, 490 const char* description, 491 ConstString type_name, 492 ScriptedSyntheticChildren::Flags flags) 493{ 494 lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator)); 495 category_sp->GetSyntheticNavigator()->Add(type_name,synth_sp); 496} 497#endif 498 499void 500FormatManager::LoadLibStdcppFormatters() 501{ 502 TypeSummaryImpl::Flags stl_summary_flags; 503 stl_summary_flags.SetCascades(true) 504 .SetSkipPointers(false) 505 .SetSkipReferences(false) 506 .SetDontShowChildren(true) 507 .SetDontShowValue(true) 508 .SetShowMembersOneLiner(false) 509 .SetHideItemNames(false); 510 511 lldb::TypeSummaryImplSP std_string_summary_sp(new StringSummaryFormat(stl_summary_flags, 512 "${var._M_dataplus._M_p}")); 513 514 TypeCategoryImpl::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name); 515 516 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::string"), 517 std_string_summary_sp); 518 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char>"), 519 std_string_summary_sp); 520 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"), 521 std_string_summary_sp); 522 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"), 523 std_string_summary_sp); 524 525 // making sure we force-pick the summary for printing wstring (_M_p is a wchar_t*) 526 lldb::TypeSummaryImplSP std_wstring_summary_sp(new StringSummaryFormat(stl_summary_flags, 527 "${var._M_dataplus._M_p%S}")); 528 529 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::wstring"), 530 std_wstring_summary_sp); 531 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t>"), 532 std_wstring_summary_sp); 533 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >"), 534 std_wstring_summary_sp); 535 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >"), 536 std_wstring_summary_sp); 537 538 539#ifndef LLDB_DISABLE_PYTHON 540 541 SyntheticChildren::Flags stl_synth_flags; 542 stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false); 543 544 gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")), 545 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 546 "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider"))); 547 gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")), 548 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 549 "lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider"))); 550 gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")), 551 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 552 "lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider"))); 553 554 stl_summary_flags.SetDontShowChildren(false); 555 gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")), 556 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, 557 "size=${svar%#}"))); 558 gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")), 559 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, 560 "size=${svar%#}"))); 561 gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")), 562 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, 563 "size=${svar%#}"))); 564 565 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"), 566 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}"))); 567 568 gnu_category_sp->GetSyntheticNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"), 569 SyntheticChildrenSP(new CXXSyntheticChildren(stl_synth_flags,"libc++ std::vector<bool> synthetic children",lldb_private::formatters::LibstdcppVectorBoolSyntheticFrontEndCreator))); 570 571#endif 572} 573 574void 575FormatManager::LoadLibcxxFormatters() 576{ 577 TypeSummaryImpl::Flags stl_summary_flags; 578 stl_summary_flags.SetCascades(true) 579 .SetSkipPointers(false) 580 .SetSkipReferences(false) 581 .SetDontShowChildren(true) 582 .SetDontShowValue(true) 583 .SetShowMembersOneLiner(false) 584 .SetHideItemNames(false); 585 586#ifndef LLDB_DISABLE_PYTHON 587 //std::string code(" lldb.formatters.cpp.libcxx.stdstring_SummaryProvider(valobj,internal_dict)"); 588 //lldb::TypeSummaryImplSP std_string_summary_sp(new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.libcxx.stdstring_SummaryProvider",code.c_str())); 589 590 lldb::TypeSummaryImplSP std_string_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxStringSummaryProvider, "std::string summary provider")); 591 lldb::TypeSummaryImplSP std_wstring_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider")); 592 593 TypeCategoryImpl::SharedPointer libcxx_category_sp = GetCategory(m_libcxx_category_name); 594 595 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::string"), 596 std_string_summary_sp); 597 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"), 598 std_string_summary_sp); 599 600 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::wstring"), 601 std_wstring_summary_sp); 602 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >"), 603 std_wstring_summary_sp); 604 605 SyntheticChildren::Flags stl_synth_flags; 606 stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false); 607 608 libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::vector<.+>(( )?&)?$")), 609 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 610 "lldb.formatters.cpp.libcxx.stdvector_SynthProvider"))); 611 libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::list<.+>(( )?&)?$")), 612 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 613 "lldb.formatters.cpp.libcxx.stdlist_SynthProvider"))); 614 libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::map<.+> >(( )?&)?$")), 615 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 616 "lldb.formatters.cpp.libcxx.stdmap_SynthProvider"))); 617 libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")), 618 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 619 "lldb.formatters.cpp.libcxx.stddeque_SynthProvider"))); 620 libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)shared_ptr<.+>(( )?&)?$")), 621 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 622 "lldb.formatters.cpp.libcxx.stdsharedptr_SynthProvider"))); 623 libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)weak_ptr<.+>(( )?&)?$")), 624 SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags, 625 "lldb.formatters.cpp.libcxx.stdsharedptr_SynthProvider"))); 626 627 stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true); 628 libcxx_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::vector<.+>(( )?&)?$")), 629 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}"))); 630 libcxx_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::list<.+>(( )?&)?$")), 631 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}"))); 632 libcxx_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::map<.+> >(( )?&)?$")), 633 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}"))); 634 libcxx_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::deque<.+>(( )?&)?$")), 635 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}"))); 636 libcxx_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::shared_ptr<.+>(( )?&)?$")), 637 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})"))); 638 libcxx_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::weak_ptr<.+>(( )?&)?$")), 639 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})"))); 640 641 // this summary prevails on the regex std::vector<> because we do exact matches before regex ones 642 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::vector<std::__1::allocator<bool> >"), 643 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}"))); 644 645 libcxx_category_sp->GetSyntheticNavigator()->Add(ConstString("std::__1::vector<std::__1::allocator<bool> >"), 646 SyntheticChildrenSP(new CXXSyntheticChildren(stl_synth_flags,"libc++ std::vector<bool> synthetic children",lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEndCreator))); 647 648#endif 649} 650 651void 652FormatManager::LoadSystemFormatters() 653{ 654 655 TypeSummaryImpl::Flags string_flags; 656 string_flags.SetCascades(false) 657 .SetSkipPointers(true) 658 .SetSkipReferences(false) 659 .SetDontShowChildren(true) 660 .SetDontShowValue(false) 661 .SetShowMembersOneLiner(false) 662 .SetHideItemNames(false); 663 664 lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(string_flags, "${var%s}")); 665 666 667 lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false) 668 .SetSkipPointers(true) 669 .SetSkipReferences(false) 670 .SetDontShowChildren(false) 671 .SetDontShowValue(true) 672 .SetShowMembersOneLiner(false) 673 .SetHideItemNames(false), 674 "${var%s}")); 675 676 lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]")); 677 678 TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name); 679 680 sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format); 681 sys_category_sp->GetSummaryNavigator()->Add(ConstString("const char *"), string_format); 682 sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format); 683 684 lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false) 685 .SetSkipPointers(true) 686 .SetSkipReferences(true) 687 .SetDontShowChildren(true) 688 .SetDontShowValue(false) 689 .SetShowMembersOneLiner(false) 690 .SetHideItemNames(false), 691 "${var%O}")); 692 693 sys_category_sp->GetSummaryNavigator()->Add(ConstString("OSType"), ostype_summary); 694 695#ifndef LLDB_DISABLE_PYTHON 696 // FIXME because of a bug in the FormatNavigator we need to add a summary for both X* and const X* (<rdar://problem/12717717>) 697 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("char16_t *"), string_flags); 698 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("const char16_t *"), string_flags); 699 700 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags); 701 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("const char32_t *"), string_flags); 702 703 AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t *"), string_flags); 704 AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("const wchar_t *"), string_flags); 705 706 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("unichar *"), string_flags); 707 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("const unichar *"), string_flags); 708 709 TypeSummaryImpl::Flags widechar_flags; 710 widechar_flags.SetDontShowValue(true) 711 .SetSkipPointers(true) 712 .SetSkipReferences(false) 713 .SetCascades(true) 714 .SetDontShowChildren(true) 715 .SetHideItemNames(true) 716 .SetShowMembersOneLiner(false); 717 718 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "char16_t summary provider", ConstString("char16_t"), widechar_flags); 719 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32SummaryProvider, "char32_t summary provider", ConstString("char32_t"), widechar_flags); 720 AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharSummaryProvider, "wchar_t summary provider", ConstString("wchar_t"), widechar_flags); 721 722 AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16SummaryProvider, "unichar summary provider", ConstString("unichar"), widechar_flags); 723 724#endif 725} 726 727void 728FormatManager::LoadObjCFormatters() 729{ 730 TypeSummaryImpl::Flags objc_flags; 731 objc_flags.SetCascades(false) 732 .SetSkipPointers(true) 733 .SetSkipReferences(true) 734 .SetDontShowChildren(true) 735 .SetDontShowValue(true) 736 .SetShowMembersOneLiner(false) 737 .SetHideItemNames(false); 738 739 TypeCategoryImpl::SharedPointer objc_category_sp = GetCategory(m_objc_category_name); 740 741 lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider,"")); 742 objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL"), 743 ObjC_BOOL_summary); 744 objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL &"), 745 ObjC_BOOL_summary); 746 objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL *"), 747 ObjC_BOOL_summary); 748 749#ifndef LLDB_DISABLE_PYTHON 750 // we need to skip pointers here since we are special casing a SEL* when retrieving its value 751 objc_flags.SetSkipPointers(true); 752 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("SEL"), objc_flags); 753 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("struct objc_selector"), objc_flags); 754 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("objc_selector"), objc_flags); 755 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("objc_selector *"), objc_flags); 756 AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("SEL *"), objc_flags); 757 758 AddScriptSummary(objc_category_sp, "lldb.formatters.objc.Class.Class_Summary", ConstString("Class"), objc_flags); 759#endif // LLDB_DISABLE_PYTHON 760 761 objc_flags.SetSkipPointers(false); 762 763 TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name); 764 765 AddStringSummary(corefoundation_category_sp, 766 "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds", 767 ConstString("CFGregorianUnits"), 768 objc_flags); 769 AddStringSummary(corefoundation_category_sp, 770 "location=${var.location} length=${var.length}", 771 ConstString("CFRange"), 772 objc_flags); 773 AddStringSummary(corefoundation_category_sp, 774 "(x=${var.x}, y=${var.y})", 775 ConstString("NSPoint"), 776 objc_flags); 777 AddStringSummary(corefoundation_category_sp, 778 "location=${var.location}, length=${var.length}", 779 ConstString("NSRange"), 780 objc_flags); 781 AddStringSummary(corefoundation_category_sp, 782 "${var.origin}, ${var.size}", 783 ConstString("NSRect"), 784 objc_flags); 785 AddStringSummary(corefoundation_category_sp, 786 "(${var.origin}, ${var.size}), ...", 787 ConstString("NSRectArray"), 788 objc_flags); 789 AddStringSummary(objc_category_sp, 790 "(width=${var.width}, height=${var.height})", 791 ConstString("NSSize"), 792 objc_flags); 793 794 TypeCategoryImpl::SharedPointer coregraphics_category_sp = GetCategory(m_coregraphics_category_name); 795 796 AddStringSummary(coregraphics_category_sp, 797 "(width=${var.width}, height=${var.height})", 798 ConstString("CGSize"), 799 objc_flags); 800 AddStringSummary(coregraphics_category_sp, 801 "(x=${var.x}, y=${var.y})", 802 ConstString("CGPoint"), 803 objc_flags); 804 AddStringSummary(coregraphics_category_sp, 805 "origin=${var.origin} size=${var.size}", 806 ConstString("CGRect"), 807 objc_flags); 808 809 TypeCategoryImpl::SharedPointer coreservices_category_sp = GetCategory(m_coreservices_category_name); 810 811 AddStringSummary(coreservices_category_sp, 812 "red=${var.red} green=${var.green} blue=${var.blue}", 813 ConstString("RGBColor"), 814 objc_flags); 815 AddStringSummary(coreservices_category_sp, 816 "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})", 817 ConstString("Rect"), 818 objc_flags); 819 AddStringSummary(coreservices_category_sp, 820 "(v=${var.v}, h=${var.h})", 821 ConstString("Point"), 822 objc_flags); 823 AddStringSummary(coreservices_category_sp, 824 "${var.month}/${var.day}/${var.year} ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}", 825 ConstString("DateTimeRect *"), 826 objc_flags); 827 AddStringSummary(coreservices_category_sp, 828 "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}", 829 ConstString("LongDateRect"), 830 objc_flags); 831 AddStringSummary(coreservices_category_sp, 832 "(x=${var.x}, y=${var.y})", 833 ConstString("HIPoint"), 834 objc_flags); 835 AddStringSummary(coreservices_category_sp, 836 "origin=${var.origin} size=${var.size}", 837 ConstString("HIRect"), 838 objc_flags); 839 840 TypeCategoryImpl::SharedPointer appkit_category_sp = GetCategory(m_appkit_category_name); 841 842 TypeSummaryImpl::Flags appkit_flags; 843 appkit_flags.SetCascades(true) 844 .SetSkipPointers(false) 845 .SetSkipReferences(false) 846 .SetDontShowChildren(true) 847 .SetDontShowValue(false) 848 .SetShowMembersOneLiner(false) 849 .SetHideItemNames(false); 850 851 appkit_flags.SetDontShowChildren(false); 852 853 854#ifndef LLDB_DISABLE_PYTHON 855 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags); 856 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags); 857 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags); 858 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags); 859 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags); 860 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags); 861 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags); 862 863 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags); 864 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSMutableDictionary"), appkit_flags); 865 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags); 866 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags); 867 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags); 868 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags); 869 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags); 870 871 // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}", ConstString("$_lldb_typegen_nspair"), appkit_flags); 872 873 appkit_flags.SetDontShowChildren(true); 874 875 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags()); 876 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags()); 877 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags()); 878 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags()); 879 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags()); 880 881 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags()); 882 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags()); 883 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags()); 884 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags()); 885 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags()); 886 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags()); 887 888 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("CFBagRef"), appkit_flags); 889 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("__CFBag"), appkit_flags); 890 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("const struct __CFBag"), appkit_flags); 891 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("CFMutableBagRef"), appkit_flags); 892 893 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBinaryHeap.CFBinaryHeap_SummaryProvider", ConstString("CFBinaryHeapRef"), appkit_flags); 894 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBinaryHeap.CFBinaryHeap_SummaryProvider", ConstString("__CFBinaryHeap"), appkit_flags); 895 896 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags); 897 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags); 898 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags); 899 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags); 900 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags); 901 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags); 902 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags); 903 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags); 904 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags); 905 906 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSAttributedStringSummaryProvider, "NSAttributedString summary provider", ConstString("NSAttributedString"), appkit_flags); 907 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSMutableAttributedString"), appkit_flags); 908 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSConcreteMutableAttributedString"), appkit_flags); 909 910 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSBundle.NSBundle_SummaryProvider", ConstString("NSBundle"), appkit_flags); 911 912 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags); 913 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags); 914 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags); 915 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags); 916 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags); 917 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags); 918 919 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSMachPort.NSMachPort_SummaryProvider", ConstString("NSMachPort"), appkit_flags); 920 921 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSNotification"), appkit_flags); 922 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSConcreteNotification"), appkit_flags); 923 924 AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags); 925 AddStringSummary(appkit_category_sp,"name:${var.name%S} reason:${var.reason%S}",ConstString("NSException"),appkit_flags); 926 927 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags); 928 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags); 929 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags); 930 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags); 931 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags); 932 933 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSDecimalNumber summary provider", ConstString("NSDecimalNumber"), appkit_flags); 934 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSHost summary provider", ConstString("NSHost"), appkit_flags); 935 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags); 936 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags); 937 938 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSSet summary", ConstString("NSSet"), appkit_flags); 939 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFSetRef summary", ConstString("CFSetRef"), appkit_flags); 940 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags); 941 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags); 942 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetI summary", ConstString("__NSSetI"), appkit_flags); 943 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetM summary", ConstString("__NSSetM"), appkit_flags); 944 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags); 945 946 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("NSURL"), appkit_flags); 947 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("CFURLRef"), appkit_flags); 948 949 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.NSDate_SummaryProvider", ConstString("NSDate"), appkit_flags); 950 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.NSDate_SummaryProvider", ConstString("__NSDate"), appkit_flags); 951 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.NSDate_SummaryProvider", ConstString("__NSTaggedDate"), appkit_flags); 952 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.NSDate_SummaryProvider", ConstString("NSCalendarDate"), appkit_flags); 953 954 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.NSTimeZone_SummaryProvider", ConstString("NSTimeZone"), appkit_flags); 955 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.NSTimeZone_SummaryProvider", ConstString("CFTimeZoneRef"), appkit_flags); 956 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.NSTimeZone_SummaryProvider", ConstString("__NSTimeZone"), appkit_flags); 957 958 // CFAbsoluteTime is actually a double rather than a pointer to an object 959 // we do not care about the numeric value, since it is probably meaningless to users 960 appkit_flags.SetDontShowValue(true); 961 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSDate.CFAbsoluteTime_SummaryProvider", ConstString("CFAbsoluteTime"), appkit_flags); 962 appkit_flags.SetDontShowValue(false); 963 964 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSIndexSet.NSIndexSet_SummaryProvider", ConstString("NSIndexSet"), appkit_flags); 965 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSIndexSet.NSIndexSet_SummaryProvider", ConstString("NSMutableIndexSet"), appkit_flags); 966 967 AddStringSummary(appkit_category_sp, 968 "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"", 969 ConstString("CFGregorianDate"), 970 appkit_flags); 971 972 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBitVector.CFBitVector_SummaryProvider", ConstString("CFBitVectorRef"), appkit_flags); 973 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBitVector.CFBitVector_SummaryProvider", ConstString("CFMutableBitVectorRef"), appkit_flags); 974 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBitVector.CFBitVector_SummaryProvider", ConstString("__CFBitVector"), appkit_flags); 975 AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBitVector.CFBitVector_SummaryProvider", ConstString("__CFMutableBitVector"), appkit_flags); 976#endif // LLDB_DISABLE_PYTHON 977 978 TypeCategoryImpl::SharedPointer vectors_category_sp = GetCategory(m_vectortypes_category_name); 979 980 TypeSummaryImpl::Flags vector_flags; 981 vector_flags.SetCascades(true) 982 .SetSkipPointers(true) 983 .SetSkipReferences(false) 984 .SetDontShowChildren(true) 985 .SetDontShowValue(false) 986 .SetShowMembersOneLiner(true) 987 .SetHideItemNames(true); 988 989 AddStringSummary(vectors_category_sp, 990 "${var.uint128}", 991 ConstString("builtin_type_vec128"), 992 objc_flags); 993 994 AddStringSummary(vectors_category_sp, 995 "", 996 ConstString("float [4]"), 997 vector_flags); 998 AddStringSummary(vectors_category_sp, 999 "", 1000 ConstString("int32_t [4]"), 1001 vector_flags); 1002 AddStringSummary(vectors_category_sp, 1003 "", 1004 ConstString("int16_t [8]"), 1005 vector_flags); 1006 AddStringSummary(vectors_category_sp, 1007 "", 1008 ConstString("vDouble"), 1009 vector_flags); 1010 AddStringSummary(vectors_category_sp, 1011 "", 1012 ConstString("vFloat"), 1013 vector_flags); 1014 AddStringSummary(vectors_category_sp, 1015 "", 1016 ConstString("vSInt8"), 1017 vector_flags); 1018 AddStringSummary(vectors_category_sp, 1019 "", 1020 ConstString("vSInt16"), 1021 vector_flags); 1022 AddStringSummary(vectors_category_sp, 1023 "", 1024 ConstString("vSInt32"), 1025 vector_flags); 1026 AddStringSummary(vectors_category_sp, 1027 "", 1028 ConstString("vUInt16"), 1029 vector_flags); 1030 AddStringSummary(vectors_category_sp, 1031 "", 1032 ConstString("vUInt8"), 1033 vector_flags); 1034 AddStringSummary(vectors_category_sp, 1035 "", 1036 ConstString("vUInt16"), 1037 vector_flags); 1038 AddStringSummary(vectors_category_sp, 1039 "", 1040 ConstString("vUInt32"), 1041 vector_flags); 1042 AddStringSummary(vectors_category_sp, 1043 "", 1044 ConstString("vBool32"), 1045 vector_flags); 1046} 1047