FormatManager.cpp revision 39ebb982b3f9de4a15744078e9c6ba231187b5dc
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);stl_summary_flags.SetSkipPointers(true); 569 gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")), 570 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, 571 "size=${svar%#}"))); 572 gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")), 573 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, 574 "size=${svar%#}"))); 575 gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")), 576 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, 577 "size=${svar%#}"))); 578 579 AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibStdcppVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^__gnu_cxx::__normal_iterator<.+>$"), stl_synth_flags, true); 580 581 AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::_Rb_tree_iterator<.+>$"), stl_synth_flags, true); 582 583 gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"), 584 TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}"))); 585 586 gnu_category_sp->GetSyntheticNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"), 587 SyntheticChildrenSP(new CXXSyntheticChildren(stl_synth_flags,"libc++ std::vector<bool> synthetic children",lldb_private::formatters::LibstdcppVectorBoolSyntheticFrontEndCreator))); 588 589#endif 590} 591 592void 593FormatManager::LoadLibcxxFormatters() 594{ 595 TypeSummaryImpl::Flags stl_summary_flags; 596 stl_summary_flags.SetCascades(true) 597 .SetSkipPointers(false) 598 .SetSkipReferences(false) 599 .SetDontShowChildren(true) 600 .SetDontShowValue(true) 601 .SetShowMembersOneLiner(false) 602 .SetHideItemNames(false); 603 604#ifndef LLDB_DISABLE_PYTHON 605 //std::string code(" lldb.formatters.cpp.libcxx.stdstring_SummaryProvider(valobj,internal_dict)"); 606 //lldb::TypeSummaryImplSP std_string_summary_sp(new ScriptSummaryFormat(stl_summary_flags, "lldb.formatters.cpp.libcxx.stdstring_SummaryProvider",code.c_str())); 607 608 lldb::TypeSummaryImplSP std_string_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxStringSummaryProvider, "std::string summary provider")); 609 lldb::TypeSummaryImplSP std_wstring_summary_sp(new CXXFunctionSummaryFormat(stl_summary_flags, lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider")); 610 611 TypeCategoryImpl::SharedPointer libcxx_category_sp = GetCategory(m_libcxx_category_name); 612 613 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::string"), 614 std_string_summary_sp); 615 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"), 616 std_string_summary_sp); 617 618 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::wstring"), 619 std_wstring_summary_sp); 620 libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >"), 621 std_wstring_summary_sp); 622 623 SyntheticChildren::Flags stl_synth_flags; 624 stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false); 625 626 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdVectorSyntheticFrontEndCreator, "libc++ std::vector synthetic children", ConstString("^std::__1::vector<.+>(( )?&)?$"), stl_synth_flags, true); 627 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator, "libc++ std::list synthetic children", ConstString("^std::__1::list<.+>(( )?&)?$"), stl_synth_flags, true); 628 AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::map synthetic children", ConstString("^std::__1::map<.+> >(( )?&)?$"), stl_synth_flags, true); 629 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 774 SyntheticChildren::Flags class_synth_flags; 775 class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false); 776 777 AddCXXSynthetic(objc_category_sp, lldb_private::formatters::ObjCClassSyntheticFrontEndCreator, "Class synthetic children", ConstString("Class"), class_synth_flags); 778#endif // LLDB_DISABLE_PYTHON 779 780 objc_flags.SetSkipPointers(false); 781 782 TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name); 783 784 AddStringSummary(corefoundation_category_sp, 785 "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds", 786 ConstString("CFGregorianUnits"), 787 objc_flags); 788 AddStringSummary(corefoundation_category_sp, 789 "location=${var.location} length=${var.length}", 790 ConstString("CFRange"), 791 objc_flags); 792 AddStringSummary(corefoundation_category_sp, 793 "(x=${var.x}, y=${var.y})", 794 ConstString("NSPoint"), 795 objc_flags); 796 AddStringSummary(corefoundation_category_sp, 797 "location=${var.location}, length=${var.length}", 798 ConstString("NSRange"), 799 objc_flags); 800 AddStringSummary(corefoundation_category_sp, 801 "${var.origin}, ${var.size}", 802 ConstString("NSRect"), 803 objc_flags); 804 AddStringSummary(corefoundation_category_sp, 805 "(${var.origin}, ${var.size}), ...", 806 ConstString("NSRectArray"), 807 objc_flags); 808 AddStringSummary(objc_category_sp, 809 "(width=${var.width}, height=${var.height})", 810 ConstString("NSSize"), 811 objc_flags); 812 813 TypeCategoryImpl::SharedPointer coregraphics_category_sp = GetCategory(m_coregraphics_category_name); 814 815 AddStringSummary(coregraphics_category_sp, 816 "(width=${var.width}, height=${var.height})", 817 ConstString("CGSize"), 818 objc_flags); 819 AddStringSummary(coregraphics_category_sp, 820 "(x=${var.x}, y=${var.y})", 821 ConstString("CGPoint"), 822 objc_flags); 823 AddStringSummary(coregraphics_category_sp, 824 "origin=${var.origin} size=${var.size}", 825 ConstString("CGRect"), 826 objc_flags); 827 828 TypeCategoryImpl::SharedPointer coreservices_category_sp = GetCategory(m_coreservices_category_name); 829 830 AddStringSummary(coreservices_category_sp, 831 "red=${var.red} green=${var.green} blue=${var.blue}", 832 ConstString("RGBColor"), 833 objc_flags); 834 AddStringSummary(coreservices_category_sp, 835 "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})", 836 ConstString("Rect"), 837 objc_flags); 838 AddStringSummary(coreservices_category_sp, 839 "(v=${var.v}, h=${var.h})", 840 ConstString("Point"), 841 objc_flags); 842 AddStringSummary(coreservices_category_sp, 843 "${var.month}/${var.day}/${var.year} ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}", 844 ConstString("DateTimeRect *"), 845 objc_flags); 846 AddStringSummary(coreservices_category_sp, 847 "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}", 848 ConstString("LongDateRect"), 849 objc_flags); 850 AddStringSummary(coreservices_category_sp, 851 "(x=${var.x}, y=${var.y})", 852 ConstString("HIPoint"), 853 objc_flags); 854 AddStringSummary(coreservices_category_sp, 855 "origin=${var.origin} size=${var.size}", 856 ConstString("HIRect"), 857 objc_flags); 858 859 TypeCategoryImpl::SharedPointer appkit_category_sp = GetCategory(m_appkit_category_name); 860 861 TypeSummaryImpl::Flags appkit_flags; 862 appkit_flags.SetCascades(true) 863 .SetSkipPointers(false) 864 .SetSkipReferences(false) 865 .SetDontShowChildren(true) 866 .SetDontShowValue(false) 867 .SetShowMembersOneLiner(false) 868 .SetHideItemNames(false); 869 870 appkit_flags.SetDontShowChildren(false); 871 872 873#ifndef LLDB_DISABLE_PYTHON 874 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags); 875 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags); 876 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags); 877 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags); 878 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags); 879 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags); 880 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags); 881 882 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags); 883 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSMutableDictionary"), appkit_flags); 884 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags); 885 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags); 886 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags); 887 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags); 888 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags); 889 890 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSSet summary", ConstString("NSSet"), appkit_flags); 891 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFSetRef summary", ConstString("CFSetRef"), appkit_flags); 892 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags); 893 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags); 894 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetI summary", ConstString("__NSSetI"), appkit_flags); 895 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetM summary", ConstString("__NSSetM"), appkit_flags); 896 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags); 897 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSSet summary", ConstString("NSMutableSet"), appkit_flags); 898 899 // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}", ConstString("$_lldb_typegen_nspair"), appkit_flags); 900 901 appkit_flags.SetDontShowChildren(true); 902 903 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags()); 904 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags()); 905 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags()); 906 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags()); 907 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags()); 908 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags()); 909 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFArrayRef"), ScriptedSyntheticChildren::Flags()); 910 911 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags()); 912 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags()); 913 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags()); 914 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags()); 915 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags()); 916 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags()); 917 918 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("NSSet"), ScriptedSyntheticChildren::Flags()); 919 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("__NSSetI"), ScriptedSyntheticChildren::Flags()); 920 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("__NSSetM"), ScriptedSyntheticChildren::Flags()); 921 AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("NSMutableSet"), ScriptedSyntheticChildren::Flags()); 922 923 AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFBagRef"), appkit_flags); 924 AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("__CFBag"), appkit_flags); 925 AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("const struct __CFBag"), appkit_flags); 926 AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFMutableBagRef"), appkit_flags); 927 928 AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("CFBinaryHeapRef"), appkit_flags); 929 AddCXXSummary(appkit_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("__CFBinaryHeap"), appkit_flags); 930 931 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags); 932 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags); 933 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags); 934 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags); 935 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags); 936 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags); 937 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags); 938 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags); 939 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags); 940 941 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSAttributedStringSummaryProvider, "NSAttributedString summary provider", ConstString("NSAttributedString"), appkit_flags); 942 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSMutableAttributedString"), appkit_flags); 943 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSConcreteMutableAttributedString"), appkit_flags); 944 945 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSBundleSummaryProvider, "NSBundle summary provider", ConstString("NSBundle"), appkit_flags); 946 947 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags); 948 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags); 949 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags); 950 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags); 951 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags); 952 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags); 953 954 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMachPortSummaryProvider, "NSMachPort summary provider", ConstString("NSMachPort"), appkit_flags); 955 956 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSNotification"), appkit_flags); 957 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSConcreteNotification"), appkit_flags); 958 959 AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags); 960 AddStringSummary(appkit_category_sp,"name:${var.name%S} reason:${var.reason%S}",ConstString("NSException"),appkit_flags); 961 962 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags); 963 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags); 964 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags); 965 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags); 966 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags); 967 968 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSDecimalNumber summary provider", ConstString("NSDecimalNumber"), appkit_flags); 969 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSHost summary provider", ConstString("NSHost"), appkit_flags); 970 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags); 971 AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags); 972 973 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("NSURL"), appkit_flags); 974 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("CFURLRef"), appkit_flags); 975 976 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSDate"), appkit_flags); 977 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSDate"), appkit_flags); 978 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSTaggedDate"), appkit_flags); 979 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags); 980 981 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags); 982 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("CFTimeZoneRef"), appkit_flags); 983 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags); 984 985 // CFAbsoluteTime is actually a double rather than a pointer to an object 986 // we do not care about the numeric value, since it is probably meaningless to users 987 appkit_flags.SetDontShowValue(true); 988 AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFAbsoluteTimeSummaryProvider, "CFAbsoluteTime summary provider", ConstString("CFAbsoluteTime"), appkit_flags); 989 appkit_flags.SetDontShowValue(false); 990 991 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags); 992 AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSMutableIndexSet"), appkit_flags); 993 994 AddStringSummary(appkit_category_sp, 995 "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"", 996 ConstString("CFGregorianDate"), 997 appkit_flags); 998 999 AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFBitVectorRef"), appkit_flags); 1000 AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFMutableBitVectorRef"), appkit_flags); 1001 AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFBitVector"), appkit_flags); 1002 AddCXXSummary(appkit_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFMutableBitVector"), appkit_flags); 1003#endif // LLDB_DISABLE_PYTHON 1004 1005 TypeCategoryImpl::SharedPointer vectors_category_sp = GetCategory(m_vectortypes_category_name); 1006 1007 TypeSummaryImpl::Flags vector_flags; 1008 vector_flags.SetCascades(true) 1009 .SetSkipPointers(true) 1010 .SetSkipReferences(false) 1011 .SetDontShowChildren(true) 1012 .SetDontShowValue(false) 1013 .SetShowMembersOneLiner(true) 1014 .SetHideItemNames(true); 1015 1016 AddStringSummary(vectors_category_sp, 1017 "${var.uint128}", 1018 ConstString("builtin_type_vec128"), 1019 objc_flags); 1020 1021 AddStringSummary(vectors_category_sp, 1022 "", 1023 ConstString("float [4]"), 1024 vector_flags); 1025 AddStringSummary(vectors_category_sp, 1026 "", 1027 ConstString("int32_t [4]"), 1028 vector_flags); 1029 AddStringSummary(vectors_category_sp, 1030 "", 1031 ConstString("int16_t [8]"), 1032 vector_flags); 1033 AddStringSummary(vectors_category_sp, 1034 "", 1035 ConstString("vDouble"), 1036 vector_flags); 1037 AddStringSummary(vectors_category_sp, 1038 "", 1039 ConstString("vFloat"), 1040 vector_flags); 1041 AddStringSummary(vectors_category_sp, 1042 "", 1043 ConstString("vSInt8"), 1044 vector_flags); 1045 AddStringSummary(vectors_category_sp, 1046 "", 1047 ConstString("vSInt16"), 1048 vector_flags); 1049 AddStringSummary(vectors_category_sp, 1050 "", 1051 ConstString("vSInt32"), 1052 vector_flags); 1053 AddStringSummary(vectors_category_sp, 1054 "", 1055 ConstString("vUInt16"), 1056 vector_flags); 1057 AddStringSummary(vectors_category_sp, 1058 "", 1059 ConstString("vUInt8"), 1060 vector_flags); 1061 AddStringSummary(vectors_category_sp, 1062 "", 1063 ConstString("vUInt16"), 1064 vector_flags); 1065 AddStringSummary(vectors_category_sp, 1066 "", 1067 ConstString("vUInt32"), 1068 vector_flags); 1069 AddStringSummary(vectors_category_sp, 1070 "", 1071 ConstString("vBool32"), 1072 vector_flags); 1073} 1074