[Lldb-commits] [lldb] Add logs for SymbolFileDWARF::FindTypes (PR #106030)
Dmitrii Galimzianov via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 26 06:54:09 PDT 2024
https://github.com/DmT021 updated https://github.com/llvm/llvm-project/pull/106030
>From 9cc21bfd87a7836e9264ed6ef958ac5246c5ed53 Mon Sep 17 00:00:00 2001
From: Dmitrii Galimzianov <dmt021 at gmail.com>
Date: Mon, 26 Aug 2024 15:52:17 +0200
Subject: [PATCH] Add logs for SymbolFileDWARF::FindTypes
---
.../SymbolFile/DWARF/SymbolFileDWARF.cpp | 32 ++++++++++++++++---
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 7e0cf36d0de1b8..8684e9f3f7e375 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2737,10 +2737,19 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) {
if (results.AlreadySearched(this))
return;
+ auto type_basename = query.GetTypeBasename();
+
+ Log *log = GetLog(DWARFLog::Lookups);
+ if (log) {
+ GetObjectFile()->GetModule()->LogMessage(
+ log, "SymbolFileDWARF::FindTypes(type_basename=\"{0}\")",
+ type_basename);
+ }
+
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
bool have_index_match = false;
- m_index->GetTypes(query.GetTypeBasename(), [&](DWARFDIE die) {
+ m_index->GetTypes(type_basename, [&](DWARFDIE die) {
// Check the language, but only if we have a language filter.
if (query.HasLanguage()) {
if (!query.LanguageMatches(GetLanguageFamily(*die.GetCU())))
@@ -2779,7 +2788,19 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) {
return !results.Done(query); // Keep iterating if we aren't done.
});
- if (results.Done(query))
+ auto CheckIsDoneAndLog = [&results, &query, log, type_basename, this] {
+ if (results.Done(query)) {
+ if (log) {
+ GetObjectFile()->GetModule()->LogMessage(
+ log, "SymbolFileDWARF::FindTypes(type_basename=\"{0}\") => {1}",
+ type_basename, results.GetTypeMap().GetSize());
+ }
+ return true;
+ }
+ return false;
+ };
+
+ if (CheckIsDoneAndLog())
return;
// With -gsimple-template-names, a templated type's DW_AT_name will not
@@ -2834,7 +2855,7 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) {
}
return !results.Done(query); // Keep iterating if we aren't done.
});
- if (results.Done(query))
+ if (CheckIsDoneAndLog())
return;
}
}
@@ -2847,8 +2868,11 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) {
for (const auto &pair : m_external_type_modules) {
if (ModuleSP external_module_sp = pair.second) {
external_module_sp->FindTypes(query, results);
- if (results.Done(query))
+ if (results.Done(query)) {
+ // don't use CheckIsDoneAndLog because the results are already logged
+ // in the nested FindTypes call
return;
+ }
}
}
}
More information about the lldb-commits
mailing list