Skip to content

Conversation

zw3917
Copy link
Contributor

@zw3917 zw3917 commented Aug 22, 2025

Summary

A new totalDwoErrorCount counter is available in statistics when calling statistics dump to track the number of DWO errors.
Additionally, this PR refactors the DWO file statistics by consolidating the existing functionality for counting loaded and total DWO files together with the number of DWO errors into a single function that returns a new DWOStats struct.

  1. A new struct, DWOStats is created to hold the number of loaded DWO files, the total number of DWO files and the number of DWO errors.
  2. Replaced the previous GetDwoFileCounts function for loaded and total DWO file counts with a single GetDwoStats() function returning the struct DWOStats. An override is implemented for SymbolFileDWARF that computes the new DWO error count alongside existing counts in one pass. If the status of a DWO CU is Fail, which means there is error happened during the loading process, we increment the DWO error counter.
    Note: The newly created function GetDwoStats will only be called when we try to get statistics. Other codepaths will not be affected.
  3. In Statistics, we sum up the total number of DWO file loading errors. This is done by getting DWOStats for each symbol file and adding up the results for each module, then adding to the total count among all modules.
  4. In Statistics, we also updated call sites to use the new combined function and struct for loaded and total DWO file counts. As it is possible for one module to have several symbol files, the DWO file counts in a module's stats are updated to be calculated by adding up the counts from all symbol files.

Expected Behavior

  • When binaries are compiled with split-dwarf and separate DWO files, totalDwoLoadErrorCount would be the number of dwo files with error occurs during the loading process, 0 if no error occurs during a loading process.

  • When not using split-dwarf, we expect totalDwoLoadErrorCount to be 0 since there no DWO file loading errors would be caused.

  • totalLoadedDwoFileCount and totalDwoFileCount should be correctly calculated after refactoring and updating.

Testing

Manual Testing

We created some files to simulate the possible DWO errors manually and observed the results generated by statistics dump.
For example, if we delete one of the DWO files generated after compiling, we would get:

(lldb) statistics dump
{
  ...
  "totalDwoLoadErrorCount": 1,
  ...
}

We also checked the time cost of statistics dump w/o the modification to make sure no significant time cost increase imported.

Unit test

Added two unit tests that build with new "dwo_error_foo.cpp" and "dwo_error_main.cpp" files. For tests with flags -gsplit-dwarf, this generates 2 DWO files.
In one of the tests, we delete both DWO files and check the result to see if it reflects the number of DWO files with errors correctly. In another test we update one of the files but loading the outdated .dwo file of it, expecting it increments the error count by 1.
To run the test:

$ bin/lldb-dotest -p TestStats.py ~/local/llvm-project/lldb/test/API/commands/statistics/basic/ -G "dwo"
----------------------------------------------------------------------
Ran 27 tests in 2.680s

OK (skipped=21)

$ bin/lldb-dotest -p TestStats.py ~/local/llvm-project/lldb/test/API/commands/statistics/basic/
----------------------------------------------------------------------
Ran 27 tests in 370.131s

OK (skipped=3)

@zw3917 zw3917 requested a review from JDevlieghere as a code owner August 22, 2025 20:04
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the lldb label Aug 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 22, 2025

@llvm/pr-subscribers-lldb

Author: Ziyi Wang (zw3917)

Changes

Summary

A new totalDwoLoadErrorCount counter to available statisctics when calling statistics dump.

  1. A new function, CountDwoLoadErrors is created, and returns the number of DWO file loading errors. An override is implemented for SymbolFileDWARF that loops through each compile unit, and uses GetDwoError to get its dwo loading status. It the status is as Fail, which means there is error happened during the loading process, we increment the counter.
  2. In Statistics, we sum up the total number of DWO file loading errors. This is done by getting current_dwo_errors for each sym_file and adding up the results for each module, then adding to the total count of errors among all modules.

Expected Behavior

  • When binaries are compiled with split-dwarf and separate DWO files, totalDwoLoadErrorCount would be the number of dwo files with error occurs during the loading process, 0 if no error occurs during a loading process.

  • When not using split-dwarf, we expect totalDwoLoadErrorCount to be 0 since there no DWO file loading errors would be caused.

Testing

Manual Testing

We created some files to simulate the possible DWO errors manually and observed the results generated by statistics dump.
For example, if we delete one of the DWO files generated after compiling, we would get:

(lldb) statistics dump
{
  ...
  "totalLoadedDwoFileCount": 1,
}

We also checked the time cost of statistics dump w/o the modification to make sure no significant time cost increase imported.

Unit test

Added two unit tests that build with new "dwo_error_foo.cpp" and "dwo_error_main.cpp" files. For tests with flags -gsplit-dwarf, this generates 2 DWO files.
In one of the tests, we delete both DWO files and check the result to see if it reflects the number of DWO files with errors correctly. In another test we update one of the files but loading the outdated .dwo file of it, expecting it increments the error count by 1.
To run the test:

$ bin/lldb-dotest -p TestStats.py ~/local/llvm-project/lldb/test/API/commands/statistics/basic/ -G "dwo"
----------------------------------------------------------------------
Ran 27 tests in 7.439s

OK (skipped=21)

Full diff: https://github.com/llvm/llvm-project/pull/155023.diff

8 Files Affected:

  • (modified) lldb/include/lldb/Symbol/SymbolFile.h (+4)
  • (modified) lldb/include/lldb/Target/Statistics.h (+1)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+18)
  • (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+3)
  • (modified) lldb/source/Target/Statistics.cpp (+6)
  • (modified) lldb/test/API/commands/statistics/basic/TestStats.py (+115)
  • (added) lldb/test/API/commands/statistics/basic/dwo_error_foo.cpp (+10)
  • (added) lldb/test/API/commands/statistics/basic/dwo_error_main.cpp (+5)
diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h
index bbc615d9fdc38..7f590fc2e7e64 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -496,6 +496,10 @@ class SymbolFile : public PluginInterface {
   ///     symbol file doesn't support DWO files, both counts will be 0.
   virtual std::pair<uint32_t, uint32_t> GetDwoFileCounts() { return {0, 0}; }
 
+  /// Calculates the count of dwo load error, return the number of dwo file with
+  /// errors, 0 by default.
+  virtual uint32_t CountDwoLoadErrors() { return 0; }
+
   virtual lldb::TypeSP
   MakeType(lldb::user_id_t uid, ConstString name,
            std::optional<uint64_t> byte_size, SymbolContextScope *context,
diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h
index 55dff8861a9ab..6dd09cac890b8 100644
--- a/lldb/include/lldb/Target/Statistics.h
+++ b/lldb/include/lldb/Target/Statistics.h
@@ -155,6 +155,7 @@ struct ModuleStats {
   bool debug_info_had_incomplete_types = false;
   uint32_t dwo_file_count = 0;
   uint32_t loaded_dwo_file_count = 0;
+  uint32_t dwo_load_error_count = 0;
 };
 
 struct ConstStringStats {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b15e0c15fedb8..5c95200abd1bd 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4530,3 +4530,21 @@ std::pair<uint32_t, uint32_t> SymbolFileDWARF::GetDwoFileCounts() {
 
   return {loaded_dwo_count, total_dwo_count};
 }
+
+uint32_t SymbolFileDWARF::CountDwoLoadErrors() {
+  uint32_t dwo_load_error_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 unit has dwo error (False by default).
+    const Status &dwo_error = dwarf_cu->GetDwoError();
+    if (dwo_error.Fail())
+      dwo_load_error_count++;
+  }
+  return dwo_load_error_count;
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index d7db8a3c0869f..349ea9ef8224b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -288,6 +288,9 @@ class SymbolFileDWARF : public SymbolFileCommon {
   // CUs and total DWO CUs. For non-split-dwarf files, this reports 0 for both.
   std::pair<uint32_t, uint32_t> GetDwoFileCounts() override;
 
+  /// Count the number of dwo load errors happened.
+  uint32_t CountDwoLoadErrors() override;
+
   DWARFContext &GetDWARFContext() { return m_context; }
 
   const std::shared_ptr<SymbolFileDWARFDwo> &GetDwpSymbolFile();
diff --git a/lldb/source/Target/Statistics.cpp b/lldb/source/Target/Statistics.cpp
index 909f335687b21..0f9eb5a785163 100644
--- a/lldb/source/Target/Statistics.cpp
+++ b/lldb/source/Target/Statistics.cpp
@@ -75,6 +75,7 @@ json::Value ModuleStats::ToJSON() const {
   module.try_emplace("symbolTableSymbolCount", symtab_symbol_count);
   module.try_emplace("dwoFileCount", dwo_file_count);
   module.try_emplace("loadedDwoFileCount", loaded_dwo_file_count);
+  module.try_emplace("dwoLoadErrorCount", dwo_load_error_count);
 
   if (!symbol_locator_time.map.empty()) {
     json::Object obj;
@@ -326,6 +327,7 @@ llvm::json::Value DebuggerStats::ReportStatistics(
   uint32_t symtab_symbol_count = 0;
   uint32_t total_loaded_dwo_file_count = 0;
   uint32_t total_dwo_file_count = 0;
+  uint32_t total_dwo_load_error_count = 0;
   for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) {
     Module *module = target != nullptr
                          ? target->GetImages().GetModuleAtIndex(image_idx).get()
@@ -361,6 +363,9 @@ llvm::json::Value DebuggerStats::ReportStatistics(
           sym_file->GetDwoFileCounts();
       total_dwo_file_count += module_stat.dwo_file_count;
       total_loaded_dwo_file_count += module_stat.loaded_dwo_file_count;
+      uint32_t current_dwo_errors = sym_file->CountDwoLoadErrors();
+      module_stat.dwo_load_error_count += current_dwo_errors;
+      total_dwo_load_error_count += current_dwo_errors;
       module_stat.debug_info_index_loaded_from_cache =
           sym_file->GetDebugInfoIndexWasLoadedFromCache();
       if (module_stat.debug_info_index_loaded_from_cache)
@@ -437,6 +442,7 @@ llvm::json::Value DebuggerStats::ReportStatistics(
       {"totalSymbolTableSymbolCount", symtab_symbol_count},
       {"totalLoadedDwoFileCount", total_loaded_dwo_file_count},
       {"totalDwoFileCount", total_dwo_file_count},
+      {"totalDwoLoadErrorCount", total_dwo_load_error_count},
   };
 
   if (include_targets) {
diff --git a/lldb/test/API/commands/statistics/basic/TestStats.py b/lldb/test/API/commands/statistics/basic/TestStats.py
index e9ee8b8661e5a..7a2dc213ce6fd 100644
--- a/lldb/test/API/commands/statistics/basic/TestStats.py
+++ b/lldb/test/API/commands/statistics/basic/TestStats.py
@@ -1,6 +1,8 @@
+import glob
 import json
 import os
 import re
+import shutil
 
 import lldb
 from lldbsuite.test.decorators import *
@@ -179,6 +181,7 @@ def test_default_no_run(self):
             "totalDebugInfoParseTime",
             "totalDwoFileCount",
             "totalLoadedDwoFileCount",
+            "totalDwoLoadErrorCount",
         ]
         self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
         if self.getPlatform() != "windows":
@@ -291,6 +294,7 @@ def test_default_with_run(self):
             "totalDebugInfoParseTime",
             "totalDwoFileCount",
             "totalLoadedDwoFileCount",
+            "totalDwoLoadErrorCount",
         ]
         self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
         stats = debug_stats["targets"][0]
@@ -331,6 +335,7 @@ def test_memory(self):
             "totalDebugInfoByteSize",
             "totalDwoFileCount",
             "totalLoadedDwoFileCount",
+            "totalDwoLoadErrorCount",
         ]
         self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
 
@@ -385,6 +390,7 @@ def test_modules(self):
             "totalDebugInfoByteSize",
             "totalDwoFileCount",
             "totalLoadedDwoFileCount",
+            "totalDwoLoadErrorCount",
         ]
         self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
         stats = debug_stats["targets"][0]
@@ -407,6 +413,7 @@ def test_modules(self):
             "symbolTableSavedToCache",
             "dwoFileCount",
             "loadedDwoFileCount",
+            "dwoLoadErrorCount",
             "triple",
             "uuid",
         ]
@@ -497,6 +504,7 @@ def test_breakpoints(self):
             "totalDebugInfoByteSize",
             "totalDwoFileCount",
             "totalLoadedDwoFileCount",
+            "totalDwoLoadErrorCount",
         ]
         self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
         target_stats = debug_stats["targets"][0]
@@ -655,6 +663,113 @@ def test_dwp_dwo_file_count(self):
         self.assertEqual(debug_stats["totalDwoFileCount"], 2)
         self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 2)
 
+    @add_test_categories(["dwo"])
+    def test_dwo_missing_error_stats(self):
+        """
+        Test that DWO missing errors are reported correctly in statistics.
+        This test:
+        1) Builds a program with split DWARF (.dwo files)
+        2) Delete all two .dwo files
+        3) Verify that 2 DWO load errors are reported in statistics
+        """
+        da = {
+            "CXX_SOURCES": "dwo_error_main.cpp dwo_error_foo.cpp",
+            "EXE": self.getBuildArtifact("a.out"),
+        }
+        # -gsplit-dwarf creates separate .dwo files,
+        # Expected output: dwo_error_main.dwo (contains main) and dwo_error_foo.dwo (contains foo struct/function)
+        self.build(dictionary=da, debug_info="dwo")
+        self.addTearDownCleanup(dictionary=da)
+        exe = self.getBuildArtifact("a.out")
+
+        # Remove the two .dwo files to trigger a DWO load error
+        dwo_files = glob.glob(self.getBuildArtifact("*.dwo"))
+        for dwo_file in dwo_files:
+            os.rename(dwo_file, dwo_file + ".bak")
+
+        target = self.createTestTarget(file_path=exe)
+        debug_stats = self.get_stats()
+
+        # Check DWO load error statistics are reported
+        self.assertIn("totalDwoLoadErrorCount", debug_stats)
+        self.assertEqual(debug_stats["totalDwoLoadErrorCount"], 2)
+
+        # Since there's only one module, module stats should have the same count as total count
+        self.assertIn("dwoLoadErrorCount", debug_stats["modules"][0])
+        self.assertEqual(debug_stats["modules"][0]["dwoLoadErrorCount"], 2)
+
+        # Restore the original .dwo file
+        for dwo_file in dwo_files:
+            os.rename(dwo_file + ".bak", dwo_file)
+
+    @add_test_categories(["dwo"])
+    def test_dwo_id_mismatch_error_stats(self):
+        """
+        Test that DWO ID mismatch errors are reported correctly in statistics.
+        This test:
+        1) Builds a program with split DWARF (.dwo files)
+        2) Change one of the source file content and rebuild
+        3) Replace the new .dwo file with the original one to create a DWO ID mismatch
+        4) Verifies that a DWO load error is reported in statistics
+        5) Restores the original source file
+        """
+        da = {
+            "CXX_SOURCES": "dwo_error_main.cpp dwo_error_foo.cpp",
+            "EXE": self.getBuildArtifact("a.out"),
+        }
+        # -gsplit-dwarf creates separate .dwo files,
+        # Expected output: dwo_error_main.dwo (contains main) and dwo_error_foo.dwo (contains foo struct/function)
+        self.build(dictionary=da, debug_info="dwo")
+        self.addTearDownCleanup(dictionary=da)
+        exe = self.getBuildArtifact("a.out")
+
+        # Find and make a backup of the original .dwo file
+        dwo_files = glob.glob(self.getBuildArtifact("*.dwo"))
+
+        original_dwo_file = dwo_files[1]
+        original_dwo_backup = original_dwo_file + ".bak"
+        shutil.copy2(original_dwo_file, original_dwo_backup)
+
+        target = self.createTestTarget(file_path=exe)
+        initial_stats = self.get_stats()
+        self.assertIn("totalDwoLoadErrorCount", initial_stats)
+        self.assertEqual(initial_stats["totalDwoLoadErrorCount"], 0)
+        self.dbg.DeleteTarget(target)
+
+        # Get the original file size before modification
+        source_file_path = self.getSourcePath("dwo_error_foo.cpp")
+        original_size = os.path.getsize(source_file_path)
+
+        try:
+            # Modify the source code  and rebuild
+            with open(source_file_path, "a") as f:
+                f.write("\n void additional_foo(){}\n")
+
+            # Rebuild and replace the new .dwo file with the original one
+            self.build(dictionary=da, debug_info="dwo")
+            shutil.copy2(original_dwo_backup, original_dwo_file)
+
+            # Create a new target and run to a breakpoint to force DWO file loading
+            target = self.createTestTarget(file_path=exe)
+            debug_stats = self.get_stats()
+
+            # Check that DWO load error statistics are reported
+            self.assertIn("totalDwoLoadErrorCount", debug_stats)
+            self.assertEqual(debug_stats["totalDwoLoadErrorCount"], 1)
+
+            # Since there's only one module, module stats should have the same count as total count
+            self.assertIn("dwoLoadErrorCount", debug_stats["modules"][0])
+            self.assertEqual(debug_stats["modules"][0]["dwoLoadErrorCount"], 1)
+
+        finally:
+            # Remove the appended content
+            with open(source_file_path, "a") as f:
+                f.truncate(original_size)
+
+            # Restore the original .dwo file
+            if os.path.exists(original_dwo_backup):
+                os.unlink(original_dwo_backup)
+
     @skipUnlessDarwin
     @no_debug_info_test
     def test_dsym_binary_has_symfile_in_stats(self):
diff --git a/lldb/test/API/commands/statistics/basic/dwo_error_foo.cpp b/lldb/test/API/commands/statistics/basic/dwo_error_foo.cpp
new file mode 100644
index 0000000000000..41618bdcee958
--- /dev/null
+++ b/lldb/test/API/commands/statistics/basic/dwo_error_foo.cpp
@@ -0,0 +1,10 @@
+struct foo {
+  int x;
+  bool y;
+};
+
+void dwo_error_foo() {
+  foo f;
+  f.x = 1;
+  f.y = true;
+}
diff --git a/lldb/test/API/commands/statistics/basic/dwo_error_main.cpp b/lldb/test/API/commands/statistics/basic/dwo_error_main.cpp
new file mode 100644
index 0000000000000..4f09bd74e1fd6
--- /dev/null
+++ b/lldb/test/API/commands/statistics/basic/dwo_error_main.cpp
@@ -0,0 +1,5 @@
+void dwo_error_foo();
+int main() {
+  dwo_error_foo();
+  return 0;
+}

@zw3917
Copy link
Contributor Author

zw3917 commented Aug 22, 2025

cc @zhyty @jeffreytan81 @clayborg

@zhyty zhyty requested review from clayborg and jeffreytan81 August 22, 2025 23:12
Comment on lines 499 to 502
/// Calculates the count of dwo load error, return the number of dwo file with
/// errors, 0 by default.
virtual uint32_t CountDwoLoadErrors() { return 0; }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be best to modify the GetDwoFileCounts function to return a simple struct and rename it:

struct DWOStats {
  uint32_t loaded_dwo_file_count = 0;
  uint32_t dwo_file_count = 0;
  uint32_t dwo_error_count = 0;
};

virtual DWOStats GetDwoStats() { return {}; }

This will replace both GetDwoFileCounts() and CountDwoLoadErrors()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out! Just updated the implementation to use the new structure.

@zw3917 zw3917 changed the title [lldb] Add count for errors of DWO files in statistics [lldb] Add count for errors of DWO files in statistics and combine DWO file count functions Aug 24, 2025
@zw3917 zw3917 requested a review from clayborg August 24, 2025 23:36
Copy link
Collaborator

@clayborg clayborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One quick change suggested to re-use the new DWOStats struct instead of creating 3 local variables.

Comment on lines 156 to 158
uint32_t dwo_file_count = 0;
uint32_t loaded_dwo_file_count = 0;
uint32_t dwo_error_count = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change these three lines to:

DWOStats dwo_stats;

@zw3917 zw3917 requested a review from clayborg August 29, 2025 00:26
Copy link
Collaborator

@clayborg clayborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more round of changes just removing any auto clang-format changes that are not part of this PR. When committing PRs to upstream, we want to make sure any noise that isn't related to the PR is not part of the PR itself like whitespace and re-indentation formatting fixes that are not on the lines that you have modified. You might need to disable the auto clang format stuff and then update this PR. This should be good to go after those non-related changes are removed.

@zw3917 zw3917 requested a review from clayborg September 2, 2025 06:16
@zhyty zhyty merged commit 55e3b6d into llvm:main Sep 3, 2025
9 checks passed
Copy link

github-actions bot commented Sep 3, 2025

@zw3917 Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@jurahul
Copy link
Contributor

jurahul commented Sep 3, 2025

Looks like this is causing CI failures:

https://github.com/llvm/llvm-project/actions/runs/17447604540/job/49545718661?pr=156734

FAIL: lldb-api :: commands/statistics/basic/TestStats.py (1103 of 3051)
  ******************** TEST 'lldb-api :: commands/statistics/basic/TestStats.py' FAILED ********************
  Script:
  --
  /usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib --env LLVM_INCLUDE_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include --env LLVM_TOOLS_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin --libcxx-include-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/include/c++/v1 --libcxx-include-target-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/include/x86_64-unknown-linux-gnu/c++/v1 --libcxx-library-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib/x86_64-unknown-linux-gnu --arch x86_64 --build-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex --lldb-module-cache-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/lldb --compiler /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang --dsymutil /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin --lldb-obj-root /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb --lldb-libs-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib --cmake-build-type Release /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/commands/statistics/basic -p TestStats.py
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  lldb version 22.0.0git (https://github.com/llvm/llvm-project revision a5c834d22ed0144c7631051aeb520e7abcbb546f)
    clang revision a5c834d22ed0144c7631051aeb520e7abcbb546f
    llvm revision a5c834d22ed0144c7631051aeb520e7abcbb546f
  Skipping the following test categories: ['msvcstl', 'dsym', 'gmodules', 'debugserver', 'objc']
  

@tstellar
Copy link
Collaborator

tstellar commented Sep 4, 2025

Were these changes AI generated?

dmpots added a commit that referenced this pull request Sep 4, 2025
…mbine DWO file count functions" (#156777)

Reverts #155023

The PR tests passed, but it failed in the CI. Reverting to give time to
investigate.
@zw3917
Copy link
Contributor Author

zw3917 commented Sep 4, 2025

Looks like this is causing CI failures:

https://github.com/llvm/llvm-project/actions/runs/17447604540/job/49545718661?pr=156734

FAIL: lldb-api :: commands/statistics/basic/TestStats.py (1103 of 3051)
  ******************** TEST 'lldb-api :: commands/statistics/basic/TestStats.py' FAILED ********************
  Script:
  --
  /usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib --env LLVM_INCLUDE_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include --env LLVM_TOOLS_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin --libcxx-include-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/include/c++/v1 --libcxx-include-target-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/include/x86_64-unknown-linux-gnu/c++/v1 --libcxx-library-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib/x86_64-unknown-linux-gnu --arch x86_64 --build-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex --lldb-module-cache-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/lldb --compiler /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang --dsymutil /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin --lldb-obj-root /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb --lldb-libs-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib --cmake-build-type Release /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/commands/statistics/basic -p TestStats.py
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  lldb version 22.0.0git (https://github.com/llvm/llvm-project revision a5c834d22ed0144c7631051aeb520e7abcbb546f)
    clang revision a5c834d22ed0144c7631051aeb520e7abcbb546f
    llvm revision a5c834d22ed0144c7631051aeb520e7abcbb546f
  Skipping the following test categories: ['msvcstl', 'dsym', 'gmodules', 'debugserver', 'objc']
  

Thanks for pointing out this. We have reverted this PR and will try to find the issue here.

@zw3917
Copy link
Contributor Author

zw3917 commented Sep 4, 2025

Were these changes AI generated?

Don't know why you are asking this, but NO.

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 4, 2025
…tics and combine DWO file count functions" (#156777)

Reverts llvm/llvm-project#155023

The PR tests passed, but it failed in the CI. Reverting to give time to
investigate.
ckoparkar added a commit to ckoparkar/llvm-project that referenced this pull request Sep 4, 2025
* main: (1483 commits)
  [clang] fix error recovery for invalid nested name specifiers (llvm#156772)
  Revert "[lldb] Add count for errors of DWO files in statistics and combine DWO file count functions" (llvm#156777)
  AMDGPU: Add agpr variants of multi-data DS instructions (llvm#156420)
  [libc][NFC] disable localtime on aarch64/baremetal (llvm#156776)
  [win/asan] Improve SharedReAlloc with HEAP_REALLOC_IN_PLACE_ONLY. (llvm#132558)
  [LLDB] Make internal shell the default for running LLDB lit tests. (llvm#156729)
  [lldb][debugserver] Max response size for qSpeedTest (llvm#156099)
  [AMDGPU] Define 1024 VGPRs on gfx1250 (llvm#156765)
  [flang] Check for BIND(C) name conflicts with alternate entries (llvm#156563)
  [RISCV] Add exhausted_gprs_fprs test to calling-conv-half.ll. NFC (llvm#156586)
  [NFC] Remove trailing whitespaces from `clang/include/clang/Basic/AttrDocs.td`
  [lldb] Mark scripted frames as synthetic instead of artificial (llvm#153117)
  [docs] Refine some of the wording in the quality developer policy (llvm#156555)
  [MLIR] Apply clang-tidy fixes for readability-identifier-naming in TransformOps.cpp (NFC)
  [MLIR] Add LDBG() tracing to VectorTransferOpTransforms.cpp (NFC)
  [NFC] Apply clang-format to PPCInstrFutureMMA.td (llvm#156749)
  [libc] implement template functions for localtime (llvm#110363)
  [llvm-objcopy][COFF] Update .symidx values after stripping (llvm#153322)
  Add documentation on debugging LLVM.
  [lldb] Add count for errors of DWO files in statistics and combine DWO file count functions (llvm#155023)
  ...
dmpots pushed a commit that referenced this pull request Sep 9, 2025
…bine DWO file count functions" (#156980)

This relands changes in #155023
for adding a count of dwo errors and combine all the dwo related stats
into one struct.

The previous PR was reverted in
#156777 as the newly added unit
test `test_dwo_id_mismatch_error_stats` sometimes fails due to
inappropriate use of `glob.glob`.
This change modified the tests created in the former PR to collect and
modify the dwo files by there names instead of using index after
`glob.glob`. This will avoid the possible failure in these tests if the
order of dwo files changes.

[Original PR:
https://github.com/llvm/llvm-project/pull/155023](https://github.com/llvm/llvm-project/pull/155023)

## Testing
Ran unit tests
```
$ ./bin/llvm-lit /data/users/ziyiww/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py
./bin/llvm-lit /data/users/ziyiww/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py -v
-- Testing: 1 tests, 1 workers --
PASS: lldb-api :: commands/statistics/basic/TestStats.py (1 of 1)

Testing Time: 388.52s

Total Discovered Tests: 1
  Passed: 1 (100.00%)

$ bin/lldb-dotest -p TestStats.py /data/users/ziyiww/llvm-project/lldb/test/API/commands/statistics/basic/
----------------------------------------------------------------------
Ran 27 tests in 386.302s

OK (skipped=3)
```
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 9, 2025
…ics and combine DWO file count functions" (#156980)

This relands changes in llvm/llvm-project#155023
for adding a count of dwo errors and combine all the dwo related stats
into one struct.

The previous PR was reverted in
llvm/llvm-project#156777 as the newly added unit
test `test_dwo_id_mismatch_error_stats` sometimes fails due to
inappropriate use of `glob.glob`.
This change modified the tests created in the former PR to collect and
modify the dwo files by there names instead of using index after
`glob.glob`. This will avoid the possible failure in these tests if the
order of dwo files changes.

[Original PR:
https://github.com/llvm/llvm-project/pull/155023](https://github.com/llvm/llvm-project/pull/155023)

## Testing
Ran unit tests
```
$ ./bin/llvm-lit /data/users/ziyiww/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py
./bin/llvm-lit /data/users/ziyiww/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py -v
-- Testing: 1 tests, 1 workers --
PASS: lldb-api :: commands/statistics/basic/TestStats.py (1 of 1)

Testing Time: 388.52s

Total Discovered Tests: 1
  Passed: 1 (100.00%)

$ bin/lldb-dotest -p TestStats.py /data/users/ziyiww/llvm-project/lldb/test/API/commands/statistics/basic/
----------------------------------------------------------------------
Ran 27 tests in 386.302s

OK (skipped=3)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants