Index: lldb/include/lldb/Core/Module.h =================================================================== --- lldb/include/lldb/Core/Module.h +++ lldb/include/lldb/Core/Module.h @@ -814,6 +814,8 @@ llvm::Expected GetTypeSystemForLanguage(lldb::LanguageType language); + void ForEachTypeSystem(std::function const &callback); + // Special error functions that can do printf style formatting that will // prepend the message with something appropriate for this module (like the // architecture, path and object name (if any)). This centralizes code so Index: lldb/include/lldb/Symbol/TypeSystem.h =================================================================== --- lldb/include/lldb/Symbol/TypeSystem.h +++ lldb/include/lldb/Symbol/TypeSystem.h @@ -19,6 +19,7 @@ #include "llvm/ADT/SmallBitVector.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Error.h" +#include "llvm/Support/JSON.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Expression/Expression.h" @@ -510,6 +511,8 @@ // meaningless type itself, instead preferring to use the dynamic type virtual bool IsMeaninglessWithoutDynamicResolution(void *type); + virtual llvm::Optional ReportStatistics(); + protected: SymbolFile *m_sym_file = nullptr; }; Index: lldb/source/Core/Module.cpp =================================================================== --- lldb/source/Core/Module.cpp +++ lldb/source/Core/Module.cpp @@ -369,6 +369,11 @@ return m_type_system_map.GetTypeSystemForLanguage(language, this, true); } +void Module::ForEachTypeSystem( + std::function const &callback) { + m_type_system_map.ForEach(callback); +} + void Module::ParseAllDebugSymbols() { std::lock_guard guard(m_mutex); size_t num_comp_units = GetNumCompileUnits(); Index: lldb/source/Symbol/TypeSystem.cpp =================================================================== --- lldb/source/Symbol/TypeSystem.cpp +++ lldb/source/Symbol/TypeSystem.cpp @@ -178,6 +178,10 @@ return {}; } +llvm::Optional TypeSystem::ReportStatistics() { + return llvm::None; +} + #pragma mark TypeSystemMap TypeSystemMap::TypeSystemMap() : m_mutex(), m_map() {} Index: lldb/source/Target/Statistics.cpp =================================================================== --- lldb/source/Target/Statistics.cpp +++ lldb/source/Target/Statistics.cpp @@ -256,7 +256,20 @@ debug_parse_time += module_stat.debug_parse_time; debug_index_time += module_stat.debug_index_time; debug_info_size += module_stat.debug_info_size; - json_modules.emplace_back(module_stat.ToJSON()); + json::Value module_stat_json = module_stat.ToJSON(); + module->ForEachTypeSystem([&](TypeSystem *ts) { + if (ts) { + json::Object *module_stat_obj = module_stat_json.getAsObject(); + if (!module_stat_obj) + return false; + auto stats = ts->ReportStatistics(); + if (stats.hasValue()) { + module_stat_obj->try_emplace("TypeSystemInfo", stats.getValue()); + } + } + return true; + }); + json_modules.emplace_back(module_stat_json); } ConstStringStats const_string_stats;