20 constexpr llvm::StringRef default_category_name(
"default");
23 Add(default_category_name, default_sp);
30 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
43 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
45 if (iter ==
m_map.end())
60 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
62 if (!
Get(category_name, category))
64 return Enable(category, pos);
68 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
70 if (!
Get(category_name, category))
76 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
91 category->Enable(
true, pos);
98 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
108 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
110 MapType::iterator iter =
m_map.begin(), end =
m_map.end();
111 for (; iter != end; ++iter) {
112 if (iter->second->IsEnabled())
114 auto pos = iter->second->GetLastEnabledPosition();
115 if (pos >= sorted_categories.size()) {
116 auto iter = llvm::find_if(sorted_categories,
118 return sp.get() ==
nullptr;
120 pos = std::distance(sorted_categories.begin(), iter);
122 sorted_categories.at(pos) = iter->second;
124 decltype(sorted_categories)::iterator viter = sorted_categories.begin(),
125 vend = sorted_categories.end();
126 for (; viter != vend; viter++)
132 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
141 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
154 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
156 if (iter ==
m_map.end())
158 entry = iter->second;
162template <
typename ImplSP>
164 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
173 log,
"[%s] candidate match = %s %s %s %s ptr-stripped-depth=%u",
174 __FUNCTION__, match.GetTypeName().GetCString(),
175 match.DidStripPointer() ?
"strip-pointers" :
"no-strip-pointers",
176 match.DidStripReference() ?
"strip-reference" :
"no-strip-reference",
177 match.DidStripTypedef() ?
"strip-typedef" :
"no-strip-typedef",
178 match.GetPtrStrippedDepth());
184 ImplSP current_format;
185 LLDB_LOGF(log,
"[%s] Trying to use category %s", __FUNCTION__,
186 category_sp->GetName());
187 if (!category_sp->Get(
192 retval = std::move(current_format);
195 LLDB_LOGF(log,
"[%s] nothing found - returning empty SP", __FUNCTION__);
212 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
219 if (!callback(category))
227 for (pos =
m_map.begin(); pos != end; pos++) {
228 if (pos->second->IsEnabled())
230 if (!callback(pos->second))
238 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
240 if (index <
m_map.size()) {
242 for (pos =
m_map.begin(); pos != end; pos++) {
#define LLDB_LOGF(log,...)
A uniqued constant string class.
bool Enable(llvm::StringRef category_name, Position pos=Default)
bool Disable(llvm::StringRef category_name)
std::function< bool(const lldb::TypeCategoryImplSP &)> ForEachCallback
static const Position Last
lldb::TypeCategoryImplSP GetAtIndex(uint32_t)
std::recursive_mutex m_map_mutex
bool Delete(llvm::StringRef name)
ActiveCategoriesList m_active_categories
ActiveCategoriesList::iterator ActiveCategoriesIterator
MapType::iterator MapIterator
bool Get(llvm::StringRef name, lldb::TypeCategoryImplSP &entry)
IFormatChangeListener * listener
void DisableAllCategories()
void EnableAllCategories()
void Add(llvm::StringRef name, const 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