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 <toy...@fb.com> 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<uint64_t> 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 <toy...@fb.com> 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(target, lldbtest.VALID_TARGET) + + self.runCmd("target modules dump separate-debug-info --json") + + # Check the output + osos = self.get_osos_from_json_output() + self.assertTrue(osos[exe][main_o]["loaded"]) + self.assertTrue(osos[exe][foo_o]["loaded"]) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits