aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorqxy11 <yangjanet6@gmail.com>2025-06-23 11:51:08 -0700
committerGitHub <noreply@github.com>2025-06-23 11:51:08 -0700
commit3095d3a47d624b573d0748ee37f8f201d5702b63 (patch)
treec6a4c9e05af0993b3c4bbc6c3ca7d501c195f28b /clang/lib/AST/ByteCode/Compiler.cpp
parent97e8266172533fe9deb701a0851b442298f0f011 (diff)
downloadllvm-3095d3a47d624b573d0748ee37f8f201d5702b63.zip
llvm-3095d3a47d624b573d0748ee37f8f201d5702b63.tar.gz
llvm-3095d3a47d624b573d0748ee37f8f201d5702b63.tar.bz2
[lldb] Add count for number of DWO files loaded in statistics (#144424)
## Summary A new `totalLoadedDwoFileCount` and `totalDwoFileCount` counters to available statisctics when calling "statistics dump". 1. `GetDwoFileCounts ` is created, and returns a pair of ints representing the number of loaded DWO files and the total number of DWO files, respectively. An override is implemented for `SymbolFileDWARF` that loops through each compile unit, and adds to a counter if it's a DWO unit, and then uses `GetDwoSymbolFile(false)` to check whether the DWO file was already loaded/parsed. 3. In `Statistics`, use `GetSeparateDebugInfo` to sum up the total number of loaded/parsed DWO files along with the total number of DWO files. This is done by checking whether the DWO file was already successfully `loaded` in the collected DWO data, anding adding to the `totalLoadedDwoFileCount`, and adding to `totalDwoFileCount` for all CU units. ## Expected Behavior - When binaries are compiled with split-dwarf and separate DWO files, `totalLoadedDwoFileCount` would be the number of loaded DWO files and `totalDwoFileCount` would be the total count of DWO files. - When using a DWP file instead of separate DWO files, `totalLoadedDwoFileCount` would be the number of parsed compile units, while `totalDwoFileCount` would be the total number of CUs in the DWP file. This should be similar to the counts we get from loading separate DWO files rather than only counting whether a single DWP file was loaded. - When not using split-dwarf, we expect both `totalDwoFileCount` and `totalLoadedDwoFileCount` to be 0 since no separate debug info is loaded. ## Testing **Manual Testing** On an internal script that has many DWO files, `statistics dump` was called before and after a `type lookup` command. The `totalLoadedDwoFileCount` increased as expected after the `type lookup`. ``` (lldb) statistics dump { ... "totalLoadedDwoFileCount": 29, } (lldb) type lookup folly::Optional<unsigned int>::Storage typedef std::conditional<true, folly::Optional<unsigned int>::StorageTriviallyDestructible, folly::Optional<unsigned int>::StorageNonTriviallyDestructible>::type typedef std::conditional<true, folly::Optional<unsigned int>::StorageTriviallyDestructible, folly::Optional<unsigned int>::StorageNonTriviallyDestructible>::type ... (lldb) statistics dump { ... "totalLoadedDwoFileCount": 2160, } ``` **Unit test** Added three unit tests that build with new "third.cpp" and "baz.cpp" files. For tests with w/ flags `-gsplit-dwarf -gpubnames`, this generates 2 DWO files. Then, the test incrementally adds breakpoints, and does a type lookup, and the count should increase for each of these as new DWO files get loaded to support these. ``` $ bin/lldb-dotest -p TestStats.py ~/llvm-sand/external/llvm-project/lldb/test/API/commands/statistics/basic/ ---------------------------------------------------------------------- Ran 20 tests in 211.738s OK (skipped=3) ```
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
0 files changed, 0 insertions, 0 deletions