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