Split symbol support for ELF and Linux.
llvm-svn: 185366
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index f1fea3c..a6e3cbb 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -100,7 +100,7 @@
GetAddressByteSize() const;
virtual lldb_private::Symtab *
- GetSymtab();
+ GetSymtab(uint32_t flags = 0);
virtual lldb_private::SectionList *
GetSectionList();
@@ -114,6 +114,9 @@
virtual bool
GetUUID(lldb_private::UUID* uuid);
+ virtual lldb_private::FileSpecList
+ GetDebugSymbolFilePaths();
+
virtual uint32_t
GetDependentModules(lldb_private::FileSpecList& files);
@@ -141,7 +144,11 @@
typedef ProgramHeaderColl::iterator ProgramHeaderCollIter;
typedef ProgramHeaderColl::const_iterator ProgramHeaderCollConstIter;
- typedef std::vector<elf::ELFSectionHeader> SectionHeaderColl;
+ struct ELFSectionHeaderInfo : public elf::ELFSectionHeader
+ {
+ lldb_private::ConstString section_name;
+ };
+ typedef std::vector<ELFSectionHeaderInfo> SectionHeaderColl;
typedef SectionHeaderColl::iterator SectionHeaderCollIter;
typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
@@ -155,9 +162,13 @@
/// ELF file header.
elf::ELFHeader m_header;
- /// ELF build ID
+ /// ELF build ID.
lldb_private::UUID m_uuid;
+ /// ELF .gnu_debuglink file and crc data if available.
+ std::string m_gnu_debuglink_file;
+ uint32_t m_gnu_debuglink_crc;
+
/// Collection of program headers.
ProgramHeaderColl m_program_headers;
@@ -171,9 +182,6 @@
/// libraries) on which this object file depends.
mutable std::unique_ptr<lldb_private::FileSpecList> m_filespec_ap;
- /// Data extractor holding the string table used to resolve section names.
- lldb_private::DataExtractor m_shstr_data;
-
/// Cached value of the entry point for this module.
lldb_private::Address m_entry_point_address;
@@ -197,6 +205,15 @@
size_t
ParseSectionHeaders();
+ /// Parses the elf section headers and returns the uuid, debug link name, crc.
+ static size_t
+ GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
+ lldb_private::DataExtractor &data,
+ const elf::ELFHeader &header,
+ lldb_private::UUID &uuid,
+ std::string &gnu_debuglink_file,
+ uint32_t &gnu_debuglink_crc);
+
/// Scans the dynamic section and locates all dependent modules (shared
/// libraries) populating m_filespec_ap. This method will compute the
/// dependent module list only once. Returns the number of dependent
@@ -215,23 +232,26 @@
unsigned
ParseSymbolTable(lldb_private::Symtab *symbol_table,
lldb::user_id_t start_id,
- const elf::ELFSectionHeader *symtab_section,
lldb::user_id_t symtab_id);
+ /// Helper routine for ParseSymbolTable().
+ unsigned
+ ParseSymbols(lldb_private::Symtab *symbol_table,
+ lldb::user_id_t start_id,
+ lldb_private::SectionList *section_list,
+ const ELFSectionHeaderInfo *symtab_shdr,
+ const lldb_private::DataExtractor &symtab_data,
+ const lldb_private::DataExtractor &strtab_data);
+
/// Scans the relocation entries and adds a set of artificial symbols to the
/// given symbol table for each PLT slot. Returns the number of symbols
/// added.
unsigned
ParseTrampolineSymbols(lldb_private::Symtab *symbol_table,
lldb::user_id_t start_id,
- const elf::ELFSectionHeader *rela_hdr,
+ const ELFSectionHeaderInfo *rela_hdr,
lldb::user_id_t section_id);
- /// Loads the section name string table into m_shstr_data. Returns the
- /// number of bytes constituting the table.
- size_t
- GetSectionHeaderStringTable();
-
/// Utility method for looking up a section given its name. Returns the
/// index of the corresponding section or zero if no section with the given
/// name can be found (note that section indices are always 1 based, and so
@@ -244,7 +264,7 @@
GetSectionIndexByType(unsigned type);
/// Returns the section header with the given id or NULL.
- const elf::ELFSectionHeader *
+ const ELFSectionHeaderInfo *
GetSectionHeaderByIndex(lldb::user_id_t id);
/// @name ELF header dump routines
@@ -284,7 +304,7 @@
static void
DumpELFSectionHeader(lldb_private::Stream *s,
- const elf::ELFSectionHeader& sh);
+ const ELFSectionHeaderInfo& sh);
static void
DumpELFSectionHeader_sh_type(lldb_private::Stream *s,
@@ -302,9 +322,6 @@
const elf::ELFDynamic *
FindDynamicSymbol(unsigned tag);
- lldb_private::Section *
- PLTSection();
-
unsigned
PLTRelocationType();
};