lldb: workaround to permit cross-arch core file debugging

FreeBSD core files have no section table and thus LLDB's OS and vendor
detection logic does not work. If we encounter such an ELF file, update
an unknown OS to match the host.

This is not really the correct way to handle this, but more extensive
rework of ObjectFileELF will be needed and this change restores cross-
arch core debugging until that can be completed.
This commit is contained in:
Ed Maste 2015-02-17 18:33:17 +00:00
parent 1d4a49a324
commit b153f37ffc

View File

@ -1331,8 +1331,11 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
}
// If there are no section headers we are done.
if (header.e_shnum == 0)
if (header.e_shnum == 0) {
if (arch_spec.GetTriple().getOS() == llvm::Triple::OSType::UnknownOS)
arch_spec.GetTriple().setOSName(HostInfo::GetOSString().data());
return 0;
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_MODULES));