[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty closed https://github.com/llvm/llvm-project/pull/71230 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9a3f0cd - Fix crash in lldb-vscode when missing function name
Author: Tom Yang Date: 2023-08-03T12:56:37-07:00 New Revision: 9a3f0cd717f68ccf9e348bce2d76a2372482f4f2 URL: https://github.com/llvm/llvm-project/commit/9a3f0cd717f68ccf9e348bce2d76a2372482f4f2 DIFF: https://github.com/llvm/llvm-project/commit/9a3f0cd717f68ccf9e348bce2d76a2372482f4f2.diff LOG: Fix crash in lldb-vscode when missing function name Summary: In cases where the PC has no function name, lldb-vscode crashes. `lldb::SBFrame::GetDisplayFunctionName()` returns a `nullptr`, and when we attempt to construct an `std::string`, it raises an exception. Test plan: This can be observed with creating a test file (credit to @clayborg for the example): ``` int main() { typedef void (*FooCallback)(); FooCallback foo_callback = (FooCallback)0; foo_callback(); // Crash at zero! return 0; } ``` and attempting to debug the file through VSCode. I add a test case in D156732 which should cover this. Differential Revision: https://reviews.llvm.org/D156970 Added: Modified: lldb/tools/lldb-vscode/JSONUtils.cpp Removed: diff --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp index 5ece7c01346b73..6acb07296da3be 100644 --- a/lldb/tools/lldb-vscode/JSONUtils.cpp +++ b/lldb/tools/lldb-vscode/JSONUtils.cpp @@ -696,7 +696,11 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { int64_t frame_id = MakeVSCodeFrameID(frame); object.try_emplace("id", frame_id); - std::string frame_name = frame.GetDisplayFunctionName(); + // `function_name` can be a nullptr, which throws an error when assigned to an + // `std::string`. + const char *function_name = frame.GetDisplayFunctionName(); + std::string frame_name = + function_name == nullptr ? std::string() : function_name; if (frame_name.empty()) frame_name = ""; bool is_optimized = frame.GetFunction().GetIsOptimized(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 786bab4 - Display PC instead of for stack trace in vscode
Author: Tom Yang Date: 2023-08-04T11:07:27-07:00 New Revision: 786bab43346939d5662c2a90f8c0ff72fe421614 URL: https://github.com/llvm/llvm-project/commit/786bab43346939d5662c2a90f8c0ff72fe421614 DIFF: https://github.com/llvm/llvm-project/commit/786bab43346939d5662c2a90f8c0ff72fe421614.diff LOG: Display PC instead of for stack trace in vscode It isn't useful for users to see "" as a stack trace when lldb fails to symbolicate a stack frame. I've replaced "" with the value of the program counter instead. Test Plan: To test this, I opened a target that lldb fails to symbolicate in VSCode, and observed in the CALL STACK section that instead of being shown as "", those stack frames are represented by their program counters. I added a new test case, `TestVSCode_stackTraceMissingFunctionName` that exercises this feature. I also ran `lldb-dotest -p TestVSCode` and saw that the tests passed. Differential Revision: https://reviews.llvm.org/D156732 Added: lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/Makefile lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/TestVSCode_stackTraceMissingFunctionName.py lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/main.cpp Modified: lldb/tools/lldb-vscode/JSONUtils.cpp Removed: diff --git a/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/Makefile b/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/Makefile new file mode 100644 index 00..3d0b98f13f3d7b --- /dev/null +++ b/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/Makefile @@ -0,0 +1,2 @@ +CXX_SOURCES := main.cpp +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/TestVSCode_stackTraceMissingFunctionName.py b/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/TestVSCode_stackTraceMissingFunctionName.py new file mode 100644 index 00..8e7da6386d8e50 --- /dev/null +++ b/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/TestVSCode_stackTraceMissingFunctionName.py @@ -0,0 +1,26 @@ +""" +Test lldb-vscode stack trace response +""" + + +import vscode +from lldbsuite.test.decorators import * +import os + +import lldbvscode_testcase +from lldbsuite.test import lldbtest, lldbutil + + +class TestVSCode_stackTraceMissingFunctionName(lldbvscode_testcase.VSCodeTestCaseBase): +@skipIfWindows +@skipIfRemote +def test_missingFunctionName(self): +""" +Test that the stack frame without a function name is given its pc in the response. +""" +program = self.getBuildArtifact("a.out") +self.build_and_launch(program) + +self.continue_to_next_stop() +frame_without_function_name = self.get_stackFrames()[0] +self.assertEquals(frame_without_function_name["name"], "0x") diff --git a/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/main.cpp b/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/main.cpp new file mode 100644 index 00..a17a9390e75af1 --- /dev/null +++ b/lldb/test/API/tools/lldb-vscode/stackTraceMissingFunctionName/main.cpp @@ -0,0 +1,6 @@ +int main() { + typedef void (*FooCallback)(); + FooCallback foo_callback = (FooCallback)0; + foo_callback(); // Crash at zero! + return 0; +} diff --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp index 6acb07296da3be..03826f8936ae32 100644 --- a/lldb/tools/lldb-vscode/JSONUtils.cpp +++ b/lldb/tools/lldb-vscode/JSONUtils.cpp @@ -701,8 +701,12 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame &frame) { const char *function_name = frame.GetDisplayFunctionName(); std::string frame_name = function_name == nullptr ? std::string() : function_name; - if (frame_name.empty()) -frame_name = ""; + if (frame_name.empty()) { +// If the function name is unavailable, display the pc address as a 16-digit +// hex string, e.g. "0x00012345" +llvm::raw_string_ostream os(frame_name); +os << llvm::format_hex(frame.GetPC(), 18); + } bool is_optimized = frame.GetFunction().GetIsOptimized(); if (is_optimized) frame_name += " [opt]"; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty review_requested https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty review_requested https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty review_requested https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/66035: Summary: Add a new command ``` target modules dump separate-debug-info [ ...] ``` or ``` image dump separate-debug-info [ ...] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info [ { "separate-debug-info-files": [ { "comp_dir": ".", "dwo_id": 7516252579671439727, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": ".", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out" } ] ``` Example dwo with missing dwo: ``` warning: (x86_64) /home/toyang/workspace/dwp/a.out unable to locate separate debug file (dwo, dwp). Debugging will be degraded. (troubleshoot with https://fburl.com/missing_dwo) Current executable set to '/home/toyang/workspace/dwp/a.out' (x86_64). (lldb) image dump separate-debug-info [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": false } ], "symfile": "/home/toyang/workspace/dwp/a.out" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwp/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwp/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwp/a.out" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` [ { "separate-debug-info-files": [ { "error": "debug map object file \"/Users/toyang/workspace/scratch/main.o\" changed (actual: 0x64e64868, debug map: 0x64e4fb23) since this executable was linked, debug info will not be loaded", "loaded": false, "oso_mod_time": 1692728099, "oso_path": "/Users/toyang/workspace/scratch/main.o", "so_file": "/Users/toyang/workspace/scratch/main.cpp" }, { "error": "debug map object file \"/Users/toyang/workspace/scratch/foo.o\" changed (actual: 0x64e64868, debug map: 0x64e4fb23) since this executable was linked, debug info will not be loaded", "loaded": false, "oso_mod_time": 1692728099, "oso_path": "/Users/toyang/workspace/scratch/foo.o", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a-oso.out" } ] ``` Test Plan: Tested on Mac OS and Linux. ``` lldb-dotest -p TestDumpDwo lldb-dotest -p TestDumpOso ``` Reviewers: Subscribers: Tasks: Tags: >From 3a7096f324e3c8b3ab3206f52e92db3728f59d41 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [ ...] ``` or ``` image dump separate-debug-info [ ...] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info [ { "separate-debug-info-files": [ { "comp_dir": ".", "dwo_id": 7516252579671439727, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": ".", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out" } ] ``` Example dwo with missing dwo: ``` warning: (x86_64) /home/toyang/workspace/dwp/a.out unable to locate separate debug file (dwo, dwp). Debugging will be degraded. (troubleshoot with https://fburl.com/m
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035: >From 0f4cf3648bd1a8d6e9114965e6eb6cdbc7ed01dd Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [ ...] ``` or ``` image dump separate-debug-info [ ...] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info [ { "separate-debug-info-files": [ { "comp_dir": ".", "dwo_id": 7516252579671439727, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": ".", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out" } ] ``` Example dwo with missing dwo: ``` warning: (x86_64) /home/toyang/workspace/dwp/a.out unable to locate separate debug file (dwo, dwp). Debugging will be degraded. (troubleshoot with https://fburl.com/missing_dwo) Current executable set to '/home/toyang/workspace/dwp/a.out' (x86_64). (lldb) image dump separate-debug-info [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": false } ], "symfile": "/home/toyang/workspace/dwp/a.out" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwp/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwp", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwp/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwp/a.out" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` [ { "separate-debug-info-files": [ { "error": "debug map object file \"/Users/toyang/workspace/scratch/main.o\" changed (actual: 0x64e64868, debug map: 0x64e4fb23) since this executable was linked, debug info will not be loaded", "loaded": false, "oso_mod_time": 1692728099, "oso_path": "/Users/toyang/workspace/scratch/main.o", "so_file": "/Users/toyang/workspace/scratch/main.cpp" }, { "error": "debug map object file \"/Users/toyang/workspace/scratch/foo.o\" changed (actual: 0x64e64868, debug map: 0x64e4fb23) since this executable was linked, debug info will not be loaded", "loaded": false, "oso_mod_time": 1692728099, "oso_path": "/Users/toyang/workspace/scratch/foo.o", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a-oso.out" } ] ``` Test Plan: Tested on Mac OS and Linux. ``` lldb-dotest -p TestDumpDwo lldb-dotest -p TestDumpOso ``` Reviewers: Subscribers: Tasks: Tags: --- lldb/include/lldb/Symbol/SymbolFile.h | 11 ++ lldb/source/Commands/CommandObjectTarget.cpp | 146 -- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 58 +++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 5 + .../DWARF/SymbolFileDWARFDebugMap.cpp | 33 +++- .../DWARF/SymbolFileDWARFDebugMap.h | 5 + lldb/source/Symbol/SymbolFile.cpp | 14 ++ .../dump-separate-debug-info/dwo/Makefile | 4 + .../dwo/TestDumpDwo.py| 68 .../dump-separate-debug-info/dwo/foo.cpp | 3 + .../target/dump-separate-debug-info/dwo/foo.h | 6 + .../dump-separate-debug-info/dwo/main.cpp | 3 + .../dump-separate-debug-info/oso/Makefile | 3 + .../oso/TestDumpOso.py| 68 .../dump-separate-debug-info/oso/foo.cpp | 3 + .../target/dump-separate-debug-info/oso/foo.h | 6 + .../dump-separate-debug-info/oso/main.cpp | 3 + 17 files changed, 421 insertions(+), 18 deletions(-) create mode 100644 lldb/test/API/commands/target/dump-separate-debug-info/dwo/Makefile create mode 100644 lldb/test/API/commands/target/dump-separate-de
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
@@ -2462,6 +2483,93 @@ class CommandObjectTargetModulesDumpLineTable CommandOptions m_options; }; +#pragma mark CommandObjectTargetModulesDumpSeparateDebugInfoFiles + +// Image debug dwo dumping command + +class CommandObjectTargetModulesDumpSeparateDebugInfoFiles +: public CommandObjectTargetModulesModuleAutoComplete { +public: + CommandObjectTargetModulesDumpSeparateDebugInfoFiles( + CommandInterpreter &interpreter) + : CommandObjectTargetModulesModuleAutoComplete( +interpreter, "target modules dump separate-debug-info", +"Dump the separate debug info symbol files for one or more target " +"modules.", +//"target modules dump separate-debug-info [ ...]") zhyty wrote: I was following the pattern I noticed for some of the other classes like `CommandObjectTargetModulesDumpSections` where they add the help message as a comment. I don't mind removing it though, since it doesn't seem like *all* of the classes do it. https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035: >From d0538bc86ec02819ed9a24d06a2e7fc355447f4b Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out", "
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035: >From 94b834f747fe66a50288e23fec2d00918f4fc8ef Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out", "
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
zhyty wrote: Updated to show a more human-readable format @jimingham. Also addressed comments by @DavidSpickett. https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035: >From 2bb9a2a245d214bf4201d28037f498da5a94c78f Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out", "
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
@@ -2035,8 +2118,8 @@ class CommandObjectTargetModulesDumpSymtab result.GetOutputStream().EOL(); result.GetOutputStream().EOL(); } - if (INTERRUPT_REQUESTED(GetDebugger(), zhyty wrote: Done. Turns out my editor (correctly) had its "remove trailing whitespace on save" setting set. https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
zhyty wrote: Addressed @clayborg's comments: removed trailing whitespaces, simplify the `SymbolFile` functions into one. https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035 >From 5bf6c4a90bf578af56fb0da30586086fd777bd55 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out", "ty
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035 >From 9a52ac5193af2a8ddca2a5d922684935b043d0ef Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out", "ty
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty resolved https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
zhyty wrote: Added tests for the human-readable/table format. https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
zhyty wrote: > > > I think it would be easier to read the output if you made a separate > > > column for "error". If you imagine a listing where there are 100 OSO's of > > > which 10 are missing, the paths are going to jump over because of the > > > "error: ..." at the beginning of those lines making it messy for your > > > eyes to track. Seems like there are only two possible errors "file not > > > found" and "file out of date", so it seems like we should be able to make > > > a fairly short error column after the ID and then the path? > > > > > > The errors are quite long as they mention the offending path to the OSO and > > the OSO paths are often very long, so you would need to run through the > > results to calculate the max width of the OSO path and then you would > > almost certainly overlflow off the right edge of the terminal if you also > > show the error string. > > This patch currently doesn't show the OSO path if there is an error , so we > > show the error in place of the OSO path as the error string contains the > > path in the error text. Would your prefer to always show the modtime + oso > > path and then add the error on the next line? > > I was imaging something like: > > ``` > (lldb) image dump separate-debug-info > Symbol file: /home/toyang/workspace/dwo-scratch/a.out > Type: "dwo" > Dwo ID Error Dwo Path > -- --- - > 0x9a429da5abb6faae Missing "/home/toyang/workspace/dwo-scratch/a-main.dwo" > for skeleton DIE 0x0014 > 0xbcc129959e76ff33 Missing "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for > skeleton DIE 0x003c > ``` > > Or given that there aren't many errors possible, you could even do a one > letter thing `S` for success, `M` for missing and `O` for out of date. > > If the error was of the form "Not found: ..." or "Out of data:..." then you > could pick off the error string. You're in charge of the error string so you > can arrange to emit it in a way that allows picking this info out of it > easily. And you don't need the path in the error since it's in the next > "path" field anyway. It might be nice having a separate error column with just a one letter thing for now, maybe with just two options "S" and "E" for now. The errors are just arbitrary strings decided by the DWO/OSO-specific logic at the moment -- if we wanted to categorize all of the errors properly, that would probably be outside the scope of this PR? https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035 >From 9a52ac5193af2a8ddca2a5d922684935b043d0ef Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH 1/2] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out",
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
@@ -1462,6 +1464,87 @@ static bool DumpModuleSymbolFile(Stream &strm, Module *module) { return false; } +static bool GetSeparateDebugInfoList(StructuredData::Array &list, + Module *module) { + if (module) { +if (SymbolFile *symbol_file = module->GetSymbolFile(true)) { zhyty wrote: That's not valid syntax, and I'm not sure how to use a single `if` statement to capture the meaning. I could write by declaring `symbol_file` outside of the `if` statement condition, but I think that's unnecessarily verbose. Besides, 10 lines up we do the same thing. https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035 >From 9a52ac5193af2a8ddca2a5d922684935b043d0ef Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH 1/2] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out",
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/66035 >From fe1f2874d91b6583759f43ba5a0ed28b44275ab6 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 11 Sep 2023 17:17:13 -0700 Subject: [PATCH 1/3] Add `target modules dump separate-debug-info` Summary: Add a new command ``` target modules dump separate-debug-info [-j] [ [ [...]]] ``` or ``` image dump separate-debug-info [-j] [ [ [...]]] ``` (since `image` is an alias for `target modules`). This lists the separate debug info files and their current status (loaded or not loaded) for the specified modules. This diff implements this command for mach-O files with OSO and ELF files with dwo. Example dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a-main.dwo 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a-foo.dwo (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example dwo with missing dwo: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-main.dwo" for skeleton DIE 0x0014 0xbcc129959e76ff33 error: unable to locate .dwo debug file "/home/toyang/workspace/dwo-scratch/a-foo.dwo" for skeleton DIE 0x003c (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0014", "loaded": false }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x003c", "loaded": false } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example output with dwp: ``` (lldb) image dump separate-debug-info Symbol file: /home/toyang/workspace/dwo-scratch/a.out Type: "dwo" Dwo ID Dwo Path -- - 0x9a429da5abb6faae /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo) 0xbcc129959e76ff33 /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 5620165179865774, "dwo_name": "a-main.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" }, { "comp_dir": "/home/toyang/workspace/dwo-scratch", "dwo_id": 13601198072221073203, "dwo_name": "a-foo.dwo", "loaded": true, "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp" } ], "symfile": "/home/toyang/workspace/dwo-scratch/a.out", "type": "dwo" } ] ``` Example oso on my Mac (after manipulating the mod times with `touch`): ``` (lldb) image dump separate-debug-info Symbol file: /Users/toyang/workspace/scratch/a.out Type: "oso" Mod Time Oso Path -- - 0x64e64868 /Users/toyang/workspace/scratch/foo.a(foo.o) 0x64e64868 /Users/toyang/workspace/scratch/foo.a(main.o) (lldb) image dump separate-debug-info -j [ { "separate-debug-info-files": [ { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)", "so_file": "/Users/toyang/workspace/scratch/foo.cpp" }, { "loaded": true, "oso_mod_time": 1692813416, "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)", "so_file": "/Users/toyang/workspace/scratch/main.cpp" } ], "symfile": "/Users/toyang/workspace/scratch/a.out",
[Lldb-commits] [lldb] Add `target modules dump separate-debug-info` (PR #66035)
https://github.com/zhyty closed https://github.com/llvm/llvm-project/pull/66035 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] cd0d478 - quick fix for TestDumpDwo
Author: Tom Yang Date: 2023-10-12T16:28:56-07:00 New Revision: cd0d478e7cfa4ecf44c6fa97c796678cea5e4256 URL: https://github.com/llvm/llvm-project/commit/cd0d478e7cfa4ecf44c6fa97c796678cea5e4256 DIFF: https://github.com/llvm/llvm-project/commit/cd0d478e7cfa4ecf44c6fa97c796678cea5e4256.diff LOG: quick fix for TestDumpDwo PR#66035 introduced a test failure that causes windows build bots to fail. These unit tests shouldn't be running on Windows. Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Added: Modified: lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py Removed: diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py index c58ffdefb4587bd..3d9d8e8e77adbf9 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py @@ -25,6 +25,7 @@ def get_dwos_from_json(self): @skipIfRemote @skipIfDarwin +@skipIfWindows def test_dwos_loaded_json_output(self): self.build() exe = self.getBuildArtifact("a.out") @@ -47,6 +48,7 @@ def test_dwos_loaded_json_output(self): @skipIfRemote @skipIfDarwin +@skipIfWindows def test_dwos_not_loaded_json_output(self): self.build() exe = self.getBuildArtifact("a.out") @@ -71,6 +73,7 @@ def test_dwos_not_loaded_json_output(self): @skipIfRemote @skipIfDarwin +@skipIfWindows def test_dwos_loaded_table_output(self): self.build() exe = self.getBuildArtifact("a.out") @@ -97,6 +100,7 @@ def test_dwos_loaded_table_output(self): @skipIfRemote @skipIfDarwin +@skipIfWindows def test_dwos_not_loaded_table_output(self): self.build() exe = self.getBuildArtifact("a.out") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dump-debug-info] Fix `image dump separate-debug-info` in Release. (PR #68940)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/68940 Follow up to #66035. @kazutakahirata noticed ([comment](https://github.com/llvm/llvm-project/commit/64d78d8b3cd09dff32c97fbefa56bcfc8b676406#r129848406)) that I was reading structured data in assert statements which were being removed when asserts are disabled. I've removed the assert statements, which only existed as a sanity check anyway. >From adf6ab21c967e48a1a6aa8699ae54d458ced3886 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Thu, 12 Oct 2023 16:52:26 -0700 Subject: [PATCH] [lldb][dump-debug-info] Fix `image dump separate-debug-info` in Release. @kazutakahirata noticed that I was reading structured data in assert statements which were being removed when asserts are disabled. I've removed the assert statements, which only existed as a sanity check anyway. --- lldb/source/Commands/CommandObjectTarget.cpp | 22 +--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 0c378b069086d03..e1f54b810486611 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2679,15 +2679,23 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles return false; } + // We expect to see "type", "symfile", and + // "separate-debug-info-files" as fields in the dictionary, even + // if they're empty. llvm::StringRef type; + separate_debug_info_list->GetValueForKeyAsString("type", type); llvm::StringRef symfile; - StructuredData::Array *files; - assert(separate_debug_info_list->GetValueForKeyAsString("type", - type)); - assert(separate_debug_info_list->GetValueForKeyAsString("symfile", - symfile)); - assert(separate_debug_info_list->GetValueForKeyAsArray( - "separate-debug-info-files", files)); + separate_debug_info_list->GetValueForKeyAsString("symfile", + symfile); + StructuredData::Array *files = nullptr; + separate_debug_info_list->GetValueForKeyAsArray( + "separate-debug-info-files", files); + if (files == nullptr) { +result.AppendWarningWithFormat( +"Expected \"separate-debug-info-files\" field in separate " +"debug info dictionary"); +return false; + } strm << "Symbol file: " << symfile; strm.EOL(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dump-debug-info] Fix `image dump separate-debug-info` in Release. (PR #68940)
https://github.com/zhyty closed https://github.com/llvm/llvm-project/pull/68940 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][dump-debug-info] Fix `image dump separate-debug-info` in Release. (PR #68940)
zhyty wrote: #68979 was committed before this, basically does the same thing. https://github.com/llvm/llvm-project/pull/68940 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/69517 Add a way to set a *static* callback to locate DWO files in `SBModule`. ``` SBError SBLocateDwoCallback(void *baton, const SBFileSpec &objfile_spec, const char *dwo_name, const char *comp_dir, const int64_t dwo_id, SBFileSpec &located_dwo_file_spec); ``` where `located_dwo_file_spec` is the output of the function. This is more powerful than using a list of search directories via `target.debug-file-search-paths`; for example, we could write a callback that traverses up the object file path and searches for some expected folder name. The callback supplements the existing search paths for dwo files. If there is no callback or the callback fails, we fall back to other ways of finding dwos. On `Python`, the callback arguments are just `objfile_spec`, `dwo_name`, `comp_dir`, `dwo_id`, and `located_dwo_file_spec`, no `baton`. See `TestLocateDwoCallback.py` for examples. To implement this, I pretty religiously followed the pattern set by Kazuki in his OSS RFC https://discourse.llvm.org/t/rfc-python-callback-for-target-get-module/71580. # Testing Tested manually, and with ``` ninja check-lldb-shell-symbolfile-dwarf ``` and ``` lldb-dotest -p TestLocateDwoCallback ``` >From 2e12836cdde118f52196ac30b8e8ef24684c2b2f Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Wed, 18 Oct 2023 10:18:32 -0700 Subject: [PATCH] Add `SBModule.SetLocateDwoCallback` to allow programmatically finding dwos Add a way to set a *static* callback to locate DWO files in `SBModule`. ``` SBError SBLocateDwoCallback(void *baton, const SBFileSpec &objfile_spec, const char *dwo_name, const char *comp_dir, const int64_t dwo_id, SBFileSpec &located_dwo_file_spec); ``` where `located_dwo_file_spec` is the output of the function. This is more powerful than using a list of search directories via `target.debug-file-search-paths`; for example, we could write a callback that traverses up the object file path and searches for some expected folder name. On `Python`, the callback arguments are just `objfile_spec`, `dwo_name`, `comp_dir`, `dwo_id`, and `located_dwo_file_spec`, no `baton`. See `TestLocateDwoCallback.py`. To implement this, I pretty religiously followed the pattern set by Kazuki in his OSS RFC https://discourse.llvm.org/t/rfc-python-callback-for-target-get-module/71580. The callback supplements the existing search paths for dwo files. If there is no callback or the callback fails, we fall back to other ways of finding dwos. --- lldb/bindings/python/python-typemaps.swig | 52 lldb/bindings/python/python-wrapper.swig | 54 lldb/include/lldb/API/SBDefines.h | 7 ++ lldb/include/lldb/API/SBError.h | 1 + lldb/include/lldb/API/SBModule.h | 14 +++ lldb/include/lldb/Core/ModuleList.h | 1 + lldb/include/lldb/Symbol/SymbolFile.h | 11 ++ lldb/source/API/SBModule.cpp | 27 .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 35 -- lldb/source/Symbol/SymbolFile.cpp | 9 ++ .../sbmodule/locate_dwo_callback/Makefile | 4 + .../TestLocateDwoCallback.py | 119 ++ .../sbmodule/locate_dwo_callback/foo.cpp | 3 + .../sbmodule/locate_dwo_callback/foo.h| 6 + .../sbmodule/locate_dwo_callback/main.cpp | 3 + 15 files changed, 337 insertions(+), 9 deletions(-) create mode 100644 lldb/test/API/python_api/sbmodule/locate_dwo_callback/Makefile create mode 100644 lldb/test/API/python_api/sbmodule/locate_dwo_callback/TestLocateDwoCallback.py create mode 100644 lldb/test/API/python_api/sbmodule/locate_dwo_callback/foo.cpp create mode 100644 lldb/test/API/python_api/sbmodule/locate_dwo_callback/foo.h create mode 100644 lldb/test/API/python_api/sbmodule/locate_dwo_callback/main.cpp diff --git a/lldb/bindings/python/python-typemaps.swig b/lldb/bindings/python/python-typemaps.swig index 7660e0282c8fcf4..9749452c6e52359 100644 --- a/lldb/bindings/python/python-typemaps.swig +++ b/lldb/bindings/python/python-typemaps.swig @@ -696,3 +696,55 @@ template <> bool SetNumberFromPyObject(double &number, PyObject *obj) { $1 = $input == Py_None; $1 = $1 || PyCallable_Check(reinterpret_cast($input)); } + +// For lldb::SBModuleLocateDwoCallback +// The `baton` is the actual Python function passed, and we invoke the `baton` via a SWIG function. +%typemap(in) (lldb::SBModuleLocateDwoCallback callback, + void *baton) { + if (!($input == Py_None || +PyCallable_Check(reinterpret_cast($input { +PyErr_SetString(PyExc_TypeError, "Need a callable object or None!"); +SWIG_fail; + } + + if ($input == Py_None) { +$1 = nullptr; +$2 = nullptr; + } else { +PythonCallable callable = Retain($input); +if (!callable.IsValid()) { + PyErr_SetString(PyExc_TypeError, "Need a valid callable object"); + SWIG_fail; +} + +llvm::Exp
[Lldb-commits] [lldb] Improve dwo path in missing dwo error when relative (PR #69783)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/69783 When the debug info refers to a dwo with relative `DW_AT_comp_dir` and `DW_AT_dwo_name`, we only print the `DW_AT_comp_dir` in our error message if we can't find it. This often isn't very helpful, especially when the `DW_AT_comp_dir` is ".": ``` (lldb) fr v error: unable to locate .dwo debug file "." for skeleton DIE 0x003c ``` I'm updating the error message to include both `DW_AT_comp_dir` (if it exists) and `DW_AT_dwo_name` when the `DW_AT_dwo_name` is relative. The behavior when `DW_AT_dwo_name` is absolute should be the same. >From 95de2c290debe4e52f572d12193906b66cde78e3 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Thu, 19 Oct 2023 15:36:22 -0700 Subject: [PATCH] improve dwo path in missing dwo error Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: --- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 8 - .../DWARF/Inputs/dwo-missing-error.c | 1 + .../DWARF/relative-dwo-missing-error.test | 34 +++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c create mode 100644 lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 737c65d0712e0db..3f7248c3973e459 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1855,10 +1855,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit( } if (!found) { +FileSpec error_dwo_path(dwo_name); +FileSystem::Instance().Resolve(error_dwo_path); +if (error_dwo_path.IsRelative() && comp_dir != nullptr) { + error_dwo_path.PrependPathComponent(comp_dir); + FileSystem::Instance().Resolve(error_dwo_path); +} unit.SetDwoError(Status::createWithFormat( "unable to locate .dwo debug file \"{0}\" for skeleton DIE " "{1:x16}", -dwo_file.GetPath().c_str(), cu_die.GetOffset())); +error_dwo_path.GetPath().c_str(), cu_die.GetOffset())); if (m_dwo_warning_issued.test_and_set(std::memory_order_relaxed) == false) { GetObjectFile()->GetModule()->ReportWarning( diff --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c new file mode 100644 index 000..78f2de106c92b0d --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test b/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test new file mode 100644 index 000..4f7e70e36f719df --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/relative-dwo-missing-error.test @@ -0,0 +1,34 @@ +# Check that LLDB prints an error message containing the DWO_AT_comp_dir and +# DW_AT_dwo_name when it can't find a DWO and the DW_AT_comp_dir and +# DW_AT_dwo_name are relative. + +# -gsplit-dwarf is supported only on Linux. +# REQUIRES: system-linux + +# Test the error message with a relative DW_AT_comp_dir and DW_AT_dwo_name. +# Creating and compiling to %t.compdir makes it easy to remove the dwo files. +# DW_AT_comp_dir should be "./a/b/", and DW_AT_dwo_name should be +# "a.out-dwo-missing-error.dwo". +# since %T is deprecated. +# RUN: rm -rf %t.compdir/ +# RUN: mkdir -p %t.compdir/a/b/ +# RUN: cd %t.compdir/a/b/ +# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \ +# RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out +# RUN: rm *.dwo +# RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s +# RUN: cd - + +# Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name. +# RUN: rm -rf %t.compdir/ +# RUN: mkdir -p %t.compdir/a/b/ +# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \ +# RUN: -gsplit-dwarf -o %t.compdir/a/b/a.out +# RUN: rm %t.compdir/a/b/*.dwo +# RUN: %lldb %t.compdir/a/b/a.out -s %s -o exit 2>&1 | FileCheck %s + +b main +run + +fr v +# CHECK: error: unable to locate .dwo debug file "{{.*}}a/b/a.out-dwo-missing-error.dwo" for skeleton DIE {{.*}} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] improve dwo path in missing dwo error when relative (PR #69783)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/69783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)
https://github.com/zhyty converted_to_draft https://github.com/llvm/llvm-project/pull/69517 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/69517 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add `SBModule.SetLocateDwoCallback` (PR #69517)
zhyty wrote: > Because SymbolFile is holding onto the function pointer as a static member, > this is a global setting that you can't apply to only just one `SBDebugger` > object. It's an all-or-nothing thing. Maybe that's what you want, but LLDB > already has architectural issues with certain functionality being difficult > to detangle from global state (e.g. Logging). Maybe we could make it a > property of the Debugger instead? That sounds good to me, though I didn't think there was a path to the debugger from `SymbolFileDWARF`? https://github.com/llvm/llvm-project/pull/69517 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] improve dwo path in missing dwo error when relative (PR #69783)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/69783 >From bee3e22c2b2c57d2a6710741f8a78dff0d8d71e1 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Thu, 19 Oct 2023 15:36:22 -0700 Subject: [PATCH] improve dwo path in missing dwo error Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: --- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 8 - .../DWARF/Inputs/dwo-missing-error.c | 1 + .../SymbolFile/DWARF/dwo-missing-error.test | 34 +++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c create mode 100644 lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 737c65d0712e0db..3f7248c3973e459 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1855,10 +1855,16 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit( } if (!found) { +FileSpec error_dwo_path(dwo_name); +FileSystem::Instance().Resolve(error_dwo_path); +if (error_dwo_path.IsRelative() && comp_dir != nullptr) { + error_dwo_path.PrependPathComponent(comp_dir); + FileSystem::Instance().Resolve(error_dwo_path); +} unit.SetDwoError(Status::createWithFormat( "unable to locate .dwo debug file \"{0}\" for skeleton DIE " "{1:x16}", -dwo_file.GetPath().c_str(), cu_die.GetOffset())); +error_dwo_path.GetPath().c_str(), cu_die.GetOffset())); if (m_dwo_warning_issued.test_and_set(std::memory_order_relaxed) == false) { GetObjectFile()->GetModule()->ReportWarning( diff --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c new file mode 100644 index 000..78f2de106c92b0d --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/dwo-missing-error.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test b/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test new file mode 100644 index 000..4f7e70e36f719df --- /dev/null +++ b/lldb/test/Shell/SymbolFile/DWARF/dwo-missing-error.test @@ -0,0 +1,34 @@ +# Check that LLDB prints an error message containing the DWO_AT_comp_dir and +# DW_AT_dwo_name when it can't find a DWO and the DW_AT_comp_dir and +# DW_AT_dwo_name are relative. + +# -gsplit-dwarf is supported only on Linux. +# REQUIRES: system-linux + +# Test the error message with a relative DW_AT_comp_dir and DW_AT_dwo_name. +# Creating and compiling to %t.compdir makes it easy to remove the dwo files. +# DW_AT_comp_dir should be "./a/b/", and DW_AT_dwo_name should be +# "a.out-dwo-missing-error.dwo". +# since %T is deprecated. +# RUN: rm -rf %t.compdir/ +# RUN: mkdir -p %t.compdir/a/b/ +# RUN: cd %t.compdir/a/b/ +# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \ +# RUN: -gsplit-dwarf -fdebug-prefix-map=%t.compdir=. -o a.out +# RUN: rm *.dwo +# RUN: %lldb a.out -s %s -o exit 2>&1 | FileCheck %s +# RUN: cd - + +# Test the error message with an absolute DW_AT_comp_dir and DW_AT_dwo_name. +# RUN: rm -rf %t.compdir/ +# RUN: mkdir -p %t.compdir/a/b/ +# RUN: %clang_host %S/Inputs/dwo-missing-error.c -glldb -gdwarf-5 \ +# RUN: -gsplit-dwarf -o %t.compdir/a/b/a.out +# RUN: rm %t.compdir/a/b/*.dwo +# RUN: %lldb %t.compdir/a/b/a.out -s %s -o exit 2>&1 | FileCheck %s + +b main +run + +fr v +# CHECK: error: unable to locate .dwo debug file "{{.*}}a/b/a.out-dwo-missing-error.dwo" for skeleton DIE {{.*}} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] improve dwo path in missing dwo error when relative (PR #69783)
https://github.com/zhyty closed https://github.com/llvm/llvm-project/pull/69783 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] Add --errors-only argument separate-debug-info list (PR #71000)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/71000 Often, we only care about the split-dwarf files that have failed to load. This can be useful when diagnosing binaries with many separate debug info files where only some have errors. ``` (lldb) help image dump separate-debug-info List the separate debug info symbol files for one or more target modules. Syntax: target modules dump separate-debug-info [ [ [...]]] Command Options Usage: target modules dump separate-debug-info [-ej] [ [ [...]]] -e ( --errors-only ) Filter to show only debug info files with errors. -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. 'image' is an abbreviation for 'target modules' ``` I updated the following tests ``` # on Linux bin/lldb-dotest -p TestDumpDwo # on Mac bin/lldb-dotest -p TestDumpOso ``` This change applies to both the table and JSON outputs. >From c6900333c54d1c3f5dd3e6a88f0627b65ff0efca Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Wed, 1 Nov 2023 00:53:19 -0700 Subject: [PATCH] [lldb] Add --errors-only argument separate-debug-info list --- lldb/include/lldb/Symbol/SymbolFile.h | 6 +- lldb/source/Commands/CommandObjectTarget.cpp | 20 +-- lldb/source/Commands/Options.td | 4 +++- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 6 -- .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 ++- .../DWARF/SymbolFileDWARFDebugMap.cpp | 5 +++-- .../DWARF/SymbolFileDWARFDebugMap.h | 3 ++- .../dwo/TestDumpDwo.py| 20 --- .../oso/TestDumpOso.py| 18 - 9 files changed, 59 insertions(+), 26 deletions(-) diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index b40d0f03b6e0130..9fc90ad49361be8 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -445,7 +445,11 @@ class SymbolFile : public PluginInterface { /// contains the keys "type", "symfile", and "separate-debug-info-files". /// "type" can be used to assume the structure of each object in /// "separate-debug-info-files". - virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d) { + /// \param errors_only + /// If true, then only return separate debug info files that encountered + /// errors during loading. + virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) { return false; }; diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index c84a6550d6c75cc..ca8484cc79d4054 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1452,11 +1452,11 @@ static bool DumpModuleSymbolFile(Stream &strm, Module *module) { } static bool GetSeparateDebugInfoList(StructuredData::Array &list, - Module *module) { + Module *module, bool errors_only) { if (module) { if (SymbolFile *symbol_file = module->GetSymbolFile(/*can_create=*/true)) { StructuredData::Dictionary d; - if (symbol_file->GetSeparateDebugInfo(d)) { + if (symbol_file->GetSeparateDebugInfo(d, errors_only)) { list.AddItem( std::make_shared(std::move(d))); return true; @@ -2561,7 +2561,10 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles m_json.SetCurrentValue(true); m_json.SetOptionWasSet(); break; - + case 'e': +m_errors_only.SetCurrentValue(true); +m_errors_only.SetOptionWasSet(); +break; default: llvm_unreachable("Unimplemented option"); } @@ -2570,6 +2573,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles void OptionParsingStarting(ExecutionContext *execution_context) override { m_json.Clear(); + m_errors_only.Clear(); } llvm::ArrayRef GetDefinitions() override { @@ -2577,6 +2581,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles } OptionValueBoolean m_json = false; +OptionValueBoolean m_errors_only = false; }; protected: @@ -2607,7 +2612,8 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles break; if (GetSeparateDebugInfoList(separate_debug_info_lists_by_module, - module_sp.get())) + module_sp.get(), + bool(m_options.m_errors_only))) num_dumped++; } } else { @@ -2628,7 +2634,7 @@
[Lldb-commits] [lldb] [lldb][split-dwarf] Add --errors-only argument separate-debug-info list (PR #71000)
@@ -445,7 +445,11 @@ class SymbolFile : public PluginInterface { /// contains the keys "type", "symfile", and "separate-debug-info-files". /// "type" can be used to assume the structure of each object in /// "separate-debug-info-files". - virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d) { + /// \param errors_only + /// If true, then only return separate debug info files that encountered + /// errors during loading. + virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) { zhyty wrote: > Not sure I'm a fan of a parameter that changes behavior. Why not introduce a > new function entirely? Hmm... I was thinking it would save some lines of boilerplate and avoid adding a new function to `SymbolFile`'s API. Also, it seems to me that there are other functions in `SymbolFile` that have a similar pattern? ``` virtual void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list); ... virtual CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces = false) { return CompilerDeclContext(); } ... ``` https://github.com/llvm/llvm-project/pull/71000 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] Add --errors-only argument separate-debug-info list (PR #71000)
@@ -445,7 +445,11 @@ class SymbolFile : public PluginInterface { /// contains the keys "type", "symfile", and "separate-debug-info-files". /// "type" can be used to assume the structure of each object in /// "separate-debug-info-files". - virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d) { + /// \param errors_only + /// If true, then only return separate debug info files that encountered + /// errors during loading. + virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) { zhyty wrote: Ah yes it only filters! That explains the confusion. I'll update the doc so that's clearer. https://github.com/llvm/llvm-project/pull/71000 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] Add --errors-only argument separate-debug-info list (PR #71000)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71000 >From c6900333c54d1c3f5dd3e6a88f0627b65ff0efca Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Wed, 1 Nov 2023 00:53:19 -0700 Subject: [PATCH 1/3] [lldb] Add --errors-only argument separate-debug-info list --- lldb/include/lldb/Symbol/SymbolFile.h | 6 +- lldb/source/Commands/CommandObjectTarget.cpp | 20 +-- lldb/source/Commands/Options.td | 4 +++- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 6 -- .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 ++- .../DWARF/SymbolFileDWARFDebugMap.cpp | 5 +++-- .../DWARF/SymbolFileDWARFDebugMap.h | 3 ++- .../dwo/TestDumpDwo.py| 20 --- .../oso/TestDumpOso.py| 18 - 9 files changed, 59 insertions(+), 26 deletions(-) diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index b40d0f03b6e0130..9fc90ad49361be8 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -445,7 +445,11 @@ class SymbolFile : public PluginInterface { /// contains the keys "type", "symfile", and "separate-debug-info-files". /// "type" can be used to assume the structure of each object in /// "separate-debug-info-files". - virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d) { + /// \param errors_only + /// If true, then only return separate debug info files that encountered + /// errors during loading. + virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) { return false; }; diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index c84a6550d6c75cc..ca8484cc79d4054 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1452,11 +1452,11 @@ static bool DumpModuleSymbolFile(Stream &strm, Module *module) { } static bool GetSeparateDebugInfoList(StructuredData::Array &list, - Module *module) { + Module *module, bool errors_only) { if (module) { if (SymbolFile *symbol_file = module->GetSymbolFile(/*can_create=*/true)) { StructuredData::Dictionary d; - if (symbol_file->GetSeparateDebugInfo(d)) { + if (symbol_file->GetSeparateDebugInfo(d, errors_only)) { list.AddItem( std::make_shared(std::move(d))); return true; @@ -2561,7 +2561,10 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles m_json.SetCurrentValue(true); m_json.SetOptionWasSet(); break; - + case 'e': +m_errors_only.SetCurrentValue(true); +m_errors_only.SetOptionWasSet(); +break; default: llvm_unreachable("Unimplemented option"); } @@ -2570,6 +2573,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles void OptionParsingStarting(ExecutionContext *execution_context) override { m_json.Clear(); + m_errors_only.Clear(); } llvm::ArrayRef GetDefinitions() override { @@ -2577,6 +2581,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles } OptionValueBoolean m_json = false; +OptionValueBoolean m_errors_only = false; }; protected: @@ -2607,7 +2612,8 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles break; if (GetSeparateDebugInfoList(separate_debug_info_lists_by_module, - module_sp.get())) + module_sp.get(), + bool(m_options.m_errors_only))) num_dumped++; } } else { @@ -2628,7 +2634,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles break; Module *module = module_list.GetModulePointerAtIndex(i); if (GetSeparateDebugInfoList(separate_debug_info_lists_by_module, - module)) + module, bool(m_options.m_errors_only))) num_dumped++; } } else @@ -2639,11 +2645,13 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles if (num_dumped > 0) { Stream &strm = result.GetOutputStream(); + // Display the debug info files in some format. if (m_options.m_json) { +// JSON format separate_debug_info_lists_by_module.Dump(strm, /*pretty_print=*/true); } else { -// List the debug info files in human readable form. +// Human-readable table format separate_debug_info_lists_by_module.ForEach( [&result, &strm](StructuredData::Object *obj) { if (!obj) { diff --g
[Lldb-commits] [lldb] [lldb][split-dwarf] Add --errors-only argument separate-debug-info list (PR #71000)
https://github.com/zhyty closed https://github.com/llvm/llvm-project/pull/71000 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/71230 Easy change to get `image dump separate-debug-info` working when using `symbols.load-on-demand`. Also added a line of space in the default table output. Added tests ``` bin/lldb-dotest -p TestDumpDwo ``` It's easy to verify this manually by running ``` lldb --one-line-before-file "settings set symbols.load-on-demand true" (lldb) image dump separate-debug-info ... ``` >From c009fadeaea30de58df22564cca685938a0746f9 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Fri, 3 Nov 2023 13:45:37 -0700 Subject: [PATCH] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand --- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 5 lldb/source/Commands/CommandObjectTarget.cpp | 1 + .../dwo/TestDumpDwo.py| 26 +++ 3 files changed, 32 insertions(+) diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index adf1017ce73c11b..9cbcef2a111d320 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors(); } + bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) override { +return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only); + } + lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index ca8484cc79d4054..323b821f7ca6455 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles "Found unsupported debug info type '%s'.\n", type.str().c_str()); } + strm.EOL(); return true; }); } diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py index 163f5a112367693..881ee7b1dc71adf 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py @@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo", ], ) + +@skipIfRemote +@skipIfDarwin +@skipIfWindows +def test_dwos_loaded_symbols_on_demand(self): +self.build() +exe = self.getBuildArtifact("a.out") +main_dwo = self.getBuildArtifact("main.dwo") +foo_dwo = self.getBuildArtifact("foo.dwo") + +# Make sure dwo files exist +self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists') +self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists') + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Check the output +output = self.get_dwos_from_json_output() +self.assertTrue(output[exe]["main.dwo"]["loaded"]) +self.assertTrue(output[exe]["foo.dwo"]["loaded"]) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
@@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles "Found unsupported debug info type '%s'.\n", type.str().c_str()); } + strm.EOL(); zhyty wrote: The default `image dump separate-debug-info` table output is a bit cramped without the extra space. I mentioned this in the PR summary > Also added a line of space in the default table output. But I can move this change to a separate PR, sorry! https://github.com/llvm/llvm-project/pull/71230 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230 >From c009fadeaea30de58df22564cca685938a0746f9 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Fri, 3 Nov 2023 13:45:37 -0700 Subject: [PATCH 1/2] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand --- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 5 lldb/source/Commands/CommandObjectTarget.cpp | 1 + .../dwo/TestDumpDwo.py| 26 +++ 3 files changed, 32 insertions(+) diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index adf1017ce73c11b..9cbcef2a111d320 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors(); } + bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) override { +return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only); + } + lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index ca8484cc79d4054..323b821f7ca6455 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles "Found unsupported debug info type '%s'.\n", type.str().c_str()); } + strm.EOL(); return true; }); } diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py index 163f5a112367693..881ee7b1dc71adf 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py @@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo", ], ) + +@skipIfRemote +@skipIfDarwin +@skipIfWindows +def test_dwos_loaded_symbols_on_demand(self): +self.build() +exe = self.getBuildArtifact("a.out") +main_dwo = self.getBuildArtifact("main.dwo") +foo_dwo = self.getBuildArtifact("foo.dwo") + +# Make sure dwo files exist +self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists') +self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists') + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Check the output +output = self.get_dwos_from_json_output() +self.assertTrue(output[exe]["main.dwo"]["loaded"]) +self.assertTrue(output[exe]["foo.dwo"]["loaded"]) >From 51ffd33fa00098552f2e83d4e9bbb7ba36793394 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Sun, 5 Nov 2023 10:06:12 -0800 Subject: [PATCH 2/2] add symbol on demand Darwin OSO tests --- .../oso/TestDumpOso.py| 30 +++ 1 file changed, 30 insertions(+) diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py index b69938454659bda..06dc8234591844b 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py @@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o", ], ) + +@skipIfRemote +@skipUnlessDarwin +def test_osos_loaded_symbols_on_demand(self): +self.build(debug_info="dwarf") +exe = self.getBuildArtifact("a.out") +main_o = self.getBuildArtifact("main.o") +foo_o = self.getBuildArtifact("foo.o") + +# Make sure o files exist +self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file exists') +self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file exists') + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/71230 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230 >From c009fadeaea30de58df22564cca685938a0746f9 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Fri, 3 Nov 2023 13:45:37 -0700 Subject: [PATCH 1/3] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand --- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 5 lldb/source/Commands/CommandObjectTarget.cpp | 1 + .../dwo/TestDumpDwo.py| 26 +++ 3 files changed, 32 insertions(+) diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index adf1017ce73c11b..9cbcef2a111d320 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors(); } + bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) override { +return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only); + } + lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index ca8484cc79d4054..323b821f7ca6455 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles "Found unsupported debug info type '%s'.\n", type.str().c_str()); } + strm.EOL(); return true; }); } diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py index 163f5a112367693..881ee7b1dc71adf 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py @@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo", ], ) + +@skipIfRemote +@skipIfDarwin +@skipIfWindows +def test_dwos_loaded_symbols_on_demand(self): +self.build() +exe = self.getBuildArtifact("a.out") +main_dwo = self.getBuildArtifact("main.dwo") +foo_dwo = self.getBuildArtifact("foo.dwo") + +# Make sure dwo files exist +self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists') +self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists') + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Check the output +output = self.get_dwos_from_json_output() +self.assertTrue(output[exe]["main.dwo"]["loaded"]) +self.assertTrue(output[exe]["foo.dwo"]["loaded"]) >From 51ffd33fa00098552f2e83d4e9bbb7ba36793394 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Sun, 5 Nov 2023 10:06:12 -0800 Subject: [PATCH 2/3] add symbol on demand Darwin OSO tests --- .../oso/TestDumpOso.py| 30 +++ 1 file changed, 30 insertions(+) diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py index b69938454659bda..06dc8234591844b 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py @@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o", ], ) + +@skipIfRemote +@skipUnlessDarwin +def test_osos_loaded_symbols_on_demand(self): +self.build(debug_info="dwarf") +exe = self.getBuildArtifact("a.out") +main_o = self.getBuildArtifact("main.o") +foo_o = self.getBuildArtifact("foo.o") + +# Make sure o files exist +self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file exists') +self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file exists') + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
@@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo", ], ) + +@skipIfRemote +@skipIfDarwin +@skipIfWindows zhyty wrote: I added a symbol-on-demand test to `TestDumpOso` for Darwin. I don't have a Windows machine, so I'm not sure how I would go about testing it there https://github.com/llvm/llvm-project/pull/71230 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230 >From 68c8884696efab8991e71dfd892463b9873b5e46 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Fri, 3 Nov 2023 13:45:37 -0700 Subject: [PATCH 1/3] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand --- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 5 lldb/source/Commands/CommandObjectTarget.cpp | 1 + .../dwo/TestDumpDwo.py| 26 +++ 3 files changed, 32 insertions(+) diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index adf1017ce73c11b0..9cbcef2a111d3200 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors(); } + bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) override { +return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only); + } + lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 8f052d0a7b837e24..31ad485ac2368780 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles "Found unsupported debug info type '%s'.\n", type.str().c_str()); } + strm.EOL(); return true; }); } diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py index 163f5a1123676936..881ee7b1dc71adf3 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py @@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo", ], ) + +@skipIfRemote +@skipIfDarwin +@skipIfWindows +def test_dwos_loaded_symbols_on_demand(self): +self.build() +exe = self.getBuildArtifact("a.out") +main_dwo = self.getBuildArtifact("main.dwo") +foo_dwo = self.getBuildArtifact("foo.dwo") + +# Make sure dwo files exist +self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists') +self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists') + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Check the output +output = self.get_dwos_from_json_output() +self.assertTrue(output[exe]["main.dwo"]["loaded"]) +self.assertTrue(output[exe]["foo.dwo"]["loaded"]) >From f2e2b100144dad2bfeb2d71efd8559a0a003bd27 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Sun, 5 Nov 2023 10:06:12 -0800 Subject: [PATCH 2/3] add symbol on demand Darwin OSO tests --- .../oso/TestDumpOso.py| 30 +++ 1 file changed, 30 insertions(+) diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py index b69938454659bda5..06dc8234591844b1 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py @@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o", ], ) + +@skipIfRemote +@skipUnlessDarwin +def test_osos_loaded_symbols_on_demand(self): +self.build(debug_info="dwarf") +exe = self.getBuildArtifact("a.out") +main_o = self.getBuildArtifact("main.o") +foo_o = self.getBuildArtifact("foo.o") + +# Make sure o files exist +self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file exists') +self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file exists') + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.as
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230 >From 68c8884696efab8991e71dfd892463b9873b5e46 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Fri, 3 Nov 2023 13:45:37 -0700 Subject: [PATCH 1/4] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand --- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 5 lldb/source/Commands/CommandObjectTarget.cpp | 1 + .../dwo/TestDumpDwo.py| 26 +++ 3 files changed, 32 insertions(+) diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index adf1017ce73c11b0..9cbcef2a111d3200 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors(); } + bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) override { +return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only); + } + lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 8f052d0a7b837e24..31ad485ac2368780 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles "Found unsupported debug info type '%s'.\n", type.str().c_str()); } + strm.EOL(); return true; }); } diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py index 163f5a1123676936..881ee7b1dc71adf3 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py @@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo", ], ) + +@skipIfRemote +@skipIfDarwin +@skipIfWindows +def test_dwos_loaded_symbols_on_demand(self): +self.build() +exe = self.getBuildArtifact("a.out") +main_dwo = self.getBuildArtifact("main.dwo") +foo_dwo = self.getBuildArtifact("foo.dwo") + +# Make sure dwo files exist +self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists') +self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists') + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Check the output +output = self.get_dwos_from_json_output() +self.assertTrue(output[exe]["main.dwo"]["loaded"]) +self.assertTrue(output[exe]["foo.dwo"]["loaded"]) >From f2e2b100144dad2bfeb2d71efd8559a0a003bd27 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Sun, 5 Nov 2023 10:06:12 -0800 Subject: [PATCH 2/4] add symbol on demand Darwin OSO tests --- .../oso/TestDumpOso.py| 30 +++ 1 file changed, 30 insertions(+) diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py index b69938454659bda5..06dc8234591844b1 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py @@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o", ], ) + +@skipIfRemote +@skipUnlessDarwin +def test_osos_loaded_symbols_on_demand(self): +self.build(debug_info="dwarf") +exe = self.getBuildArtifact("a.out") +main_o = self.getBuildArtifact("main.o") +foo_o = self.getBuildArtifact("foo.o") + +# Make sure o files exist +self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file exists') +self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file exists') + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.as
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/71230 >From 68c8884696efab8991e71dfd892463b9873b5e46 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Fri, 3 Nov 2023 13:45:37 -0700 Subject: [PATCH 1/5] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand --- lldb/include/lldb/Symbol/SymbolFileOnDemand.h | 5 lldb/source/Commands/CommandObjectTarget.cpp | 1 + .../dwo/TestDumpDwo.py| 26 +++ 3 files changed, 32 insertions(+) diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index adf1017ce73c11b..9cbcef2a111d320 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -228,6 +228,11 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile { return m_sym_file_impl->SetDebugInfoHadFrameVariableErrors(); } + bool GetSeparateDebugInfo(StructuredData::Dictionary &d, +bool errors_only) override { +return m_sym_file_impl->GetSeparateDebugInfo(d, errors_only); + } + lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 8f052d0a7b837e2..31ad485ac236878 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2691,6 +2691,7 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles "Found unsupported debug info type '%s'.\n", type.str().c_str()); } + strm.EOL(); return true; }); } diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py index 163f5a112367693..881ee7b1dc71adf 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py @@ -130,3 +130,29 @@ def test_dwos_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.dwo", ], ) + +@skipIfRemote +@skipIfDarwin +@skipIfWindows +def test_dwos_loaded_symbols_on_demand(self): +self.build() +exe = self.getBuildArtifact("a.out") +main_dwo = self.getBuildArtifact("main.dwo") +foo_dwo = self.getBuildArtifact("foo.dwo") + +# Make sure dwo files exist +self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists') +self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists') + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Check the output +output = self.get_dwos_from_json_output() +self.assertTrue(output[exe]["main.dwo"]["loaded"]) +self.assertTrue(output[exe]["foo.dwo"]["loaded"]) >From f2e2b100144dad2bfeb2d71efd8559a0a003bd27 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Sun, 5 Nov 2023 10:06:12 -0800 Subject: [PATCH 2/5] add symbol on demand Darwin OSO tests --- .../oso/TestDumpOso.py| 30 +++ 1 file changed, 30 insertions(+) diff --git a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py index b69938454659bda..06dc8234591844b 100644 --- a/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py +++ b/lldb/test/API/commands/target/dump-separate-debug-info/oso/TestDumpOso.py @@ -126,3 +126,33 @@ def test_shows_oso_not_loaded_table_output(self): "0x[a-zA-Z0-9]{16}\s+E\s+.*foo\.o", ], ) + +@skipIfRemote +@skipUnlessDarwin +def test_osos_loaded_symbols_on_demand(self): +self.build(debug_info="dwarf") +exe = self.getBuildArtifact("a.out") +main_o = self.getBuildArtifact("main.o") +foo_o = self.getBuildArtifact("foo.o") + +# Make sure o files exist +self.assertTrue(os.path.exists(main_o), f'Make sure "{main_o}" file exists') +self.assertTrue(os.path.exists(foo_o), f'Make sure "{foo_o}" file exists') + +target = self.dbg.CreateTarget(exe) +self.assertTrue(target, lldbtest.VALID_TARGET) + +self.runCmd("target modules dump separate-debug-info --json") + +# Load symbols on-demand +self.runCmd("settings set symbols.load-on-demand true") + +target = self.dbg.CreateTarget(exe) +self.assertTrue
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/71230 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (PR #71230)
zhyty wrote: @bulbazord @clayborg I updated the DWO tests so that we try to compile for `x86_64-pc-linux-elf` on all platforms, and if we fail the tests are skipped. I've verified that the tests pass on my Linux machine and that they're skipped on my Mac, though it would be nice if I could make sure the build bots will pass. https://github.com/llvm/llvm-project/pull/71230 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/109020 >From e94f734b09c79845bd29903af42a6d39d7149bf4 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Tue, 17 Sep 2024 09:56:09 -0700 Subject: [PATCH 1/2] Add warning message to `session save` when transcript isn't saved. Somewhat recently, we made the change to hide the behavior to save LLDB session history to the transcript buffer behind the flag `interpreter.save-transcript`. --- lldb/source/Commands/CommandObjectSession.cpp | 3 +- .../source/Interpreter/CommandInterpreter.cpp | 2 ++ .../Interpreter/InterpreterProperties.td | 2 +- .../commands/session/save/TestSessionSave.py | 29 +++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lldb/source/Commands/CommandObjectSession.cpp b/lldb/source/Commands/CommandObjectSession.cpp index c381ba4f74f120..3f714cec414695 100644 --- a/lldb/source/Commands/CommandObjectSession.cpp +++ b/lldb/source/Commands/CommandObjectSession.cpp @@ -19,7 +19,8 @@ class CommandObjectSessionSave : public CommandObjectParsed { : CommandObjectParsed(interpreter, "session save", "Save the current session transcripts to a file.\n" "If no file if specified, transcripts will be " -"saved to a temporary file.", +"saved to a temporary file.\n" +"Note: transcripts will only be saved if interpreter.save-transcript is true.\n", "session save [file]") { AddSimpleArgumentList(eArgTypePath, eArgRepeatOptional); } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index d17aa6fec1f00e..cd2a26ab4b442d 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -3308,6 +3308,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) { const FileSpec file_spec; diff --git a/lldb/source/Interpreter/InterpreterProperties.td b/lldb/source/Interpreter/InterpreterProperties.td index a5fccbbca091cf..834f7be17480c6 100644 --- a/lldb/source/Interpreter/InterpreterProperties.td +++ b/lldb/source/Interpreter/InterpreterProperties.td @@ -16,7 +16,7 @@ let Definition = "interpreter" in { def SaveSessionOnQuit: Property<"save-session-on-quit", "Boolean">, Global, DefaultFalse, -Desc<"If true, LLDB will save the session's transcripts before quitting.">; +Desc<"If true, LLDB will save the session's transcripts before quitting. Note: transcripts will only be saved if interpreter.save-transcript is true.">; def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">, Global, DefaultTrue, diff --git a/lldb/test/API/commands/session/save/TestSessionSave.py b/lldb/test/API/commands/session/save/TestSessionSave.py index aa99bcd56aed46..c81ff645d9d3b8 100644 --- a/lldb/test/API/commands/session/save/TestSessionSave.py +++ b/lldb/test/API/commands/session/save/TestSessionSave.py @@ -85,6 +85,8 @@ def test_session_save(self): interpreter.HandleCommand("session save", res) self.assertTrue(res.Succeeded()) raw += self.raw_transcript_builder(cmd, res) +# Also check that we don't print an error message about an empty transcript. +self.assertNotIn("interpreter.save-transcript is set to false", res.GetError()) with open(os.path.join(td.name, os.listdir(td.name)[0]), "r") as file: content = file.read() @@ -93,6 +95,33 @@ def test_session_save(self): for line in lines: self.assertIn(line, content) +@no_debug_info_test +def test_session_save_no_transcript_warning(self): +interpreter = self.dbg.GetCommandInterpreter() + +self.runCmd("settings set interpreter.save-transcript false") + +# These commands won't be saved, so are arbitrary. +commands = [ +"p 1", +"settings set interpreter.save-session-on-quit true", +"fr v", +"settings set interpreter.echo-comment-commands true", +] + +for command in commands: +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand(command, res) + +output_file = self.getBuildArtifact('my-session') + +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand("session save " + output_file, res) +self.assertTrue(res.Succeeded()) +# We should war
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
https://github.com/zhyty closed https://github.com/llvm/llvm-project/pull/109020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/109020 Somewhat recently, we made the change to hide the behavior to save LLDB session history to the transcript buffer behind the flag `interpreter.save-transcript`. By default, `interpreter.save-transcript` is false. See #90703 for context. I'm making a small update here to our `session save` messaging and some help docs to clarify for users that aren't aware of this change. Maybe `interpreter.save-transcript` could be true by default as well. Any feedback welcome. # Tests ``` bin/lldb-dotest -p TestSessionSave ``` >From 60045b710e1102d6f220dfd4367f997b73bb64df Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Tue, 17 Sep 2024 09:56:09 -0700 Subject: [PATCH] Add warning message to `session save` when transcript isn't saved. Somewhat recently, we made the change to hide the behavior to save LLDB session history to the transcript buffer behind the flag `interpreter.save-transcript`. --- lldb/source/Commands/CommandObjectSession.cpp | 3 +- .../source/Interpreter/CommandInterpreter.cpp | 2 ++ .../Interpreter/InterpreterProperties.td | 2 +- .../commands/session/save/TestSessionSave.py | 29 +++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lldb/source/Commands/CommandObjectSession.cpp b/lldb/source/Commands/CommandObjectSession.cpp index c381ba4f74f120..3f714cec414695 100644 --- a/lldb/source/Commands/CommandObjectSession.cpp +++ b/lldb/source/Commands/CommandObjectSession.cpp @@ -19,7 +19,8 @@ class CommandObjectSessionSave : public CommandObjectParsed { : CommandObjectParsed(interpreter, "session save", "Save the current session transcripts to a file.\n" "If no file if specified, transcripts will be " -"saved to a temporary file.", +"saved to a temporary file.\n" +"Note: transcripts will only be saved if interpreter.save-transcript is true.\n", "session save [file]") { AddSimpleArgumentList(eArgTypePath, eArgRepeatOptional); } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index b93f47a8a8d5ec..05426771ba0335 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) { const FileSpec file_spec; diff --git a/lldb/source/Interpreter/InterpreterProperties.td b/lldb/source/Interpreter/InterpreterProperties.td index a5fccbbca091cf..834f7be17480c6 100644 --- a/lldb/source/Interpreter/InterpreterProperties.td +++ b/lldb/source/Interpreter/InterpreterProperties.td @@ -16,7 +16,7 @@ let Definition = "interpreter" in { def SaveSessionOnQuit: Property<"save-session-on-quit", "Boolean">, Global, DefaultFalse, -Desc<"If true, LLDB will save the session's transcripts before quitting.">; +Desc<"If true, LLDB will save the session's transcripts before quitting. Note: transcripts will only be saved if interpreter.save-transcript is true.">; def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">, Global, DefaultTrue, diff --git a/lldb/test/API/commands/session/save/TestSessionSave.py b/lldb/test/API/commands/session/save/TestSessionSave.py index aa99bcd56aed46..c81ff645d9d3b8 100644 --- a/lldb/test/API/commands/session/save/TestSessionSave.py +++ b/lldb/test/API/commands/session/save/TestSessionSave.py @@ -85,6 +85,8 @@ def test_session_save(self): interpreter.HandleCommand("session save", res) self.assertTrue(res.Succeeded()) raw += self.raw_transcript_builder(cmd, res) +# Also check that we don't print an error message about an empty transcript. +self.assertNotIn("interpreter.save-transcript is set to false", res.GetError()) with open(os.path.join(td.name, os.listdir(td.name)[0]), "r") as file: content = file.read() @@ -93,6 +95,33 @@ def test_session_save(self): for line in lines: self.assertIn(line, content) +@no_debug_info_test +def test_session_save_no_transcript_warning(self): +interpreter = self.dbg.GetCommandInterpreter() + +self.runCmd("settings set interpreter.save-transcript false") + +# These commands won't be saved, so are arbitrary. +commands = [ +"p 1", +"settings set i
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
@@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); zhyty wrote: @medismailben friendly ping on any followup comments. If not, I'll go ahead and merge. https://github.com/llvm/llvm-project/pull/109020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
https://github.com/zhyty deleted https://github.com/llvm/llvm-project/pull/109020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
@@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); zhyty wrote: Sounds good to me. I'll make the change. https://github.com/llvm/llvm-project/pull/109020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
@@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); zhyty wrote: Here's an example: ``` (lldb) settings set interpreter.save-transcript true (lldb) p 1 (int) 1 (lldb) hello error: 'hello' is not a valid command. (lldb) settings set interpreter.save-transcript false (lldb) p 2 (int) 2 (lldb) session save Session's transcripts saved to /var/folders/dh/nv6c_38j4tq3crp6r6f69sdcgn/T/lldb/lldb_session_2024-09-20_17-46-03.936239000.log error: Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded. ``` In this case, the text in between the two `interpreter.save-transcript` settings will be saved, including the actual command to disable it. So here's what's saved: ``` (lldb) settings set interpreter.save-transcript true (lldb) p 1 (int) 1 (lldb) hello [0;1;31merror: [0m'hello' is not a valid command. (lldb) settings set interpreter.save-transcript false ``` This is why I worded it like this. `session save` *will* save whatever's found in the transcript buffer, but what was actually saved in the transcript buffer depends if users did something like this. https://github.com/llvm/llvm-project/pull/109020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/109020 >From 60045b710e1102d6f220dfd4367f997b73bb64df Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Tue, 17 Sep 2024 09:56:09 -0700 Subject: [PATCH 1/2] Add warning message to `session save` when transcript isn't saved. Somewhat recently, we made the change to hide the behavior to save LLDB session history to the transcript buffer behind the flag `interpreter.save-transcript`. --- lldb/source/Commands/CommandObjectSession.cpp | 3 +- .../source/Interpreter/CommandInterpreter.cpp | 2 ++ .../Interpreter/InterpreterProperties.td | 2 +- .../commands/session/save/TestSessionSave.py | 29 +++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lldb/source/Commands/CommandObjectSession.cpp b/lldb/source/Commands/CommandObjectSession.cpp index c381ba4f74f120..3f714cec414695 100644 --- a/lldb/source/Commands/CommandObjectSession.cpp +++ b/lldb/source/Commands/CommandObjectSession.cpp @@ -19,7 +19,8 @@ class CommandObjectSessionSave : public CommandObjectParsed { : CommandObjectParsed(interpreter, "session save", "Save the current session transcripts to a file.\n" "If no file if specified, transcripts will be " -"saved to a temporary file.", +"saved to a temporary file.\n" +"Note: transcripts will only be saved if interpreter.save-transcript is true.\n", "session save [file]") { AddSimpleArgumentList(eArgTypePath, eArgRepeatOptional); } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index b93f47a8a8d5ec..05426771ba0335 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) { const FileSpec file_spec; diff --git a/lldb/source/Interpreter/InterpreterProperties.td b/lldb/source/Interpreter/InterpreterProperties.td index a5fccbbca091cf..834f7be17480c6 100644 --- a/lldb/source/Interpreter/InterpreterProperties.td +++ b/lldb/source/Interpreter/InterpreterProperties.td @@ -16,7 +16,7 @@ let Definition = "interpreter" in { def SaveSessionOnQuit: Property<"save-session-on-quit", "Boolean">, Global, DefaultFalse, -Desc<"If true, LLDB will save the session's transcripts before quitting.">; +Desc<"If true, LLDB will save the session's transcripts before quitting. Note: transcripts will only be saved if interpreter.save-transcript is true.">; def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">, Global, DefaultTrue, diff --git a/lldb/test/API/commands/session/save/TestSessionSave.py b/lldb/test/API/commands/session/save/TestSessionSave.py index aa99bcd56aed46..c81ff645d9d3b8 100644 --- a/lldb/test/API/commands/session/save/TestSessionSave.py +++ b/lldb/test/API/commands/session/save/TestSessionSave.py @@ -85,6 +85,8 @@ def test_session_save(self): interpreter.HandleCommand("session save", res) self.assertTrue(res.Succeeded()) raw += self.raw_transcript_builder(cmd, res) +# Also check that we don't print an error message about an empty transcript. +self.assertNotIn("interpreter.save-transcript is set to false", res.GetError()) with open(os.path.join(td.name, os.listdir(td.name)[0]), "r") as file: content = file.read() @@ -93,6 +95,33 @@ def test_session_save(self): for line in lines: self.assertIn(line, content) +@no_debug_info_test +def test_session_save_no_transcript_warning(self): +interpreter = self.dbg.GetCommandInterpreter() + +self.runCmd("settings set interpreter.save-transcript false") + +# These commands won't be saved, so are arbitrary. +commands = [ +"p 1", +"settings set interpreter.save-session-on-quit true", +"fr v", +"settings set interpreter.echo-comment-commands true", +] + +for command in commands: +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand(command, res) + +output_file = self.getBuildArtifact('my-session') + +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand("session save " + output_file, res) +self.assertTrue(res.Succeeded()) +# We should war
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
@@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); zhyty wrote: See my [comment above](https://github.com/llvm/llvm-project/pull/109020#discussion_r1769375600). I hate to be so pedantic about it, but I would be worried if users used this flow of ``` (lldb) settings set interpreter.save-transcript true ... do various things they want to save ... (lldb) settings set interpreter.save-transcript false ... do various things they don't want to save ... (lldb) session save ``` This wouldn't work anymore if we early returned. To your point though, I guess they could always re-toggle it before that last session save, and maybe it would be better for the average user. Anyway, that's why I decided to make this commit so conservative. https://github.com/llvm/llvm-project/pull/109020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/109020 >From 60045b710e1102d6f220dfd4367f997b73bb64df Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Tue, 17 Sep 2024 09:56:09 -0700 Subject: [PATCH 1/2] Add warning message to `session save` when transcript isn't saved. Somewhat recently, we made the change to hide the behavior to save LLDB session history to the transcript buffer behind the flag `interpreter.save-transcript`. --- lldb/source/Commands/CommandObjectSession.cpp | 3 +- .../source/Interpreter/CommandInterpreter.cpp | 2 ++ .../Interpreter/InterpreterProperties.td | 2 +- .../commands/session/save/TestSessionSave.py | 29 +++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lldb/source/Commands/CommandObjectSession.cpp b/lldb/source/Commands/CommandObjectSession.cpp index c381ba4f74f120..3f714cec414695 100644 --- a/lldb/source/Commands/CommandObjectSession.cpp +++ b/lldb/source/Commands/CommandObjectSession.cpp @@ -19,7 +19,8 @@ class CommandObjectSessionSave : public CommandObjectParsed { : CommandObjectParsed(interpreter, "session save", "Save the current session transcripts to a file.\n" "If no file if specified, transcripts will be " -"saved to a temporary file.", +"saved to a temporary file.\n" +"Note: transcripts will only be saved if interpreter.save-transcript is true.\n", "session save [file]") { AddSimpleArgumentList(eArgTypePath, eArgRepeatOptional); } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index b93f47a8a8d5ec..05426771ba0335 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) { const FileSpec file_spec; diff --git a/lldb/source/Interpreter/InterpreterProperties.td b/lldb/source/Interpreter/InterpreterProperties.td index a5fccbbca091cf..834f7be17480c6 100644 --- a/lldb/source/Interpreter/InterpreterProperties.td +++ b/lldb/source/Interpreter/InterpreterProperties.td @@ -16,7 +16,7 @@ let Definition = "interpreter" in { def SaveSessionOnQuit: Property<"save-session-on-quit", "Boolean">, Global, DefaultFalse, -Desc<"If true, LLDB will save the session's transcripts before quitting.">; +Desc<"If true, LLDB will save the session's transcripts before quitting. Note: transcripts will only be saved if interpreter.save-transcript is true.">; def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">, Global, DefaultTrue, diff --git a/lldb/test/API/commands/session/save/TestSessionSave.py b/lldb/test/API/commands/session/save/TestSessionSave.py index aa99bcd56aed46..c81ff645d9d3b8 100644 --- a/lldb/test/API/commands/session/save/TestSessionSave.py +++ b/lldb/test/API/commands/session/save/TestSessionSave.py @@ -85,6 +85,8 @@ def test_session_save(self): interpreter.HandleCommand("session save", res) self.assertTrue(res.Succeeded()) raw += self.raw_transcript_builder(cmd, res) +# Also check that we don't print an error message about an empty transcript. +self.assertNotIn("interpreter.save-transcript is set to false", res.GetError()) with open(os.path.join(td.name, os.listdir(td.name)[0]), "r") as file: content = file.read() @@ -93,6 +95,33 @@ def test_session_save(self): for line in lines: self.assertIn(line, content) +@no_debug_info_test +def test_session_save_no_transcript_warning(self): +interpreter = self.dbg.GetCommandInterpreter() + +self.runCmd("settings set interpreter.save-transcript false") + +# These commands won't be saved, so are arbitrary. +commands = [ +"p 1", +"settings set interpreter.save-session-on-quit true", +"fr v", +"settings set interpreter.echo-comment-commands true", +] + +for command in commands: +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand(command, res) + +output_file = self.getBuildArtifact('my-session') + +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand("session save " + output_file, res) +self.assertTrue(res.Succeeded()) +# We should war
[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/109020 >From 60045b710e1102d6f220dfd4367f997b73bb64df Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Tue, 17 Sep 2024 09:56:09 -0700 Subject: [PATCH 1/2] Add warning message to `session save` when transcript isn't saved. Somewhat recently, we made the change to hide the behavior to save LLDB session history to the transcript buffer behind the flag `interpreter.save-transcript`. --- lldb/source/Commands/CommandObjectSession.cpp | 3 +- .../source/Interpreter/CommandInterpreter.cpp | 2 ++ .../Interpreter/InterpreterProperties.td | 2 +- .../commands/session/save/TestSessionSave.py | 29 +++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lldb/source/Commands/CommandObjectSession.cpp b/lldb/source/Commands/CommandObjectSession.cpp index c381ba4f74f120..3f714cec414695 100644 --- a/lldb/source/Commands/CommandObjectSession.cpp +++ b/lldb/source/Commands/CommandObjectSession.cpp @@ -19,7 +19,8 @@ class CommandObjectSessionSave : public CommandObjectParsed { : CommandObjectParsed(interpreter, "session save", "Save the current session transcripts to a file.\n" "If no file if specified, transcripts will be " -"saved to a temporary file.", +"saved to a temporary file.\n" +"Note: transcripts will only be saved if interpreter.save-transcript is true.\n", "session save [file]") { AddSimpleArgumentList(eArgTypePath, eArgRepeatOptional); } diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index b93f47a8a8d5ec..05426771ba0335 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript( result.SetStatus(eReturnStatusSuccessFinishNoResult); result.AppendMessageWithFormat("Session's transcripts saved to %s\n", output_file->c_str()); + if (!GetSaveTranscript()) +result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded."); if (GetOpenTranscriptInEditor() && Host::IsInteractiveGraphicSession()) { const FileSpec file_spec; diff --git a/lldb/source/Interpreter/InterpreterProperties.td b/lldb/source/Interpreter/InterpreterProperties.td index a5fccbbca091cf..834f7be17480c6 100644 --- a/lldb/source/Interpreter/InterpreterProperties.td +++ b/lldb/source/Interpreter/InterpreterProperties.td @@ -16,7 +16,7 @@ let Definition = "interpreter" in { def SaveSessionOnQuit: Property<"save-session-on-quit", "Boolean">, Global, DefaultFalse, -Desc<"If true, LLDB will save the session's transcripts before quitting.">; +Desc<"If true, LLDB will save the session's transcripts before quitting. Note: transcripts will only be saved if interpreter.save-transcript is true.">; def OpenTranscriptInEditor: Property<"open-transcript-in-editor", "Boolean">, Global, DefaultTrue, diff --git a/lldb/test/API/commands/session/save/TestSessionSave.py b/lldb/test/API/commands/session/save/TestSessionSave.py index aa99bcd56aed46..c81ff645d9d3b8 100644 --- a/lldb/test/API/commands/session/save/TestSessionSave.py +++ b/lldb/test/API/commands/session/save/TestSessionSave.py @@ -85,6 +85,8 @@ def test_session_save(self): interpreter.HandleCommand("session save", res) self.assertTrue(res.Succeeded()) raw += self.raw_transcript_builder(cmd, res) +# Also check that we don't print an error message about an empty transcript. +self.assertNotIn("interpreter.save-transcript is set to false", res.GetError()) with open(os.path.join(td.name, os.listdir(td.name)[0]), "r") as file: content = file.read() @@ -93,6 +95,33 @@ def test_session_save(self): for line in lines: self.assertIn(line, content) +@no_debug_info_test +def test_session_save_no_transcript_warning(self): +interpreter = self.dbg.GetCommandInterpreter() + +self.runCmd("settings set interpreter.save-transcript false") + +# These commands won't be saved, so are arbitrary. +commands = [ +"p 1", +"settings set interpreter.save-session-on-quit true", +"fr v", +"settings set interpreter.echo-comment-commands true", +] + +for command in commands: +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand(command, res) + +output_file = self.getBuildArtifact('my-session') + +res = lldb.SBCommandReturnObject() +interpreter.HandleCommand("session save " + output_file, res) +self.assertTrue(res.Succeeded()) +# We should war
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty ready_for_review https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/130912 This patch improves the time performance of LLDB launch on Linux machines, particularly for executables with a lot of shared library dependencies (or modules). The commits have some context on their specific changes as well -- hopefully this helps the review. # Testing >From fbf25b1cd4f6d527944fb85fc4d2d03498755a05 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 10 Mar 2025 17:58:17 -0700 Subject: [PATCH 1/3] Add option for enabling/disabling parallel load Add a setting to gate the new parallel dynamic library loading feature in the next diff. I followed the example of `lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp` and `lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp` to create a scoped setting for the new feature. NOTE: this setting defaults to FALSE. Users should be able to enable the new feature as easily as adding a line to their .lldbinit file, or manually setting it in their session. ``` (lldb) apropos "POSIX dynamic" No commands found pertaining to 'POSIX dynamic'. Try 'help' to see a complete list of debugger commands. The following settings variables may relate to 'POSIX dynamic': plugin.dynamic-loader.posix-dyld.parallel-module-load -- Enable experimental loading of modules in parallel for the POSIX dynamic loader. (lldb) settings show plugin.dynamic-loader.posix-dyld.parallel-module-load plugin.dynamic-loader.posix-dyld.parallel-module-load (boolean) = false (lldb) settings set plugin.dynamic-loader.posix-dyld.parallel-module-load true (lldb) settings show plugin.dynamic-loader.posix-dyld.parallel-module-load plugin.dynamic-loader.posix-dyld.parallel-module-load (boolean) = true ``` --- .../DynamicLoader/POSIX-DYLD/CMakeLists.txt | 12 + .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 49 ++- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.h | 2 + .../DynamicLoaderPOSIXDYLDProperties.td | 8 +++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLDProperties.td diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt index c1e00b2dd444f..532bfb20ea0f1 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(DynamicLoaderPOSIXDYLDProperties.inc -gen-lldb-property-defs + SOURCE DynamicLoaderPOSIXDYLDProperties.td + TARGET LLDBPluginDynamicLoaderPOSIXDYLDPropertiesGen) + +lldb_tablegen(DynamicLoaderPOSIXDYLDPropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE DynamicLoaderPOSIXDYLDProperties.td + TARGET LLDBPluginDynamicLoaderPOSIXDYLDPropertiesEnumGen) + add_lldb_library(lldbPluginDynamicLoaderPosixDYLD PLUGIN DYLDRendezvous.cpp DynamicLoaderPOSIXDYLD.cpp @@ -13,3 +21,7 @@ add_lldb_library(lldbPluginDynamicLoaderPosixDYLD PLUGIN LINK_COMPONENTS Support ) + +add_dependencies(lldbPluginDynamicLoaderPosixDYLD + LLDBPluginDynamicLoaderPOSIXDYLDPropertiesGen + LLDBPluginDynamicLoaderPOSIXDYLDPropertiesEnumGen) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 53ba11ac21bd3..c89d16649922d 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -34,9 +34,56 @@ using namespace lldb_private; LLDB_PLUGIN_DEFINE_ADV(DynamicLoaderPOSIXDYLD, DynamicLoaderPosixDYLD) +namespace { + +#define LLDB_PROPERTIES_dynamicloaderposixdyld +#include "DynamicLoaderPOSIXDYLDProperties.inc" + +enum { +#define LLDB_PROPERTIES_dynamicloaderposixdyld +#include "DynamicLoaderPOSIXDYLDPropertiesEnum.inc" +}; + +class PluginProperties : public Properties { +public: + static llvm::StringRef GetSettingName() { +return DynamicLoaderPOSIXDYLD::GetPluginNameStatic(); + } + + PluginProperties() : Properties() { +m_collection_sp = std::make_shared(GetSettingName()); +m_collection_sp->Initialize(g_dynamicloaderposixdyld_properties); + } + + ~PluginProperties() override = default; + + bool GetParallelModuleLoad() const { +const uint32_t idx = ePropertyParallelModuleLoad; +return GetPropertyAtIndexAs(idx, true); + } +}; + +} // namespace + +static PluginProperties &GetGlobalPluginProperties() { + static PluginProperties g_settings; + return g_settings; +} + void DynamicLoaderPOSIXDYLD::Initialize() { PluginManager::RegisterPlugin(GetPluginNameStatic(), -GetPluginDescriptionStatic(), CreateInstance); +GetPluginDescriptionStatic(), CreateInstance, +&DebuggerInitialize); +} + +void DynamicLoaderPOSIXDYLD::Debugg
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/130912 >From fbf25b1cd4f6d527944fb85fc4d2d03498755a05 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 10 Mar 2025 17:58:17 -0700 Subject: [PATCH 1/3] Add option for enabling/disabling parallel load Add a setting to gate the new parallel dynamic library loading feature in the next diff. I followed the example of `lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp` and `lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp` to create a scoped setting for the new feature. NOTE: this setting defaults to FALSE. Users should be able to enable the new feature as easily as adding a line to their .lldbinit file, or manually setting it in their session. ``` (lldb) apropos "POSIX dynamic" No commands found pertaining to 'POSIX dynamic'. Try 'help' to see a complete list of debugger commands. The following settings variables may relate to 'POSIX dynamic': plugin.dynamic-loader.posix-dyld.parallel-module-load -- Enable experimental loading of modules in parallel for the POSIX dynamic loader. (lldb) settings show plugin.dynamic-loader.posix-dyld.parallel-module-load plugin.dynamic-loader.posix-dyld.parallel-module-load (boolean) = false (lldb) settings set plugin.dynamic-loader.posix-dyld.parallel-module-load true (lldb) settings show plugin.dynamic-loader.posix-dyld.parallel-module-load plugin.dynamic-loader.posix-dyld.parallel-module-load (boolean) = true ``` --- .../DynamicLoader/POSIX-DYLD/CMakeLists.txt | 12 + .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 49 ++- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.h | 2 + .../DynamicLoaderPOSIXDYLDProperties.td | 8 +++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLDProperties.td diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt index c1e00b2dd444f..532bfb20ea0f1 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(DynamicLoaderPOSIXDYLDProperties.inc -gen-lldb-property-defs + SOURCE DynamicLoaderPOSIXDYLDProperties.td + TARGET LLDBPluginDynamicLoaderPOSIXDYLDPropertiesGen) + +lldb_tablegen(DynamicLoaderPOSIXDYLDPropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE DynamicLoaderPOSIXDYLDProperties.td + TARGET LLDBPluginDynamicLoaderPOSIXDYLDPropertiesEnumGen) + add_lldb_library(lldbPluginDynamicLoaderPosixDYLD PLUGIN DYLDRendezvous.cpp DynamicLoaderPOSIXDYLD.cpp @@ -13,3 +21,7 @@ add_lldb_library(lldbPluginDynamicLoaderPosixDYLD PLUGIN LINK_COMPONENTS Support ) + +add_dependencies(lldbPluginDynamicLoaderPosixDYLD + LLDBPluginDynamicLoaderPOSIXDYLDPropertiesGen + LLDBPluginDynamicLoaderPOSIXDYLDPropertiesEnumGen) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 53ba11ac21bd3..c89d16649922d 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -34,9 +34,56 @@ using namespace lldb_private; LLDB_PLUGIN_DEFINE_ADV(DynamicLoaderPOSIXDYLD, DynamicLoaderPosixDYLD) +namespace { + +#define LLDB_PROPERTIES_dynamicloaderposixdyld +#include "DynamicLoaderPOSIXDYLDProperties.inc" + +enum { +#define LLDB_PROPERTIES_dynamicloaderposixdyld +#include "DynamicLoaderPOSIXDYLDPropertiesEnum.inc" +}; + +class PluginProperties : public Properties { +public: + static llvm::StringRef GetSettingName() { +return DynamicLoaderPOSIXDYLD::GetPluginNameStatic(); + } + + PluginProperties() : Properties() { +m_collection_sp = std::make_shared(GetSettingName()); +m_collection_sp->Initialize(g_dynamicloaderposixdyld_properties); + } + + ~PluginProperties() override = default; + + bool GetParallelModuleLoad() const { +const uint32_t idx = ePropertyParallelModuleLoad; +return GetPropertyAtIndexAs(idx, true); + } +}; + +} // namespace + +static PluginProperties &GetGlobalPluginProperties() { + static PluginProperties g_settings; + return g_settings; +} + void DynamicLoaderPOSIXDYLD::Initialize() { PluginManager::RegisterPlugin(GetPluginNameStatic(), -GetPluginDescriptionStatic(), CreateInstance); +GetPluginDescriptionStatic(), CreateInstance, +&DebuggerInitialize); +} + +void DynamicLoaderPOSIXDYLD::DebuggerInitialize(Debugger &debugger) { + if (!PluginManager::GetSettingForDynamicLoaderPlugin( + debugger, PluginProperties::GetSettingName())) { +const bool is_global_setting = true; +PluginManager::CreateSettingForDynamicLoaderPlugin( +debugger, GetGlobal
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
@@ -0,0 +1,8 @@ + +include "../../../../include/lldb/Core/PropertiesBase.td" + +let Definition = "dynamicloaderposixdyld" in { + def ParallelModuleLoad: Property<"parallel-module-load", "Boolean">, zhyty wrote: I don't feel strongly about keeping it as a plugin-specific setting or hoisting it to target and setting it generically. I missed the naming for the Darwin-equivalent though -- will rename depending on what we choose. I initially opted for the plugin-scoped setting since I wanted to make the setting as specific as possible, because I wasn't sure how many other platforms had a specific parallel loading flag like Darwin. https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [NFC][LLDB] Clean up comments/some code in MinidumpFileBuilder (PR #134961)
https://github.com/zhyty approved this pull request. LGTM, though the comment in `AddData` seemed useful, even though it had a couple of typos. Why remove it? https://github.com/llvm/llvm-project/pull/134961 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
@@ -423,34 +493,66 @@ void DynamicLoaderPOSIXDYLD::RefreshModules() { E = m_rendezvous.end(); m_initial_modules_added = true; } -for (; I != E; ++I) { - // Don't load a duplicate copy of ld.so if we have already loaded it - // earlier in LoadInterpreterModule. If we instead loaded then unloaded it - // later, the section information for ld.so would be removed. That - // information is required for placing breakpoints on Arm/Thumb systems. - if ((m_interpreter_module.lock() != nullptr) && - (I->base_addr == m_interpreter_base)) -continue; - - ModuleSP module_sp = - LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true); - if (!module_sp.get()) -continue; - - if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress( - &m_process->GetTarget()) == m_interpreter_base) { -ModuleSP interpreter_sp = m_interpreter_module.lock(); -if (m_interpreter_module.lock() == nullptr) { - m_interpreter_module = module_sp; -} else if (module_sp == interpreter_sp) { - // Module already loaded. - continue; -} - } - loaded_modules.AppendIfNeeded(module_sp); - new_modules.Append(module_sp); +std::mutex interpreter_module_mutex; +// We should be able to take SOEntry as reference since the data +// exists for the duration of this call in `m_rendezvous`. +auto load_module_fn = +[this, &loaded_modules, &new_modules, + &interpreter_module_mutex](const DYLDRendezvous::SOEntry &so_entry) { + // Don't load a duplicate copy of ld.so if we have already loaded it + // earlier in LoadInterpreterModule. If we instead loaded then + // unloaded it later, the section information for ld.so would be + // removed. That information is required for placing breakpoints on + // Arm/Thumb systems. + { +// `m_interpreter_module` may be modified by another thread at the +// same time, so we guard the access here. +std::lock_guard lock(interpreter_module_mutex); +if ((m_interpreter_module.lock() != nullptr) && +(so_entry.base_addr == m_interpreter_base)) + return; + } + + ModuleSP module_sp = LoadModuleAtAddress( + so_entry.file_spec, so_entry.link_addr, so_entry.base_addr, true); + if (!module_sp.get()) +return; + + { +// `m_interpreter_module` may be modified by another thread at the +// same time, so we guard the access here. +std::lock_guard lock(interpreter_module_mutex); +// Set the interpreter module, if this is the interpreter. +if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress( +&m_process->GetTarget()) == m_interpreter_base) { + ModuleSP interpreter_sp = m_interpreter_module.lock(); + if (m_interpreter_module.lock() == nullptr) { +m_interpreter_module = module_sp; + } else if (module_sp == interpreter_sp) { +// Module already loaded. +return; + } +} + } + + loaded_modules.AppendIfNeeded(module_sp); + new_modules.Append(module_sp); +}; + +// Loading modules in parallel tends to be faster, but is still unstable. zhyty wrote: There are no known issues. That comment is a leftover from the development process + me being too conservative. I felt at the time until we had tons of users testing it, I would call it "unstable". But, that's confusing in hindsight, so I'll remove the comment. https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
zhyty wrote: > This looks like the equivalent of #110646 but for Linux and the overall > approach looks good to me. > > My only real concern is about the setting and it being **off** by default. I > would prefer that this is **on** by default and the setting is there as an > escape hatch in case there's an unexpected issue. I'd like to understand > what's holding that back? > > Building on that, if the setting is on by default, then instead of creating a > new setting per plugin, I'd like to hoist it into target and have one setting > that controls this behavior for all of them. I expect it to be rare that > you'd want to turn this off for one plugin but not the other. Unless we are a > 100% sure we're going to take away the setting (in which case the setting > should be experimental[1]), it's easier to keep it around, for example to > make it easier to debug or quickly toggle it and see if a concurrency issue > disappears. > > [1] See > `plugin.dynamic-loader.darwin.experimental.enable-parallel-image-load`. The > experimental prefix allows you to set that option without it existing for > when it either gets promoted to a real setting (without the experimental) or > alternative it goes away. Thanks for the review. Yes, this PR was inspired by #110646 (I didn't have the PR number on hand, will link in the description). Internally, we were planning to have it on by default as well, but we felt that maybe it would be easier to land in open source if we had it off by default. I'm in favor of having it on as well, having no known issues. https://github.com/llvm/llvm-project/pull/130912 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Parallelize module loading in POSIX dyld code (PR #130912)
https://github.com/zhyty updated https://github.com/llvm/llvm-project/pull/130912 >From fbf25b1cd4f6d527944fb85fc4d2d03498755a05 Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Mon, 10 Mar 2025 17:58:17 -0700 Subject: [PATCH 1/5] Add option for enabling/disabling parallel load Add a setting to gate the new parallel dynamic library loading feature in the next diff. I followed the example of `lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp` and `lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp` to create a scoped setting for the new feature. NOTE: this setting defaults to FALSE. Users should be able to enable the new feature as easily as adding a line to their .lldbinit file, or manually setting it in their session. ``` (lldb) apropos "POSIX dynamic" No commands found pertaining to 'POSIX dynamic'. Try 'help' to see a complete list of debugger commands. The following settings variables may relate to 'POSIX dynamic': plugin.dynamic-loader.posix-dyld.parallel-module-load -- Enable experimental loading of modules in parallel for the POSIX dynamic loader. (lldb) settings show plugin.dynamic-loader.posix-dyld.parallel-module-load plugin.dynamic-loader.posix-dyld.parallel-module-load (boolean) = false (lldb) settings set plugin.dynamic-loader.posix-dyld.parallel-module-load true (lldb) settings show plugin.dynamic-loader.posix-dyld.parallel-module-load plugin.dynamic-loader.posix-dyld.parallel-module-load (boolean) = true ``` --- .../DynamicLoader/POSIX-DYLD/CMakeLists.txt | 12 + .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 49 ++- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.h | 2 + .../DynamicLoaderPOSIXDYLDProperties.td | 8 +++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLDProperties.td diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt index c1e00b2dd444f..532bfb20ea0f1 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt @@ -1,3 +1,11 @@ +lldb_tablegen(DynamicLoaderPOSIXDYLDProperties.inc -gen-lldb-property-defs + SOURCE DynamicLoaderPOSIXDYLDProperties.td + TARGET LLDBPluginDynamicLoaderPOSIXDYLDPropertiesGen) + +lldb_tablegen(DynamicLoaderPOSIXDYLDPropertiesEnum.inc -gen-lldb-property-enum-defs + SOURCE DynamicLoaderPOSIXDYLDProperties.td + TARGET LLDBPluginDynamicLoaderPOSIXDYLDPropertiesEnumGen) + add_lldb_library(lldbPluginDynamicLoaderPosixDYLD PLUGIN DYLDRendezvous.cpp DynamicLoaderPOSIXDYLD.cpp @@ -13,3 +21,7 @@ add_lldb_library(lldbPluginDynamicLoaderPosixDYLD PLUGIN LINK_COMPONENTS Support ) + +add_dependencies(lldbPluginDynamicLoaderPosixDYLD + LLDBPluginDynamicLoaderPOSIXDYLDPropertiesGen + LLDBPluginDynamicLoaderPOSIXDYLDPropertiesEnumGen) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 53ba11ac21bd3..c89d16649922d 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -34,9 +34,56 @@ using namespace lldb_private; LLDB_PLUGIN_DEFINE_ADV(DynamicLoaderPOSIXDYLD, DynamicLoaderPosixDYLD) +namespace { + +#define LLDB_PROPERTIES_dynamicloaderposixdyld +#include "DynamicLoaderPOSIXDYLDProperties.inc" + +enum { +#define LLDB_PROPERTIES_dynamicloaderposixdyld +#include "DynamicLoaderPOSIXDYLDPropertiesEnum.inc" +}; + +class PluginProperties : public Properties { +public: + static llvm::StringRef GetSettingName() { +return DynamicLoaderPOSIXDYLD::GetPluginNameStatic(); + } + + PluginProperties() : Properties() { +m_collection_sp = std::make_shared(GetSettingName()); +m_collection_sp->Initialize(g_dynamicloaderposixdyld_properties); + } + + ~PluginProperties() override = default; + + bool GetParallelModuleLoad() const { +const uint32_t idx = ePropertyParallelModuleLoad; +return GetPropertyAtIndexAs(idx, true); + } +}; + +} // namespace + +static PluginProperties &GetGlobalPluginProperties() { + static PluginProperties g_settings; + return g_settings; +} + void DynamicLoaderPOSIXDYLD::Initialize() { PluginManager::RegisterPlugin(GetPluginNameStatic(), -GetPluginDescriptionStatic(), CreateInstance); +GetPluginDescriptionStatic(), CreateInstance, +&DebuggerInitialize); +} + +void DynamicLoaderPOSIXDYLD::DebuggerInitialize(Debugger &debugger) { + if (!PluginManager::GetSettingForDynamicLoaderPlugin( + debugger, PluginProperties::GetSettingName())) { +const bool is_global_setting = true; +PluginManager::CreateSettingForDynamicLoaderPlugin( +debugger, GetGlobal
[Lldb-commits] [lldb] control Darwin parallel image loading with target.parallel-module-load (PR #134437)
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/134437 A requested follow-up from https://github.com/llvm/llvm-project/pull/130912 by @JDevlieghere to control Darwin parallel image loading with the same `target.parallel-module-load` that controls the POSIX dyld parallel image loading. This small change: * removes `plugin.dynamic-loader.darwin.experimental.enable-parallel-image-load` and associated code. * changes setting call site in `DynamicLoaderDarwin::PreloadModulesFromImageInfos` to use the new setting. Tested by running `ninja check-lldb` and loading some targets. >From 6a8187d337ed9fbfe348596aa5242a6eed3bebed Mon Sep 17 00:00:00 2001 From: Tom Yang Date: Thu, 3 Apr 2025 18:44:52 -0700 Subject: [PATCH] control Darwin parallel image loading with target.parallel-module-load --- .../DynamicLoader/MacOSX-DYLD/CMakeLists.txt | 13 - .../MacOSX-DYLD/DynamicLoaderDarwin.cpp | 15 +- .../MacOSX-DYLD/DynamicLoaderDarwin.h | 2 - .../DynamicLoaderDarwinProperties.cpp | 53 --- .../DynamicLoaderDarwinProperties.h | 34 .../DynamicLoaderDarwinProperties.td | 8 --- .../MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp | 8 +-- .../MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h | 2 - 8 files changed, 2 insertions(+), 133 deletions(-) delete mode 100644 lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.cpp delete mode 100644 lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.h delete mode 100644 lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.td diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt index 77a560541fcb1..7308374c8bfba 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt @@ -1,16 +1,7 @@ -lldb_tablegen(DynamicLoaderDarwinProperties.inc -gen-lldb-property-defs - SOURCE DynamicLoaderDarwinProperties.td - TARGET LLDBPluginDynamicLoaderDarwinPropertiesGen) - -lldb_tablegen(DynamicLoaderDarwinPropertiesEnum.inc -gen-lldb-property-enum-defs - SOURCE DynamicLoaderDarwinProperties.td - TARGET LLDBPluginDynamicLoaderDarwinPropertiesEnumGen) - add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD PLUGIN DynamicLoaderMacOSXDYLD.cpp DynamicLoaderMacOS.cpp DynamicLoaderDarwin.cpp - DynamicLoaderDarwinProperties.cpp LINK_LIBS lldbBreakpoint @@ -25,7 +16,3 @@ add_lldb_library(lldbPluginDynamicLoaderMacOSXDYLD PLUGIN Support TargetParser ) - -add_dependencies(lldbPluginDynamicLoaderMacOSXDYLD - LLDBPluginDynamicLoaderDarwinPropertiesGen - LLDBPluginDynamicLoaderDarwinPropertiesEnumGen) diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index f9b49c50355d5..e25c4ff55e408 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -8,7 +8,6 @@ #include "DynamicLoaderDarwin.h" -#include "DynamicLoaderDarwinProperties.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" @@ -79,17 +78,6 @@ void DynamicLoaderDarwin::DidLaunch() { SetNotificationBreakpoint(); } -void DynamicLoaderDarwin::CreateSettings(lldb_private::Debugger &debugger) { - if (!PluginManager::GetSettingForDynamicLoaderPlugin( - debugger, DynamicLoaderDarwinProperties::GetSettingName())) { -const bool is_global_setting = true; -PluginManager::CreateSettingForDynamicLoaderPlugin( -debugger, -DynamicLoaderDarwinProperties::GetGlobal().GetValueProperties(), -"Properties for the DynamicLoaderDarwin plug-in.", is_global_setting); - } -} - // Clear out the state of this class. void DynamicLoaderDarwin::Clear(bool clear_process) { std::lock_guard guard(m_mutex); @@ -670,8 +658,7 @@ DynamicLoaderDarwin::PreloadModulesFromImageInfos( image_info, FindTargetModuleForImageInfo(image_info, true, nullptr)); }; auto it = image_infos.begin(); - bool is_parallel_load = - DynamicLoaderDarwinProperties::GetGlobal().GetEnableParallelImageLoad(); + bool is_parallel_load = m_process->GetTarget().GetParallelModuleLoad(); if (is_parallel_load) { llvm::ThreadPoolTaskGroup taskGroup(Debugger::GetThreadPool()); for (size_t i = 0; i < size; ++i, ++it) { diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h index bc5464d76b950..37528b88b615e 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.h @@ -58,8 +58,6 @@ class Dynam
[Lldb-commits] [lldb] control Darwin parallel image loading with target.parallel-module-load (PR #134437)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/134437 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] control Darwin parallel image loading with target.parallel-module-load (PR #134437)
https://github.com/zhyty edited https://github.com/llvm/llvm-project/pull/134437 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits