Skip to content

Commit 371f12f

Browse files
authored
Revert "[lldb] Add count for number of DWO files loaded in statistics" (#145494)
Reverts #144424 Caused CI failures. macOS CI failure was: ``` 10:20:36 FAIL: test_dwp_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the loaded dwo file count. 10:20:36 ---------------------------------------------------------------------- 10:20:36 Traceback (most recent call last): 10:20:36 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 639, in test_dwp_dwo_file_count 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 ====================================================================== 10:20:36 FAIL: test_no_debug_names_eager_loads_dwo_files (TestStats.TestCase) 10:20:36 Test the eager loading behavior of DWO files when debug_names is absent by 10:20:36 ---------------------------------------------------------------------- 10:20:36 Traceback (most recent call last): 10:20:36 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 566, in test_no_debug_names_eager_loads_dwo_files 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 ====================================================================== 10:20:36 FAIL: test_split_dwarf_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the dwo file count. 10:20:36 ---------------------------------------------------------------------- 10:20:36 Traceback (most recent call last): 10:20:36 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 588, in test_split_dwarf_dwo_file_count 10:20:36 self.assertEqual(len(debug_stats["modules"]), 1) 10:20:36 AssertionError: 42 != 1 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang ```
1 parent 61b99ca commit 371f12f

File tree

10 files changed

+8
-235
lines changed

10 files changed

+8
-235
lines changed

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,6 @@ class SymbolFile : public PluginInterface {
472472
return false;
473473
};
474474

475-
/// Get number of loaded/parsed DWO files. This is emitted in "statistics
476-
/// dump"
477-
///
478-
/// \returns
479-
/// A pair containing (loaded_dwo_count, total_dwo_count). If this
480-
/// symbol file doesn't support DWO files, both counts will be 0.
481-
virtual std::pair<uint32_t, uint32_t> GetDwoFileCounts() { return {0, 0}; }
482-
483475
virtual lldb::TypeSP
484476
MakeType(lldb::user_id_t uid, ConstString name,
485477
std::optional<uint64_t> byte_size, SymbolContextScope *context,

lldb/include/lldb/Target/Statistics.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ struct ModuleStats {
153153
bool symtab_stripped = false;
154154
bool debug_info_had_variable_errors = false;
155155
bool debug_info_had_incomplete_types = false;
156-
uint32_t dwo_file_count = 0;
157-
uint32_t loaded_dwo_file_count = 0;
158156
};
159157

160158
struct ConstStringStats {

lldb/packages/Python/lldbsuite/test/builders/builder.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -247,25 +247,13 @@ def getLLDBObjRoot(self):
247247
def _getDebugInfoArgs(self, debug_info):
248248
if debug_info is None:
249249
return []
250-
251-
debug_options = debug_info if isinstance(debug_info, list) else [debug_info]
252-
option_flags = {
253-
"dwarf": {"MAKE_DSYM": "NO"},
254-
"dwo": {"MAKE_DSYM": "NO", "MAKE_DWO": "YES"},
255-
"gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"},
256-
"debug_names": {"MAKE_DEBUG_NAMES": "YES"},
257-
"dwp": {"MAKE_DSYM": "NO", "MAKE_DWP": "YES"},
258-
}
259-
260-
# Collect all flags, with later options overriding earlier ones
261-
flags = {}
262-
263-
for option in debug_options:
264-
if not option or option not in option_flags:
265-
return None # Invalid options
266-
flags.update(option_flags[option])
267-
268-
return [f"{key}={value}" for key, value in flags.items()]
250+
if debug_info == "dwarf":
251+
return ["MAKE_DSYM=NO"]
252+
if debug_info == "dwo":
253+
return ["MAKE_DSYM=NO", "MAKE_DWO=YES"]
254+
if debug_info == "gmodules":
255+
return ["MAKE_DSYM=NO", "MAKE_GMODULES=YES"]
256+
return None
269257

270258
def getBuildCommand(
271259
self,

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,6 @@ ifeq "$(MAKE_DWO)" "YES"
276276
CFLAGS += -gsplit-dwarf
277277
endif
278278

279-
ifeq "$(MAKE_DEBUG_NAMES)" "YES"
280-
CFLAGS += -gpubnames
281-
endif
282-
283279
ifeq "$(USE_PRIVATE_MODULE_CACHE)" "YES"
284280
THE_CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/private-module-cache
285281
else

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4420,32 +4420,3 @@ void SymbolFileDWARF::GetCompileOptions(
44204420
args.insert({comp_unit, Args(flags)});
44214421
}
44224422
}
4423-
4424-
std::pair<uint32_t, uint32_t> SymbolFileDWARF::GetDwoFileCounts() {
4425-
uint32_t total_dwo_count = 0;
4426-
uint32_t loaded_dwo_count = 0;
4427-
4428-
DWARFDebugInfo &info = DebugInfo();
4429-
const size_t num_cus = info.GetNumUnits();
4430-
for (size_t cu_idx = 0; cu_idx < num_cus; cu_idx++) {
4431-
DWARFUnit *dwarf_cu = info.GetUnitAtIndex(cu_idx);
4432-
if (dwarf_cu == nullptr)
4433-
continue;
4434-
4435-
// Check if this is a DWO unit by checking if it has a DWO ID.
4436-
if (!dwarf_cu->GetDWOId().has_value())
4437-
continue;
4438-
4439-
total_dwo_count++;
4440-
4441-
// If we have a DWO symbol file, that means we were able to successfully
4442-
// load it.
4443-
SymbolFile *dwo_symfile =
4444-
dwarf_cu->GetDwoSymbolFile(/*load_all_debug_info=*/false);
4445-
if (dwo_symfile) {
4446-
loaded_dwo_count++;
4447-
}
4448-
}
4449-
4450-
return {loaded_dwo_count, total_dwo_count};
4451-
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ class SymbolFileDWARF : public SymbolFileCommon {
282282
bool GetSeparateDebugInfo(StructuredData::Dictionary &d,
283283
bool errors_only) override;
284284

285-
// Gets a pair of loaded and total dwo file counts.
286-
// For split-dwarf files, this reports the counts for successfully loaded DWO
287-
// CUs and total DWO CUs. For non-split-dwarf files, this reports 0 for both.
288-
std::pair<uint32_t, uint32_t> GetDwoFileCounts() override;
289-
290285
DWARFContext &GetDWARFContext() { return m_context; }
291286

292287
const std::shared_ptr<SymbolFileDWARFDwo> &GetDwpSymbolFile();

lldb/source/Target/Statistics.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ json::Value ModuleStats::ToJSON() const {
7373
debug_info_had_incomplete_types);
7474
module.try_emplace("symbolTableStripped", symtab_stripped);
7575
module.try_emplace("symbolTableSymbolCount", symtab_symbol_count);
76-
module.try_emplace("dwoFileCount", dwo_file_count);
77-
module.try_emplace("loadedDwoFileCount", loaded_dwo_file_count);
7876

7977
if (!symbol_locator_time.map.empty()) {
8078
json::Object obj;
@@ -88,7 +86,7 @@ json::Value ModuleStats::ToJSON() const {
8886

8987
if (!symfile_modules.empty()) {
9088
json::Array symfile_ids;
91-
for (const auto symfile_id : symfile_modules)
89+
for (const auto symfile_id: symfile_modules)
9290
symfile_ids.emplace_back(symfile_id);
9391
module.try_emplace("symbolFileModuleIdentifiers", std::move(symfile_ids));
9492
}
@@ -324,8 +322,6 @@ llvm::json::Value DebuggerStats::ReportStatistics(
324322
uint32_t num_modules_with_incomplete_types = 0;
325323
uint32_t num_stripped_modules = 0;
326324
uint32_t symtab_symbol_count = 0;
327-
uint32_t total_loaded_dwo_file_count = 0;
328-
uint32_t total_dwo_file_count = 0;
329325
for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) {
330326
Module *module = target != nullptr
331327
? target->GetImages().GetModuleAtIndex(image_idx).get()
@@ -357,10 +353,6 @@ llvm::json::Value DebuggerStats::ReportStatistics(
357353
for (const auto &symbol_module : symbol_modules.Modules())
358354
module_stat.symfile_modules.push_back((intptr_t)symbol_module.get());
359355
}
360-
std::tie(module_stat.loaded_dwo_file_count, module_stat.dwo_file_count) =
361-
sym_file->GetDwoFileCounts();
362-
total_dwo_file_count += module_stat.dwo_file_count;
363-
total_loaded_dwo_file_count += module_stat.loaded_dwo_file_count;
364356
module_stat.debug_info_index_loaded_from_cache =
365357
sym_file->GetDebugInfoIndexWasLoadedFromCache();
366358
if (module_stat.debug_info_index_loaded_from_cache)
@@ -435,8 +427,6 @@ llvm::json::Value DebuggerStats::ReportStatistics(
435427
{"totalDebugInfoEnabled", num_debug_info_enabled_modules},
436428
{"totalSymbolTableStripped", num_stripped_modules},
437429
{"totalSymbolTableSymbolCount", symtab_symbol_count},
438-
{"totalLoadedDwoFileCount", total_loaded_dwo_file_count},
439-
{"totalDwoFileCount", total_dwo_file_count},
440430
};
441431

442432
if (include_targets) {

lldb/test/API/commands/statistics/basic/TestStats.py

Lines changed: 0 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ def test_default_no_run(self):
177177
"totalDebugInfoIndexLoadedFromCache",
178178
"totalDebugInfoIndexSavedToCache",
179179
"totalDebugInfoParseTime",
180-
"totalDwoFileCount",
181-
"totalLoadedDwoFileCount",
182180
]
183181
self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
184182
if self.getPlatform() != "windows":
@@ -289,8 +287,6 @@ def test_default_with_run(self):
289287
"totalDebugInfoIndexLoadedFromCache",
290288
"totalDebugInfoIndexSavedToCache",
291289
"totalDebugInfoParseTime",
292-
"totalDwoFileCount",
293-
"totalLoadedDwoFileCount",
294290
]
295291
self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
296292
stats = debug_stats["targets"][0]
@@ -329,8 +325,6 @@ def test_memory(self):
329325
"totalDebugInfoIndexLoadedFromCache",
330326
"totalDebugInfoIndexSavedToCache",
331327
"totalDebugInfoByteSize",
332-
"totalDwoFileCount",
333-
"totalLoadedDwoFileCount",
334328
]
335329
self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
336330

@@ -383,8 +377,6 @@ def test_modules(self):
383377
"totalDebugInfoIndexLoadedFromCache",
384378
"totalDebugInfoIndexSavedToCache",
385379
"totalDebugInfoByteSize",
386-
"totalDwoFileCount",
387-
"totalLoadedDwoFileCount",
388380
]
389381
self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
390382
stats = debug_stats["targets"][0]
@@ -405,8 +397,6 @@ def test_modules(self):
405397
"symbolTableLoadedFromCache",
406398
"symbolTableParseTime",
407399
"symbolTableSavedToCache",
408-
"dwoFileCount",
409-
"loadedDwoFileCount",
410400
"triple",
411401
"uuid",
412402
]
@@ -495,8 +485,6 @@ def test_breakpoints(self):
495485
"totalDebugInfoIndexLoadedFromCache",
496486
"totalDebugInfoIndexSavedToCache",
497487
"totalDebugInfoByteSize",
498-
"totalDwoFileCount",
499-
"totalLoadedDwoFileCount",
500488
]
501489
self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
502490
target_stats = debug_stats["targets"][0]
@@ -524,132 +512,6 @@ def test_breakpoints(self):
524512
self.verify_keys(
525513
breakpoint, 'target_stats["breakpoints"]', bp_keys_exist, None
526514
)
527-
def test_non_split_dwarf_has_no_dwo_files(self):
528-
"""
529-
Test "statistics dump" and the dwo file count.
530-
Builds a binary without split-dwarf mode, and then
531-
verifies the dwo file count is zero after running "statistics dump"
532-
"""
533-
da = {"CXX_SOURCES": "third.cpp baz.cpp", "EXE": self.getBuildArtifact("a.out")}
534-
self.build(dictionary=da, debug_info=["debug_names"])
535-
self.addTearDownCleanup(dictionary=da)
536-
exe = self.getBuildArtifact("a.out")
537-
target = self.createTestTarget(file_path=exe)
538-
debug_stats = self.get_stats()
539-
self.assertIn("totalDwoFileCount", debug_stats)
540-
self.assertIn("totalLoadedDwoFileCount", debug_stats)
541-
542-
# Verify that the dwo file count is zero
543-
self.assertEqual(debug_stats["totalDwoFileCount"], 0)
544-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 0)
545-
546-
def test_no_debug_names_eager_loads_dwo_files(self):
547-
"""
548-
Test the eager loading behavior of DWO files when debug_names is absent by
549-
building a split-dwarf binary without debug_names and then running "statistics dump".
550-
DWO file loading behavior:
551-
- With debug_names: DebugNamesDWARFIndex allows for lazy loading.
552-
DWO files are loaded on-demand when symbols are actually looked up
553-
- Without debug_names: ManualDWARFIndex uses eager loading.
554-
All DWO files are loaded upfront during the first symbol lookup to build a manual index.
555-
"""
556-
da = {"CXX_SOURCES": "third.cpp baz.cpp", "EXE": self.getBuildArtifact("a.out")}
557-
self.build(dictionary=da, debug_info=["dwo"])
558-
self.addTearDownCleanup(dictionary=da)
559-
exe = self.getBuildArtifact("a.out")
560-
target = self.createTestTarget(file_path=exe)
561-
debug_stats = self.get_stats()
562-
self.assertIn("totalDwoFileCount", debug_stats)
563-
self.assertIn("totalLoadedDwoFileCount", debug_stats)
564-
565-
# Verify that all DWO files are loaded
566-
self.assertEqual(debug_stats["totalDwoFileCount"], 2)
567-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 2)
568-
569-
def test_split_dwarf_dwo_file_count(self):
570-
"""
571-
Test "statistics dump" and the dwo file count.
572-
Builds a binary w/ separate .dwo files and debug_names, and then
573-
verifies the loaded dwo file count is the expected count after running
574-
various commands
575-
"""
576-
da = {"CXX_SOURCES": "third.cpp baz.cpp", "EXE": self.getBuildArtifact("a.out")}
577-
# -gsplit-dwarf creates separate .dwo files,
578-
# -gpubnames enables the debug_names accelerator tables for faster symbol lookup
579-
# and lazy loading of DWO files
580-
# Expected output: third.dwo (contains main) and baz.dwo (contains Baz struct/function)
581-
self.build(dictionary=da, debug_info=["dwo", "debug_names"])
582-
self.addTearDownCleanup(dictionary=da)
583-
exe = self.getBuildArtifact("a.out")
584-
target = self.createTestTarget(file_path=exe)
585-
debug_stats = self.get_stats()
586-
587-
# 1) 2 DWO files available but none loaded yet
588-
self.assertEqual(len(debug_stats["modules"]), 1)
589-
self.assertIn("totalLoadedDwoFileCount", debug_stats)
590-
self.assertIn("totalDwoFileCount", debug_stats)
591-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 0)
592-
self.assertEqual(debug_stats["totalDwoFileCount"], 2)
593-
594-
# Since there's only one module, module stats should have the same counts as total counts
595-
self.assertIn("dwoFileCount", debug_stats["modules"][0])
596-
self.assertIn("loadedDwoFileCount", debug_stats["modules"][0])
597-
self.assertEqual(debug_stats["modules"][0]["loadedDwoFileCount"], 0)
598-
self.assertEqual(debug_stats["modules"][0]["dwoFileCount"], 2)
599-
600-
# 2) Setting breakpoint in main triggers loading of third.dwo (contains main function)
601-
self.runCmd("b main")
602-
debug_stats = self.get_stats()
603-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 1)
604-
self.assertEqual(debug_stats["totalDwoFileCount"], 2)
605-
606-
self.assertEqual(debug_stats["modules"][0]["loadedDwoFileCount"], 1)
607-
self.assertEqual(debug_stats["modules"][0]["dwoFileCount"], 2)
608-
609-
# 3) Type lookup forces loading of baz.dwo (contains struct Baz definition)
610-
self.runCmd("type lookup Baz")
611-
debug_stats = self.get_stats()
612-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 2)
613-
self.assertEqual(debug_stats["totalDwoFileCount"], 2)
614-
615-
self.assertEqual(debug_stats["modules"][0]["loadedDwoFileCount"], 2)
616-
self.assertEqual(debug_stats["modules"][0]["dwoFileCount"], 2)
617-
618-
def test_dwp_dwo_file_count(self):
619-
"""
620-
Test "statistics dump" and the loaded dwo file count.
621-
Builds a binary w/ a separate .dwp file and debug_names, and then
622-
verifies the loaded dwo file count is the expected count after running
623-
various commands.
624-
625-
We expect the DWO file counters to reflect the number of compile units
626-
loaded from the DWP file (each representing what was originally a separate DWO file)
627-
"""
628-
da = {"CXX_SOURCES": "third.cpp baz.cpp", "EXE": self.getBuildArtifact("a.out")}
629-
self.build(dictionary=da, debug_info=["dwp", "debug_names"])
630-
self.addTearDownCleanup(dictionary=da)
631-
exe = self.getBuildArtifact("a.out")
632-
target = self.createTestTarget(file_path=exe)
633-
debug_stats = self.get_stats()
634-
635-
# Initially: 2 DWO files available but none loaded yet
636-
self.assertIn("totalLoadedDwoFileCount", debug_stats)
637-
self.assertIn("totalDwoFileCount", debug_stats)
638-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 0)
639-
self.assertEqual(debug_stats["totalDwoFileCount"], 2)
640-
641-
# Setting breakpoint in main triggers parsing of the CU within a.dwp corresponding to third.dwo (contains main function)
642-
self.runCmd("b main")
643-
debug_stats = self.get_stats()
644-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 1)
645-
self.assertEqual(debug_stats["totalDwoFileCount"], 2)
646-
647-
# Type lookup forces parsing of the CU within a.dwp corresponding to baz.dwo (contains struct Baz definition)
648-
self.runCmd("type lookup Baz")
649-
debug_stats = self.get_stats()
650-
self.assertEqual(debug_stats["totalDwoFileCount"], 2)
651-
self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 2)
652-
653515

654516
@skipUnlessDarwin
655517
@no_debug_info_test

lldb/test/API/commands/statistics/basic/baz.cpp

Lines changed: 0 additions & 12 deletions
This file was deleted.

lldb/test/API/commands/statistics/basic/third.cpp

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)