Skip to content

Commit 6b38936

Browse files
authored
Check for null oso SymbolFile in SymbolFileDwarfDebugMap::ResolveSymbolContext (#89324)
The couple other places that use the oso module's SymbolFile, they check that it's non-null, so this is just an oversight in ResolveSymbolContext. I didn't add a test for this (but did add a log message for the error case) because I can't see how this would actually happen. The .o file had to have valid enough DWARF that the linker's parser could handle it or it would not be in the debug map. If you delete the .o file, we just leave that entry out of the debug map. If you strip it or otherwise mess with it, we'll notice the changed mod time and refuse to read it... This was based on a report from the field, and we don't have access to the project. But if the logging tells me how this happened I can come back and add a test with that example.
1 parent ab0b865 commit 6b38936

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,17 @@ SymbolFileDWARFDebugMap::ResolveSymbolContext(const Address &exe_so_addr,
848848
debug_map_entry->data.GetOSOFileAddress();
849849
Address oso_so_addr;
850850
if (oso_module->ResolveFileAddress(oso_file_addr, oso_so_addr)) {
851-
resolved_flags |=
852-
oso_module->GetSymbolFile()->ResolveSymbolContext(
853-
oso_so_addr, resolve_scope, sc);
851+
if (SymbolFile *sym_file = oso_module->GetSymbolFile()) {
852+
resolved_flags |= sym_file->ResolveSymbolContext(
853+
oso_so_addr, resolve_scope, sc);
854+
} else {
855+
ObjectFile *obj_file = GetObjectFile();
856+
LLDB_LOG(GetLog(DWARFLog::DebugMap),
857+
"Failed to get symfile for OSO: {0} in module: {1}",
858+
oso_module->GetFileSpec(),
859+
obj_file ? obj_file->GetFileSpec()
860+
: FileSpec("unknown"));
861+
}
854862
}
855863
}
856864
}

0 commit comments

Comments
 (0)