llvm-project
7bd06c41 - Defer loading all DWOs by default when dumping separate_debug-info (#146166)

Commit
70 days ago
Defer loading all DWOs by default when dumping separate_debug-info (#146166) ### Summary Currently `target modules dump separate separate-debug-info` automatically loads up all DWO files, even if deferred loading is enabled through debug_names. Then, as expected all DWO files (assuming there is no error loading it), get marked as "loaded". This change adds the option `--force-load-all-debug-info` or `-f` for short to force loading all debug_info up, if it hasn't been loaded yet. Otherwise, it will change default behavior to not load all debug info so that the correct DWO files will show up for each modules as "loaded" or not "loaded", which could be helpful in cases where we want to know which particular DWO files were loaded. ### Testing #### Unit Tests Added additional unit tests `test_dwos_load_json_with_debug_names_default` and `test_dwos_load_json_with_debug_names_force_load_all` to test both default behavior and loading with the new flag `--force-load-all-debug-info`, and changed expected behavior in `test_dwos_loaded_symbols_on_demand`. ``` bin/lldb-dotest -p TestDumpDwo ~/llvm-project/lldb/test/API/commands/target/dump-separate-debug-info/dwo ``` #### Manual Testing Compiled a simple binary w/ `--gsplit-dwarf --gpubnames` and loaded it up: ``` (lldb) target create "./a.out" Current executable set to '/home/qxy11/hello-world/a.out' (x86_64). (lldb) help target modules dump separate-debug-info List the separate debug info symbol files for one or more target modules. Syntax: target modules dump separate-debug-info <cmd-options> [<filename> [<filename> [...]]] Command Options Usage: target modules dump separate-debug-info [-efj] [<filename> [<filename> [...]]] -e ( --errors-only ) Filter to show only debug info files with errors. -f ( --force-load-all-debug-info ) Load all debug info files. -j ( --json ) Output the details in JSON format. This command takes options and free-form arguments. If your arguments resemble option specifiers (i.e., they start with a - or --), you must use ' -- ' between the end of the command options and the beginning of the arguments. (lldb) target modules dump separate-debug-info --j [ { "separate-debug-info-files": [ { ... "dwo_name": "main.dwo", "loaded": false }, { ... "dwo_name": "foo.dwo", "loaded": false }, { ... "dwo_name": "bar.dwo", "loaded": false } ], } ] (lldb) b main Breakpoint 1: where = a.out`main + 15 at main.cc:3:12, address = 0x00000000000011ff (lldb) target modules dump separate-debug-info --j [ { "separate-debug-info-files": [ { ... "dwo_name": "main.dwo", "loaded": true, "resolved_dwo_path": "/home/qxy11/hello-world/main.dwo" }, { ... "dwo_name": "foo.dwo", "loaded": false }, { ... "dwo_name": "bar.dwo", "loaded": false } ], } ] (lldb) b foo Breakpoint 2: where = a.out`foo(int) + 11 at foo.cc:12:11, address = 0x000000000000121b (lldb) target modules dump separate-debug-info --j [ { "separate-debug-info-files": [ { ... "dwo_name": "main.dwo", "loaded": true, "resolved_dwo_path": "/home/qxy11/hello-world/main.dwo" }, { ... "dwo_name": "foo.dwo", "loaded": true, "resolved_dwo_path": "/home/qxy11/hello-world/foo.dwo" }, { ... "dwo_name": "bar.dwo", "loaded": false } ], } ] (lldb) b bar Breakpoint 3: where = a.out`bar(int) + 11 at bar.cc:10:9, address = 0x000000000000126b (lldb) target modules dump separate-debug-info --j [ { "separate-debug-info-files": [ { ... "dwo_name": "main.dwo", "loaded": true, "resolved_dwo_path": "/home/qxy11/hello-world/main.dwo" }, { ... "dwo_name": "foo.dwo", "loaded": true, "resolved_dwo_path": "/home/qxy11/hello-world/foo.dwo" }, { ... "dwo_name": "bar.dwo", "loaded": true, "resolved_dwo_path": "/home/qxy11/hello-world/bar.dwo" } ], } ] ```
Author
Parents
Loading