LLDB  mainline
DataVisualization.cpp
Go to the documentation of this file.
1 //===-- DataVisualization.cpp ---------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
11 
12 using namespace lldb;
13 using namespace lldb_private;
14 
16  static FormatManager g_format_manager;
17  return g_format_manager;
18 }
19 
20 void DataVisualization::ForceUpdate() { GetFormatManager().Changed(); }
21 
22 uint32_t DataVisualization::GetCurrentRevision() {
24 }
25 
26 bool DataVisualization::ShouldPrintAsOneLiner(ValueObject &valobj) {
27  return GetFormatManager().ShouldPrintAsOneLiner(valobj);
28 }
29 
30 lldb::TypeFormatImplSP
31 DataVisualization::GetFormat(ValueObject &valobj,
32  lldb::DynamicValueType use_dynamic) {
33  return GetFormatManager().GetFormat(valobj, use_dynamic);
34 }
35 
36 lldb::TypeFormatImplSP
37 DataVisualization::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
38  return GetFormatManager().GetFormatForType(type_sp);
39 }
40 
41 lldb::TypeSummaryImplSP
42 DataVisualization::GetSummaryFormat(ValueObject &valobj,
43  lldb::DynamicValueType use_dynamic) {
44  return GetFormatManager().GetSummaryFormat(valobj, use_dynamic);
45 }
46 
47 lldb::TypeSummaryImplSP
48 DataVisualization::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
49  return GetFormatManager().GetSummaryForType(type_sp);
50 }
51 
52 lldb::SyntheticChildrenSP
53 DataVisualization::GetSyntheticChildren(ValueObject &valobj,
54  lldb::DynamicValueType use_dynamic) {
55  return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
56 }
57 
58 lldb::TypeFilterImplSP
59 DataVisualization::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
60  return GetFormatManager().GetFilterForType(type_sp);
61 }
62 
63 lldb::ScriptedSyntheticChildrenSP
64 DataVisualization::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
65  return GetFormatManager().GetSyntheticForType(type_sp);
66 }
67 
68 bool DataVisualization::AnyMatches(
70  bool only_enabled, const char **matching_category,
72  return GetFormatManager().AnyMatches(type_name, items, only_enabled,
73  matching_category, matching_type);
74 }
75 
76 bool DataVisualization::Categories::GetCategory(ConstString category,
77  lldb::TypeCategoryImplSP &entry,
78  bool allow_create) {
79  entry = GetFormatManager().GetCategory(category, allow_create);
80  return (entry.get() != nullptr);
81 }
82 
83 bool DataVisualization::Categories::GetCategory(
84  lldb::LanguageType language, lldb::TypeCategoryImplSP &entry) {
85  if (LanguageCategory *lang_category =
86  GetFormatManager().GetCategoryForLanguage(language))
87  entry = lang_category->GetCategory();
88  return (entry.get() != nullptr);
89 }
90 
91 void DataVisualization::Categories::Add(ConstString category) {
92  GetFormatManager().GetCategory(category);
93 }
94 
95 bool DataVisualization::Categories::Delete(ConstString category) {
97  return GetFormatManager().DeleteCategory(category);
98 }
99 
100 void DataVisualization::Categories::Clear() {
102 }
103 
104 void DataVisualization::Categories::Clear(ConstString category) {
105  GetFormatManager().GetCategory(category)->Clear(
107 }
108 
109 void DataVisualization::Categories::Enable(ConstString category,
111  if (GetFormatManager().GetCategory(category)->IsEnabled())
112  GetFormatManager().DisableCategory(category);
113  GetFormatManager().EnableCategory(category, pos, {});
114 }
115 
116 void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) {
117  if (LanguageCategory *lang_category =
118  GetFormatManager().GetCategoryForLanguage(lang_type))
119  lang_category->Enable();
120 }
121 
122 void DataVisualization::Categories::Disable(ConstString category) {
123  if (GetFormatManager().GetCategory(category)->IsEnabled())
124  GetFormatManager().DisableCategory(category);
125 }
126 
127 void DataVisualization::Categories::Disable(lldb::LanguageType lang_type) {
128  if (LanguageCategory *lang_category =
129  GetFormatManager().GetCategoryForLanguage(lang_type))
130  lang_category->Disable();
131 }
132 
133 void DataVisualization::Categories::Enable(
134  const lldb::TypeCategoryImplSP &category, TypeCategoryMap::Position pos) {
135  if (category.get()) {
136  if (category->IsEnabled())
137  GetFormatManager().DisableCategory(category);
138  GetFormatManager().EnableCategory(category, pos);
139  }
140 }
141 
142 void DataVisualization::Categories::Disable(
143  const lldb::TypeCategoryImplSP &category) {
144  if (category.get() && category->IsEnabled())
145  GetFormatManager().DisableCategory(category);
146 }
147 
148 void DataVisualization::Categories::EnableStar() {
150 }
151 
152 void DataVisualization::Categories::DisableStar() {
154 }
155 
156 void DataVisualization::Categories::ForEach(
158  GetFormatManager().ForEachCategory(callback);
159 }
160 
161 uint32_t DataVisualization::Categories::GetCount() {
163 }
164 
165 lldb::TypeCategoryImplSP
166 DataVisualization::Categories::GetCategoryAtIndex(size_t index) {
167  return GetFormatManager().GetCategoryAtIndex(index);
168 }
169 
170 bool DataVisualization::NamedSummaryFormats::GetSummaryFormat(
171  ConstString type, lldb::TypeSummaryImplSP &entry) {
172  return GetFormatManager().GetNamedSummaryContainer().GetExact(type, entry);
173 }
174 
175 void DataVisualization::NamedSummaryFormats::Add(
176  ConstString type, const lldb::TypeSummaryImplSP &entry) {
178 }
179 
180 bool DataVisualization::NamedSummaryFormats::Delete(ConstString type) {
182 }
183 
184 void DataVisualization::NamedSummaryFormats::Clear() {
186 }
187 
188 void DataVisualization::NamedSummaryFormats::ForEach(
189  std::function<bool(const TypeMatcher &, const lldb::TypeSummaryImplSP &)>
190  callback) {
192 }
193 
194 uint32_t DataVisualization::NamedSummaryFormats::GetCount() {
196 }
lldb_private::FormattersContainer::ForEach
void ForEach(ForEachCallback callback)
Definition: FormattersContainer.h:189
lldb_private::FormatManager
Definition: FormatManager.h:36
lldb_private::FormatManager::AnyMatches
bool AnyMatches(ConstString type_name, TypeCategoryImpl::FormatCategoryItems items=TypeCategoryImpl::ALL_ITEM_TYPES, bool only_enabled=true, const char **matching_category=nullptr, TypeCategoryImpl::FormatCategoryItems *matching_type=nullptr)
Definition: FormatManager.h:131
lldb_private::FormatManager::GetFormat
lldb::TypeFormatImplSP GetFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
Definition: FormatManager.cpp:670
lldb_private::TypeMatcher
Class for matching type names.
Definition: FormattersContainer.h:41
lldb_private::eFormatCategoryItemSummary
@ eFormatCategoryItemSummary
Definition: lldb-private-enumerations.h:131
lldb_private::FormatManager::GetNamedSummaryContainer
NamedSummariesMap & GetNamedSummaryContainer()
Definition: FormatManager.h:48
lldb_private::FormattersContainer::Clear
void Clear()
Definition: FormattersContainer.h:182
lldb_private::FormatManager::GetCurrentRevision
uint32_t GetCurrentRevision() override
Definition: FormatManager.h:160
lldb_private::FormatManager::DeleteCategory
bool DeleteCategory(ConstString category_name)
Definition: FormatManager.h:85
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::FormatManager::GetCategory
lldb::TypeCategoryImplSP GetCategory(const char *category_name=nullptr, bool can_create=true)
Definition: FormatManager.h:99
lldb_private::FormatManager::EnableAllCategories
void EnableAllCategories()
Definition: FormatManager.cpp:158
lldb_private::FormattersContainer::Delete
bool Delete(TypeMatcher matcher)
Definition: FormattersContainer.h:133
lldb_private::TypeCategoryMap::ForEachCallback
std::function< bool(const ValueSP &)> ForEachCallback
Definition: TypeCategoryMap.h:35
lldb_private::FormatManager::GetSummaryForType
lldb::TypeSummaryImplSP GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: FormatManager.cpp:330
lldb_private::FormatManager::ShouldPrintAsOneLiner
bool ShouldPrintAsOneLiner(ValueObject &valobj)
Definition: FormatManager.cpp:458
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::FormatManager::GetCategoryAtIndex
lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t index)
Definition: FormatManager.h:93
lldb::DynamicValueType
DynamicValueType
Definition: lldb-enumerations.h:494
lldb_private::FormatManager::DisableAllCategories
void DisableAllCategories()
Definition: FormatManager.cpp:167
lldb_private::LanguageCategory
Definition: LanguageCategory.h:21
lldb_private::FormattersContainer::GetCount
uint32_t GetCount()
Definition: FormattersContainer.h:200
lldb_private::FormatManager::ClearCategories
void ClearCategories()
Definition: FormatManager.h:89
lldb_private::ValueObject
ValueObject:
Definition: ValueObject.h:105
DataVisualization.h
lldb_private::FormattersContainer::Add
void Add(TypeMatcher matcher, const ValueSP &entry)
Definition: FormattersContainer.h:120
uint32_t
lldb_private::FormatManager::GetFilterForType
lldb::TypeFilterImplSP GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: FormatManager.cpp:354
lldb_private::FormatManager::GetCategoriesCount
uint32_t GetCategoriesCount()
Definition: FormatManager.h:91
lldb_private::FormatManager::DisableCategory
void DisableCategory(ConstString category_name)
Definition: FormatManager.h:67
uint16_t
lldb_private::FormatManager::GetFormatForType
lldb::TypeFormatImplSP GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: FormatManager.cpp:306
lldb_private::FormatManager::GetSyntheticChildren
lldb::SyntheticChildrenSP GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
Definition: FormatManager.cpp:682
GetFormatManager
static FormatManager & GetFormatManager()
Definition: DataVisualization.cpp:15
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::FormatManager::Changed
void Changed() override
Definition: FormatManager.cpp:116
lldb_private::eFormatCategoryItemRegexSummary
@ eFormatCategoryItemRegexSummary
Definition: lldb-private-enumerations.h:132
lldb_private::FormatManager::ForEachCategory
void ForEachCategory(TypeCategoryMap::ForEachCallback callback)
Definition: FormatManager.cpp:402
lldb_private::FormattersContainer::GetExact
bool GetExact(TypeMatcher matcher, ValueSP &entry)
Definition: FormattersContainer.h:156
lldb
Definition: SBAddress.h:15
lldb_private::FormatManager::GetSummaryFormat
lldb::TypeSummaryImplSP GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
Definition: FormatManager.cpp:676
lldb_private::FormatManager::GetSyntheticForType
lldb::ScriptedSyntheticChildrenSP GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)
Definition: FormatManager.cpp:378
lldb_private::FormatManager::EnableCategory
void EnableCategory(ConstString category_name, TypeCategoryMap::Position pos=TypeCategoryMap::Default)
Definition: FormatManager.h:53