22 std::make_shared<TypeCategoryImpl>(
listener, default_cs);
23 Add(default_cs, default_sp);
29 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
42 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
44 if (iter ==
m_map.end())
59 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
61 if (!
Get(category_name, category))
63 return Enable(category, pos);
67 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
69 if (!
Get(category_name, category))
75 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
90 category->Enable(
true, pos);
97 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
107 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
109 MapType::iterator iter =
m_map.begin(), end =
m_map.end();
110 for (; iter != end; ++iter) {
111 if (iter->second->IsEnabled())
113 auto pos = iter->second->GetLastEnabledPosition();
114 if (pos >= sorted_categories.size()) {
115 auto iter = llvm::find_if(sorted_categories,
117 return sp.get() ==
nullptr;
119 pos = std::distance(sorted_categories.begin(), iter);
121 sorted_categories.at(pos) = iter->second;
123 decltype(sorted_categories)::iterator viter = sorted_categories.begin(),
124 vend = sorted_categories.end();
125 for (; viter != vend; viter++)
131 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
140 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
153 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
155 if (iter ==
m_map.end())
157 entry = iter->second;
164 const char **matching_category,
166 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
169 for (pos =
m_map.begin(); pos != end; pos++) {
170 if (pos->second->AnyMatches(candidate_type, items, only_enabled,
171 matching_category, matching_type))
177template <
typename ImplSP>
179 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
188 log,
"[%s] candidate match = %s %s %s %s ptr-stripped-depth=%u",
189 __FUNCTION__, match.GetTypeName().GetCString(),
190 match.DidStripPointer() ?
"strip-pointers" :
"no-strip-pointers",
191 match.DidStripReference() ?
"strip-reference" :
"no-strip-reference",
192 match.DidStripTypedef() ?
"strip-typedef" :
"no-strip-typedef",
193 match.GetPtrStrippedDepth());
199 ImplSP current_format;
200 LLDB_LOGF(log,
"[%s] Trying to use category %s", __FUNCTION__,
201 category_sp->GetName());
202 if (!category_sp->Get(
207 retval = std::move(current_format);
210 LLDB_LOGF(log,
"[%s] nothing found - returning empty SP", __FUNCTION__);
227 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
234 if (!callback(category))
242 for (pos =
m_map.begin(); pos != end; pos++) {
243 if (pos->second->IsEnabled())
245 if (!callback(pos->second))
253 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
255 if (index <
m_map.size()) {
257 for (pos =
m_map.begin(); pos != end; pos++) {
#define LLDB_LOGF(log,...)
A uniqued constant string class.
uint16_t FormatCategoryItems
bool Delete(KeyType name)
std::function< bool(const lldb::TypeCategoryImplSP &)> ForEachCallback
static const Position Last
bool AnyMatches(const FormattersMatchCandidate &candidate_type, TypeCategoryImpl::FormatCategoryItems items=TypeCategoryImpl::ALL_ITEM_TYPES, bool only_enabled=true, const char **matching_category=nullptr, TypeCategoryImpl::FormatCategoryItems *matching_type=nullptr)
void Add(KeyType name, const lldb::TypeCategoryImplSP &entry)
bool Enable(KeyType category_name, Position pos=Default)
lldb::TypeCategoryImplSP GetAtIndex(uint32_t)
std::recursive_mutex m_map_mutex
ActiveCategoriesList m_active_categories
ActiveCategoriesList::iterator ActiveCategoriesIterator
bool Disable(KeyType category_name)
MapType::iterator MapIterator
IFormatChangeListener * listener
void DisableAllCategories()
void EnableAllCategories()
bool Get(KeyType name, lldb::TypeCategoryImplSP &entry)
static const Position First
void ForEach(ForEachCallback callback)
TypeCategoryMap(IFormatChangeListener *lst)
lldb::LanguageType GetObjectRuntimeLanguage()
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::TypeSummaryImpl > TypeSummaryImplSP
std::shared_ptr< lldb_private::TypeFormatImpl > TypeFormatImplSP
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP