[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 18 09:29:07 PDT 2025


================
@@ -33,6 +33,37 @@ static void EmplaceSafeString(llvm::json::Object &obj, llvm::StringRef key,
     obj.try_emplace(key, llvm::json::fixUTF8(str));
 }
 
+static void UpdateDwoFileCounts(SymbolFile *sym_file,
+                                uint32_t &total_dwo_file_count,
+                                uint32_t &total_loaded_dwo_file_count) {
+  // Count DWO files from this symbol file using GetSeparateDebugInfo
+  // For DWP files, this increments counts for both total and successfully
+  // loaded DWO CUs. For non split-dwarf files, these counts should not change
+  StructuredData::Dictionary separate_debug_info;
+  if (sym_file->GetSeparateDebugInfo(separate_debug_info,
----------------
jeffreytan81 wrote:

I would not recommend calling `GetSeparateDebugInfo` API for this task. `GetSeparateDebugInfo` API constructs `StructuredData::Dictionary` JSON style objects internally which is not cheap (I have seen profile traces that indicate constructing `StructuredData::Dictionary` as hot paths). This can get worse considering we are using `statistics dump` in lldb session logging by default. (means we are paying the cost every time).

If we want to reuse it, I would suggest refactoring and reuse the necessary underlying implementation without extra expensive burdens.

https://github.com/llvm/llvm-project/pull/144424


More information about the lldb-commits mailing list