llvm-project/lldb/test/API
Greg Clayton 3db7cc1ba4 Fix a double debug info size counting in top level stats for "statistics dump".
This mainly affects Darwin targets (macOS, iOS, tvOS and watchOS) when these targets don't use dSYM files and the debug info was in the .o files. All modules, including the .o files that are loaded by the debug maps, were in the global module list. This was great because it allows us to see each .o file and how much it contributes. There were virtual functions on the SymbolFile class to fetch the symtab/debug info parse and index times, and also the total debug info size. So the main executable would add all of the .o file's stats together and report them as its own data. Then the "totalDebugInfoSize" and many other "totalXXX" top level totals were all being added together. This stems from the fact that my original patch only emitted the modules for a target at the start of the patch, but as comments from the reviews came in, we switched to emitting all of the modules from the global module list.

So this patch fixes it so when we have a SymbolFileDWARFDebugMap that loads .o files, the main executable will have no debug info size or symtab/debug info parse/index times, but each .o file will have its own data as a separate module. Also, to be able to tell when/if we have a dSYM file I have added a "symbolFilePath" if the SymbolFile for the main modules path doesn't match that of the main executable. We also include a "symbolFileModuleIdentifiers" key in each module if the module does have multiple lldb_private::Module objects that contain debug info so that you can track down the information for a module and add up the contributions of all of the .o files.

Tests were added that are labeled with @skipUnlessDarwin and @no_debug_info_test that test all of this functionality so it doesn't regress.

For a module with a dSYM file, we can see the "symbolFilePath" is included:
```
  "modules": [
    {
      "debugInfoByteSize": 1070,
      "debugInfoIndexLoadedFromCache": false,
      "debugInfoIndexSavedToCache": false,
      "debugInfoIndexTime": 0,
      "debugInfoParseTime": 0,
      "identifier": 4873280600,
      "path": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_dsym_binary_has_symfile_in_stats/a.out",
      "symbolFilePath": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_dsym_binary_has_symfile_in_stats/a.out.dSYM/Contents/Resources/DWARF/a.out",
      "symbolTableIndexTime": 7.9999999999999996e-06,
      "symbolTableLoadedFromCache": false,
      "symbolTableParseTime": 7.8999999999999996e-05,
      "symbolTableSavedToCache": false,
      "triple": "arm64-apple-macosx12.0.0",
      "uuid": "E1F7D85B-3A42-321E-BF0D-29B103F5F2E3"
    },
```
And for the DWARF in .o file case we can see the "symbolFileModuleIdentifiers" in the executable's module stats:
```
  "modules": [
    {
      "debugInfoByteSize": 0,
      "debugInfoIndexLoadedFromCache": false,
      "debugInfoIndexSavedToCache": false,
      "debugInfoIndexTime": 0,
      "debugInfoParseTime": 0,
      "identifier": 4603526968,
      "path": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_no_dsym_binary_has_symfile_identifiers_in_stats/a.out",
      "symbolFileModuleIdentifiers": [
        4604429832
      ],
      "symbolTableIndexTime": 7.9999999999999996e-06,
      "symbolTableLoadedFromCache": false,
      "symbolTableParseTime": 0.000112,
      "symbolTableSavedToCache": false,
      "triple": "arm64-apple-macosx12.0.0",
      "uuid": "57008BF5-A726-3DE9-B1BF-3A9AD3EE8569"
    },
```
And the .o file for 4604429832 looks like:
```
    {
      "debugInfoByteSize": 1028,
      "debugInfoIndexLoadedFromCache": false,
      "debugInfoIndexSavedToCache": false,
      "debugInfoIndexTime": 0,
      "debugInfoParseTime": 6.0999999999999999e-05,
      "identifier": 4604429832,
      "path": "/Users/gclayton/Documents/src/lldb/main/Debug/lldb-test-build.noindex/commands/statistics/basic/TestStats.test_no_dsym_binary_has_symfile_identifiers_in_stats/main.o",
      "symbolTableIndexTime": 0,
      "symbolTableLoadedFromCache": false,
      "symbolTableParseTime": 0,
      "symbolTableSavedToCache": false,
      "triple": "arm64-apple-macosx"
    }
```

Differential Revision: https://reviews.llvm.org/D119400
2022-02-10 10:55:18 -08:00
..
android/platform [lldb] Remove lldbtest.getBuildFlags 2021-12-30 12:19:24 +01:00
api [lldb] Remove support for replaying the test suite from a reproducer 2021-09-30 10:47:19 -07:00
arm [lldb/test] Skip TestBreakpointThumbCodesection on arm64. 2020-06-25 16:20:27 -07:00
assert_messages_test [lldb] Introduce createTestTarget for creating a valid target in API tests 2021-05-24 16:18:44 +02:00
benchmarks
commands Fix a double debug info size counting in top level stats for "statistics dump". 2022-02-10 10:55:18 -08:00
driver/batch_mode [LLDB] Skip random fails on Arm/AArch64 Linux buildbot 2021-08-09 13:53:48 +05:00
functionalities [lldb/test] Split Scripted Process test in multiple tests (NFC) 2022-02-09 13:28:20 -08:00
iohandler [LLDB] Skip TestIOHandlerPythonREPLSigint.py on AArch64/Linux 2022-01-15 03:24:26 +05:00
lang [lldb] Disable failing test on Windows 2022-02-09 20:40:50 +01:00
linux Reland "[lldb] Remove non address bits when looking up memory regions" 2022-02-10 10:42:49 +00:00
lua_api [lldb/lua] Supplement Lua bindings for lldb module 2021-10-12 22:10:21 +08:00
macosx [lldb] Update outdated comment in TestDyldTrieSymbols.py 2022-02-07 08:13:54 -08:00
python_api [lldb/test] Skip TestSBModule unless darwin 2022-01-27 01:05:12 +01:00
qemu [lldb/qemu] Set qemu's "ld prefix" based on the platform sysroot 2022-01-03 14:48:13 +01:00
repl/clang [LLDB] Skip TestClangREPL.py on Arm/AArch64 Linux 2021-10-04 11:50:17 +05:00
sample_test [lldb] Readd deleted variable in the sample test 2021-05-24 16:29:25 +02:00
sanity
source-manager [lldb/Target] Refine source display warning for artificial locations (NFC) 2021-12-09 14:38:14 -08:00
terminal [LLDB] Skip flaky tests on Arm/AArch64 Linux bots 2021-08-04 16:57:36 +05:00
test_runner/test
test_utils [lldb/test] Print build commands in trace mode 2021-10-29 11:33:31 +02:00
tools [lldb] Account for extra threads in TestGdbRemoteThreadsInStopReply on windows 2022-02-09 17:42:54 +01:00
types [lldb] Remove support for replaying the test suite from a reproducer 2021-09-30 10:47:19 -07:00
CMakeLists.txt [lldb] Copy the system debugserver in LLDB.framework 2021-09-24 15:07:22 -07:00
dotest.py
get_darwin_real_python.py
lit.cfg.py [lldb] Use lit_config.note to print module cache message 2022-01-07 13:35:18 -08:00
lit.site.cfg.py.in [lldb/lua] Supplement Lua bindings for lldb module 2021-10-12 22:10:21 +08:00
lldbtest.py [lldb/lua] Supplement Lua bindings for lldb module 2021-10-12 22:10:21 +08:00
use_lldb_suite.py [lldb/test] Use realpath consistently for test root file paths. 2020-08-05 11:35:37 -07:00