-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand #71230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Tom Yang (zhyty) ChangesEasy change to get Added tests
It's easy to verify this manually by running
Full diff: https://github.com/llvm/llvm-project/pull/71230.diff 3 Files Affected:
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"])
|
lldb/test/API/commands/target/dump-separate-debug-info/dwo/TestDumpDwo.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
FYI: here is how you might be able to try cross compiling by editing the Makefile and removing the @skipIf*
. The compile command for cross compiling looks like:
clang++ -target x86_64-pc-linux-elf -g -gsplit-dwarf -c main.cpp
You will want to try adding a bogus -target x86_64--carp
and make sure the test stops or can handle not compiling correctly. This will help you figure out what will happen if -target x86_64-pc-linux-elf
doesn't work because ELF or linux support isn't compiled into clang. If you can't gracefully handle this case, then just leave the @skip
decorators as is
14fbf21
to
da7cf85
Compare
✅ With the latest revision this PR passed the Python code formatter. |
@bulbazord @clayborg I updated the DWO tests so that we try to compile for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Easy change to get
image dump separate-debug-info
working when usingsymbols.load-on-demand
. Also added a line of space in the default table output.Updated the testing in response to comments.
Added tests
It's easy to verify this manually by running