1 //===-- DataVisualization.h -------------------------------------*- 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 #ifndef lldb_DataVisualization_h_ 11 #define lldb_DataVisualization_h_ 12 13 14 #include "lldb/DataFormatters/FormatClasses.h" 15 #include "lldb/DataFormatters/FormatManager.h" 16 #include "lldb/Utility/ConstString.h" 17 18 namespace lldb_private { 19 20 // this class is the high-level front-end of LLDB Data Visualization code in 21 // FormatManager.h/cpp is the low-level implementation of this feature clients 22 // should refer to this class as the entry-point into the data formatters 23 // unless they have a good reason to bypass this and go to the backend 24 class DataVisualization { 25 public: 26 // use this call to force the FM to consider itself updated even when there 27 // is no apparent reason for that 28 static void ForceUpdate(); 29 30 static uint32_t GetCurrentRevision(); 31 32 static bool ShouldPrintAsOneLiner(ValueObject &valobj); 33 34 static lldb::TypeFormatImplSP GetFormat(ValueObject &valobj, 35 lldb::DynamicValueType use_dynamic); 36 37 static lldb::TypeFormatImplSP 38 GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp); 39 40 static lldb::TypeSummaryImplSP 41 GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic); 42 43 static lldb::TypeSummaryImplSP 44 GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp); 45 46 #ifndef LLDB_DISABLE_PYTHON 47 static lldb::SyntheticChildrenSP 48 GetSyntheticChildrenForType(lldb::TypeNameSpecifierImplSP type_sp); 49 #endif 50 51 static lldb::TypeFilterImplSP 52 GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp); 53 54 #ifndef LLDB_DISABLE_PYTHON 55 static lldb::ScriptedSyntheticChildrenSP 56 GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp); 57 #endif 58 59 #ifndef LLDB_DISABLE_PYTHON 60 static lldb::SyntheticChildrenSP 61 GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic); 62 #endif 63 64 static lldb::TypeValidatorImplSP 65 GetValidator(ValueObject &valobj, lldb::DynamicValueType use_dynamic); 66 67 static lldb::TypeValidatorImplSP 68 GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp); 69 70 static bool 71 AnyMatches(ConstString type_name, 72 TypeCategoryImpl::FormatCategoryItems items = 73 TypeCategoryImpl::ALL_ITEM_TYPES, 74 bool only_enabled = true, const char **matching_category = nullptr, 75 TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr); 76 77 class NamedSummaryFormats { 78 public: 79 static bool GetSummaryFormat(const ConstString &type, 80 lldb::TypeSummaryImplSP &entry); 81 82 static void Add(const ConstString &type, 83 const lldb::TypeSummaryImplSP &entry); 84 85 static bool Delete(const ConstString &type); 86 87 static void Clear(); 88 89 static void 90 ForEach(std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)> 91 callback); 92 93 static uint32_t GetCount(); 94 }; 95 96 class Categories { 97 public: 98 static bool GetCategory(const ConstString &category, 99 lldb::TypeCategoryImplSP &entry, 100 bool allow_create = true); 101 102 static bool GetCategory(lldb::LanguageType language, 103 lldb::TypeCategoryImplSP &entry); 104 105 static void Add(const ConstString &category); 106 107 static bool Delete(const ConstString &category); 108 109 static void Clear(); 110 111 static void Clear(const ConstString &category); 112 113 static void Enable(const ConstString &category, 114 TypeCategoryMap::Position = TypeCategoryMap::Default); 115 116 static void Enable(lldb::LanguageType lang_type); 117 118 static void Disable(const ConstString &category); 119 120 static void Disable(lldb::LanguageType lang_type); 121 122 static void Enable(const lldb::TypeCategoryImplSP &category, 123 TypeCategoryMap::Position = TypeCategoryMap::Default); 124 125 static void Disable(const lldb::TypeCategoryImplSP &category); 126 127 static void EnableStar(); 128 129 static void DisableStar(); 130 131 static void ForEach(TypeCategoryMap::ForEachCallback callback); 132 133 static uint32_t GetCount(); 134 135 static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t); 136 }; 137 }; 138 139 } // namespace lldb_private 140 141 #endif // lldb_DataVisualization_h_ 142