From b704b69e0bf6db0d0369ee84f7437d231a3fcfe9 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 28 Oct 2015 18:04:38 +0000 Subject: Make core files not crash when you load a core file into LLDB with just "lldb -c core". To do this I added a few new ways to determine the OS from PT_NOTE notes in the ELF file: 1 - Look for "LINUX" notes which indicate "linux" should be the OS 2 - Look through the "CORE" notes with NT_FILE as the type and sniff data from the paths listed in this section. On Ubuntu they contain "/lib/x86_64-linux-gnu" which has the triple and allows us to set "linux" as the OS in the architecture returned from ObjectFileELF::GetArchitecture(). Setting the OS correctly allows us to get the triple correct so we can extract registers without asserting and killing LLDB. Also use the data from the NT_FILE to set the main executable if one isn't set in ProcessElfCore::DoLoadCore(). llvm-svn: 251537 --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h') diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index e6ef5dc1c80..4b97f92c6c5 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -52,6 +52,12 @@ struct ELFNote /// True if the ELFRel entry was successfully read and false otherwise. bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset); + + size_t + GetByteSize() const + { + return 12 + llvm::RoundUpToAlignment (n_namesz, 4) + llvm::RoundUpToAlignment (n_descsz, 4); + } }; //------------------------------------------------------------------------------ -- cgit v1.2.3