[Lldb-commits] [PATCH] D137284: Override CalculateFrameVariableError in SymbolFileOnDemand
Yubo Hu via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 2 17:05:36 PDT 2022
GeorgeHuyubo updated this revision to Diff 472810.
GeorgeHuyubo marked 2 inline comments as done.
GeorgeHuyubo added a comment.
Address comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137284/new/
https://reviews.llvm.org/D137284
Files:
lldb/include/lldb/Symbol/SymbolFileOnDemand.h
lldb/source/Symbol/SymbolFileOnDemand.cpp
lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
Index: lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
===================================================================
--- lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
+++ lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
@@ -559,3 +559,46 @@
}
varref_dict = {}
self.verify_variables(verify_locals, locals, varref_dict)
+
+
+ @no_debug_info_test
+ @skipUnlessDarwin
+ def test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled(self):
+ '''
+ Test that if we build a binary with DWARF in .o files and we remove
+ the .o file for main.cpp, that we get a variable named "<error>"
+ whose value matches the appriopriate error. Test with symbol_ondemand_enabled.
+ '''
+ self.build(debug_info="dwarf")
+ program = self.getBuildArtifact("a.out")
+ main_obj = self.getBuildArtifact("main.o")
+ self.assertTrue(os.path.exists(main_obj))
+ # Delete the main.o file that contains the debug info so we force an
+ # error when we run to main and try to get variables
+ os.unlink(main_obj)
+
+ self.create_debug_adaptor()
+ self.assertTrue(os.path.exists(program), 'executable must exist')
+
+ initCommands = ['settings set symbols.load-on-demand true']
+ self.launch(program=program,
+ initCommands=initCommands)
+
+ functions = ['main']
+ breakpoint_ids = self.set_function_breakpoints(functions)
+ self.assertEquals(len(breakpoint_ids), len(functions), "expect one breakpoint")
+ self.continue_to_breakpoints(breakpoint_ids)
+
+ locals = self.vscode.get_local_variables()
+
+ verify_locals = {
+ '<error>': {
+ 'equals': {'type': 'const char *'},
+ 'contains': { 'value': [
+ 'debug map object file ',
+ 'main.o" containing debug info does not exist, debug info will not be loaded']
+ }
+ },
+ }
+ varref_dict = {}
+ self.verify_variables(verify_locals, locals, varref_dict)
Index: lldb/source/Symbol/SymbolFileOnDemand.cpp
===================================================================
--- lldb/source/Symbol/SymbolFileOnDemand.cpp
+++ lldb/source/Symbol/SymbolFileOnDemand.cpp
@@ -274,6 +274,15 @@
return m_sym_file_impl->ResolveSymbolContext(so_addr, resolve_scope, sc);
}
+Status SymbolFileOnDemand::CalculateFrameVariableError(StackFrame &frame) {
+ if (!m_debug_info_enabled) {
+ LLDB_LOG(GetLog(), "[{0}] {1} is skipped", GetSymbolFileName(),
+ __FUNCTION__);
+ return this->CalculateFrameVariableError(frame);
+ }
+ return m_sym_file_impl->CalculateFrameVariableError(frame);
+}
+
uint32_t SymbolFileOnDemand::ResolveSymbolContext(
const SourceLocationSpec &src_location_spec,
SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
Index: lldb/include/lldb/Symbol/SymbolFileOnDemand.h
===================================================================
--- lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -117,6 +117,9 @@
lldb::SymbolContextItem resolve_scope,
lldb_private::SymbolContext &sc) override;
+ lldb_private::Status
+ CalculateFrameVariableError(lldb_private::StackFrame &frame) override;
+
uint32_t ResolveSymbolContext(
const lldb_private::SourceLocationSpec &src_location_spec,
lldb::SymbolContextItem resolve_scope,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137284.472810.patch
Type: text/x-patch
Size: 3628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221103/4f8e9e45/attachment-0001.bin>
More information about the lldb-commits
mailing list