Skip to content

Commit 1cafe59

Browse files
author
George Hu
committed
Add all symfile path in statistic
1 parent 85bee8e commit 1cafe59

File tree

6 files changed

+38
-6
lines changed

6 files changed

+38
-6
lines changed

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ class SymbolFile : public PluginInterface {
355355
virtual const ObjectFile *GetObjectFile() const = 0;
356356
virtual ObjectFile *GetMainObjectFile() = 0;
357357

358+
virtual std::vector<ObjectFile *> GetAllObjectFiles();
359+
358360
virtual std::vector<std::unique_ptr<CallEdge>>
359361
ParseCallEdgesInFunction(UserID func_id) {
360362
return {};

lldb/include/lldb/Target/Statistics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ struct ModuleStats {
111111
std::string uuid;
112112
std::string triple;
113113
// Path separate debug info file, or empty if none.
114-
std::string symfile_path;
114+
std::vector<std::string> symfile_path;
115115
// If the debug info is contained in multiple files where each one is
116116
// represented as a separate lldb_private::Module, then these are the
117117
// identifiers of these modules in the global module list. This allows us to

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,6 +4354,22 @@ LanguageType SymbolFileDWARF::GetLanguageFamily(DWARFUnit &unit) {
43544354
return LanguageTypeFromDWARF(lang);
43554355
}
43564356

4357+
std::vector<ObjectFile *> SymbolFileDWARF::GetAllObjectFiles() {
4358+
std::vector<ObjectFile *> object_files;
4359+
object_files.push_back(m_objfile_sp.get());
4360+
if (m_dwp_symfile) {
4361+
std::vector<ObjectFile *> dwp_files = m_dwp_symfile->GetAllObjectFiles();
4362+
object_files.insert(object_files.end(), dwp_files.begin(), dwp_files.end());
4363+
}
4364+
if (m_debug_map_symfile) {
4365+
std::vector<ObjectFile *> debug_map_files =
4366+
m_debug_map_symfile->GetAllObjectFiles();
4367+
object_files.insert(object_files.end(), debug_map_files.begin(),
4368+
debug_map_files.end());
4369+
}
4370+
return object_files;
4371+
}
4372+
43574373
StatsDuration::Duration SymbolFileDWARF::GetSymbolLocateTime() {
43584374
StatsDuration total_time;
43594375
total_time += GetObjectFile()->GetLocateTime();

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
306306
/// Same as GetLanguage() but reports all C++ versions as C++ (no version).
307307
static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit);
308308

309+
std::vector<ObjectFile *> GetAllObjectFiles() override;
310+
309311
StatsDuration::Duration GetDebugInfoParseTime() override {
310312
return m_parse_time;
311313
}

lldb/source/Symbol/SymbolFile.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ void SymbolFile::AssertModuleLock() {
150150
#endif
151151
}
152152

153+
std::vector<ObjectFile *> SymbolFile::GetAllObjectFiles() {
154+
std::vector<ObjectFile *> object_files;
155+
object_files.push_back(GetObjectFile());
156+
return object_files;
157+
}
158+
153159
SymbolFile::RegisterInfoResolver::~RegisterInfoResolver() = default;
154160

155161
Symtab *SymbolFileCommon::GetSymtab() {

lldb/source/Target/Statistics.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,14 @@ json::Value ModuleStats::ToJSON() const {
7272
debug_info_had_incomplete_types);
7373
module.try_emplace("symbolTableStripped", symtab_stripped);
7474
module.try_emplace("symbolLocateTime", symbol_locate_time);
75-
if (!symfile_path.empty())
76-
module.try_emplace("symbolFilePath", symfile_path);
75+
if (!symfile_path.empty()) {
76+
json::Array symbolfile_path;
77+
for (std::string const &path : symfile_path)
78+
if (!path.empty())
79+
symbolfile_path.emplace_back(path);
80+
if (!symbolfile_path.empty())
81+
module.try_emplace("symbolFilePaths", std::move(symbolfile_path));
82+
}
7783

7884
if (!symfile_modules.empty()) {
7985
json::Array symfile_ids;
@@ -330,9 +336,9 @@ llvm::json::Value DebuggerStats::ReportStatistics(
330336
SymbolFile *sym_file = module->GetSymbolFile(/*can_create=*/false);
331337
if (sym_file) {
332338
if (!summary_only) {
333-
if (sym_file->GetObjectFile() != module->GetObjectFile())
334-
module_stat.symfile_path =
335-
sym_file->GetObjectFile()->GetFileSpec().GetPath();
339+
for (ObjectFile *sym_objfile : sym_file->GetAllObjectFiles())
340+
module_stat.symfile_path.push_back(
341+
sym_objfile->GetFileSpec().GetPath());
336342
ModuleList symbol_modules = sym_file->GetDebugInfoModules();
337343
for (const auto &symbol_module : symbol_modules.Modules())
338344
module_stat.symfile_modules.push_back((intptr_t)symbol_module.get());

0 commit comments

Comments
 (0)