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().Get(type, entry);
173 }
174 
175 void DataVisualization::NamedSummaryFormats::Add(
176  ConstString type, const lldb::TypeSummaryImplSP &entry) {
178  FormatManager::GetValidTypeName(type), entry);
179 }
180 
181 bool DataVisualization::NamedSummaryFormats::Delete(ConstString type) {
183 }
184 
185 void DataVisualization::NamedSummaryFormats::Clear() {
187 }
188 
189 void DataVisualization::NamedSummaryFormats::ForEach(
190  std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)>
191  callback) {
193 }
194 
195 uint32_t DataVisualization::NamedSummaryFormats::GetCount() {
197 }
lldb::TypeSummaryImplSP GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
lldb::ScriptedSyntheticChildrenSP GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp)
lldb::TypeSummaryImplSP GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp)
A class that represents a running process on the host machine.
lldb::TypeFormatImplSP GetFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
bool DeleteCategory(ConstString category_name)
Definition: FormatManager.h:85
void ForEachCategory(TypeCategoryMap::ForEachCallback callback)
void DisableCategory(ConstString category_name)
Definition: FormatManager.h:67
void ForEach(ForEachCallback callback)
lldb::TypeFilterImplSP GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp)
LanguageType
Programming language type.
lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t index)
Definition: FormatManager.h:93
static FormatManager & GetFormatManager()
uint32_t GetCurrentRevision() override
std::function< bool(const ValueSP &)> ForEachCallback
lldb::TypeFormatImplSP GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp)
void Add(KeyType name, const ValueSP &entry)
bool ShouldPrintAsOneLiner(ValueObject &valobj)
bool Get(const KeyType &name, ValueSP &entry)
A uniqued constant string class.
Definition: ConstString.h:40
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: SBAddress.h:15
lldb::TypeCategoryImplSP GetCategory(const char *category_name=nullptr, bool can_create=true)
Definition: FormatManager.h:99
lldb::SyntheticChildrenSP GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
NamedSummariesMap & GetNamedSummaryContainer()
Definition: FormatManager.h:48
void EnableCategory(ConstString category_name, TypeCategoryMap::Position pos=TypeCategoryMap::Default)
Definition: FormatManager.h:53
bool Delete(const KeyType &name)