This relands changes in #144424 for adding a count of DWO files
parsed/loaded and the total number of DWO files.
The previous PR was reverted in #145494 due to the newly added unit
tests failing on Windows and MacOS CIs since these platforms don't
support DWO. This change add an additional
`@add_test_categories(["dwo"])` to the new tests to
[skip](cd46354dbd/lldb/packages/Python/lldbsuite/test/test_categories.py (L56))
these tests on Windows/MacOS.
Original PR: #144424
### Testing
Ran unit tests
```
$ bin/lldb-dotest -p TestStats.py llvm-project/lldb/test/API/commands/statistics/basic/
----------------------------------------------------------------------
Ran 24 tests in 211.391s
OK (skipped=3)
```
This commit is contained in:
@@ -4420,3 +4420,32 @@ void SymbolFileDWARF::GetCompileOptions(
|
||||
args.insert({comp_unit, Args(flags)});
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<uint32_t, uint32_t> SymbolFileDWARF::GetDwoFileCounts() {
|
||||
uint32_t total_dwo_count = 0;
|
||||
uint32_t loaded_dwo_count = 0;
|
||||
|
||||
DWARFDebugInfo &info = DebugInfo();
|
||||
const size_t num_cus = info.GetNumUnits();
|
||||
for (size_t cu_idx = 0; cu_idx < num_cus; cu_idx++) {
|
||||
DWARFUnit *dwarf_cu = info.GetUnitAtIndex(cu_idx);
|
||||
if (dwarf_cu == nullptr)
|
||||
continue;
|
||||
|
||||
// Check if this is a DWO unit by checking if it has a DWO ID.
|
||||
if (!dwarf_cu->GetDWOId().has_value())
|
||||
continue;
|
||||
|
||||
total_dwo_count++;
|
||||
|
||||
// If we have a DWO symbol file, that means we were able to successfully
|
||||
// load it.
|
||||
SymbolFile *dwo_symfile =
|
||||
dwarf_cu->GetDwoSymbolFile(/*load_all_debug_info=*/false);
|
||||
if (dwo_symfile) {
|
||||
loaded_dwo_count++;
|
||||
}
|
||||
}
|
||||
|
||||
return {loaded_dwo_count, total_dwo_count};
|
||||
}
|
||||
|
||||
@@ -282,6 +282,11 @@ public:
|
||||
bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
|
||||
bool errors_only) override;
|
||||
|
||||
// Gets a pair of loaded and total dwo file counts.
|
||||
// For split-dwarf files, this reports the counts for successfully loaded DWO
|
||||
// CUs and total DWO CUs. For non-split-dwarf files, this reports 0 for both.
|
||||
std::pair<uint32_t, uint32_t> GetDwoFileCounts() override;
|
||||
|
||||
DWARFContext &GetDWARFContext() { return m_context; }
|
||||
|
||||
const std::shared_ptr<SymbolFileDWARFDwo> &GetDwpSymbolFile();
|
||||
|
||||
@@ -73,6 +73,8 @@ json::Value ModuleStats::ToJSON() const {
|
||||
debug_info_had_incomplete_types);
|
||||
module.try_emplace("symbolTableStripped", symtab_stripped);
|
||||
module.try_emplace("symbolTableSymbolCount", symtab_symbol_count);
|
||||
module.try_emplace("dwoFileCount", dwo_file_count);
|
||||
module.try_emplace("loadedDwoFileCount", loaded_dwo_file_count);
|
||||
|
||||
if (!symbol_locator_time.map.empty()) {
|
||||
json::Object obj;
|
||||
@@ -86,7 +88,7 @@ json::Value ModuleStats::ToJSON() const {
|
||||
|
||||
if (!symfile_modules.empty()) {
|
||||
json::Array symfile_ids;
|
||||
for (const auto symfile_id: symfile_modules)
|
||||
for (const auto symfile_id : symfile_modules)
|
||||
symfile_ids.emplace_back(symfile_id);
|
||||
module.try_emplace("symbolFileModuleIdentifiers", std::move(symfile_ids));
|
||||
}
|
||||
@@ -322,6 +324,8 @@ llvm::json::Value DebuggerStats::ReportStatistics(
|
||||
uint32_t num_modules_with_incomplete_types = 0;
|
||||
uint32_t num_stripped_modules = 0;
|
||||
uint32_t symtab_symbol_count = 0;
|
||||
uint32_t total_loaded_dwo_file_count = 0;
|
||||
uint32_t total_dwo_file_count = 0;
|
||||
for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) {
|
||||
Module *module = target != nullptr
|
||||
? target->GetImages().GetModuleAtIndex(image_idx).get()
|
||||
@@ -353,6 +357,10 @@ llvm::json::Value DebuggerStats::ReportStatistics(
|
||||
for (const auto &symbol_module : symbol_modules.Modules())
|
||||
module_stat.symfile_modules.push_back((intptr_t)symbol_module.get());
|
||||
}
|
||||
std::tie(module_stat.loaded_dwo_file_count, module_stat.dwo_file_count) =
|
||||
sym_file->GetDwoFileCounts();
|
||||
total_dwo_file_count += module_stat.dwo_file_count;
|
||||
total_loaded_dwo_file_count += module_stat.loaded_dwo_file_count;
|
||||
module_stat.debug_info_index_loaded_from_cache =
|
||||
sym_file->GetDebugInfoIndexWasLoadedFromCache();
|
||||
if (module_stat.debug_info_index_loaded_from_cache)
|
||||
@@ -427,6 +435,8 @@ llvm::json::Value DebuggerStats::ReportStatistics(
|
||||
{"totalDebugInfoEnabled", num_debug_info_enabled_modules},
|
||||
{"totalSymbolTableStripped", num_stripped_modules},
|
||||
{"totalSymbolTableSymbolCount", symtab_symbol_count},
|
||||
{"totalLoadedDwoFileCount", total_loaded_dwo_file_count},
|
||||
{"totalDwoFileCount", total_dwo_file_count},
|
||||
};
|
||||
|
||||
if (include_targets) {
|
||||
|
||||
Reference in New Issue
Block a user