diff options
author | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-01 19:45:50 +0000 |
---|---|---|
committer | Michael Sartain <mikesart@valvesoftware.com> | 2013-07-01 19:45:50 +0000 |
commit | a807ceef5dad2b24e5bae5c5a193ff03aa7ec8d9 (patch) | |
tree | aa3f570408644ec1d5284a9bfea38431d982b3ab /include | |
parent | b54b7dc48289727220869d25eb6f4362bf3169ec (diff) | |
download | lldb-a807ceef5dad2b24e5bae5c5a193ff03aa7ec8d9.tar.gz |
Split symbol support for ELF and Linux.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185366 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/lldb/Core/Module.h | 19 | ||||
-rw-r--r-- | include/lldb/Core/Section.h | 32 | ||||
-rw-r--r-- | include/lldb/Core/UUID.h | 2 | ||||
-rw-r--r-- | include/lldb/Symbol/ObjectFile.h | 49 | ||||
-rw-r--r-- | include/lldb/Symbol/SymbolVendor.h | 10 | ||||
-rw-r--r-- | include/lldb/Target/Target.h | 6 | ||||
-rw-r--r-- | include/lldb/lldb-enumerations.h | 4 |
7 files changed, 115 insertions, 7 deletions
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 79da79718..7561f2b00 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -45,7 +45,7 @@ class Module : public SymbolContextScope { public: - // Static functions that can track the lifetime of moodule objects. + // Static functions that can track the lifetime of module objects. // This is handy because we might have Module objects that are in // shared pointers that aren't in the global module list (from // ModuleList). If this is the case we need to know about it. @@ -638,7 +638,21 @@ public: //------------------------------------------------------------------ virtual ObjectFile * GetObjectFile (); - + + //------------------------------------------------------------------ + /// Get the unified section list for the module. This is the section + /// list created by the module's object file and any debug info and + /// symbol files created by the symbol vendor. + /// + /// If the symbol vendor has not been loaded yet, this function + /// will return the section list for the object file. + /// + /// @return + /// Unified module section list. + //------------------------------------------------------------------ + virtual SectionList * + GetUnifiedSectionList (); + uint32_t GetVersion (uint32_t *versions, uint32_t num_versions); @@ -986,6 +1000,7 @@ protected: std::unique_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module. ClangASTContext m_ast; ///< The AST context for this module. PathMappingList m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are + std::unique_ptr<lldb_private::SectionList> m_unified_sections_ap; ///< Unified section list for module. bool m_did_load_objfile:1, m_did_load_symbol_vendor:1, diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h index a8747aeff..0eb6b48c2 100644 --- a/include/lldb/Core/Section.h +++ b/include/lldb/Core/Section.h @@ -18,6 +18,7 @@ #include "lldb/Core/RangeMap.h" #include "lldb/Core/UserID.h" #include "lldb/Core/VMRange.h" +#include "lldb/Symbol/ObjectFile.h" #include <limits.h> namespace lldb_private { @@ -33,6 +34,9 @@ public: ~SectionList(); + bool + Copy (SectionList* dest_section_list); + size_t AddSection (const lldb::SectionSP& section_sp); @@ -77,6 +81,10 @@ public: bool ReplaceSection (lldb::user_id_t sect_id, const lldb::SectionSP& section_sp, uint32_t depth = UINT32_MAX); + // Warning, this can be slow as it's removing items from a std::vector. + bool + DeleteSection (size_t idx); + lldb::SectionSP GetSectionAtIndex (size_t idx) const; @@ -87,6 +95,13 @@ public: void Finalize (); + // Each time Finalize() is called with changes, revision id increments. + uint32_t + GetRevisionID() const + { + return m_revision_id; + } + void Clear () { @@ -94,6 +109,8 @@ public: } protected: + bool m_changed; + uint32_t m_revision_id; collection m_sections; }; @@ -107,6 +124,7 @@ class Section : public: // Create a root section (one that has no parent) Section (const lldb::ModuleSP &module_sp, + ObjectFile *obj_file, lldb::user_id_t sect_id, const ConstString &name, lldb::SectionType sect_type, @@ -119,6 +137,7 @@ public: // Create a section that is a child of parent_section_sp Section (const lldb::SectionSP &parent_section_sp, // NULL for top level sections, non-NULL for child sections const lldb::ModuleSP &module_sp, + ObjectFile *obj_file, lldb::user_id_t sect_id, const ConstString &name, lldb::SectionType sect_type, @@ -271,8 +290,21 @@ public: m_children.Finalize(); } + ObjectFile * + GetObjectFile () + { + return m_obj_file; + } + const ObjectFile * + GetObjectFile () const + { + return m_obj_file; + } + + protected: + ObjectFile *m_obj_file; // The object file that data for this section should be read from lldb::SectionType m_type; // The type of this section lldb::SectionWP m_parent_wp; // Weak pointer to parent section ConstString m_name; // Name of this section diff --git a/include/lldb/Core/UUID.h b/include/lldb/Core/UUID.h index 86ba099e2..8a1a173ac 100644 --- a/include/lldb/Core/UUID.h +++ b/include/lldb/Core/UUID.h @@ -56,7 +56,7 @@ public: SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes = 16); std::string - GetAsString () const; + GetAsString (const char *separator = NULL) const; size_t SetFromCString (const char *c_str, uint32_t num_uuid_bytes = 16); diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h index c8f3cd525..92a530df2 100644 --- a/include/lldb/Symbol/ObjectFile.h +++ b/include/lldb/Symbol/ObjectFile.h @@ -13,6 +13,7 @@ #include "lldb/lldb-private.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Core/FileSpecList.h" #include "lldb/Core/ModuleChild.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Host/Endian.h" @@ -78,7 +79,12 @@ public: eStrataKernel, eStrataRawImage } Strata; - + + typedef enum + { + eSymtabFromUnifiedSectionList = 0x0001 /// Return symbol table from unified module section list + } SymtabFlags; + //------------------------------------------------------------------ /// Construct with a parent module, offset, and header data. /// @@ -356,22 +362,30 @@ public: /// Symbol table parsing can be deferred by ObjectFile instances /// until this accessor is called the first time. /// + /// @param[in] flags + /// eSymtabFromUnifiedSectionList: Whether to get symbol table + /// for unified module section list, or object file. + /// /// @return /// The symbol table for this object file. //------------------------------------------------------------------ virtual Symtab * - GetSymtab () = 0; + GetSymtab (uint32_t flags = 0) = 0; //------------------------------------------------------------------ /// Frees the symbol table. /// /// This function should only be used when an object file is /// + /// @param[in] flags + /// eSymtabFromUnifiedSectionList: Whether to clear symbol table + /// for unified module section list, or object file. + /// /// @return /// The symbol table for this object file. //------------------------------------------------------------------ virtual void - ClearSymtab (); + ClearSymtab (uint32_t flags = 0); //------------------------------------------------------------------ /// Gets the UUID for this object file. @@ -389,6 +403,21 @@ public: GetUUID (lldb_private::UUID* uuid) = 0; //------------------------------------------------------------------ + /// Gets the symbol file spec list for this object file. + /// + /// If the object file format contains a debug symbol file link, + /// the values will be return in the FileSpecList. + /// + /// @return + /// Returns filespeclist. + //------------------------------------------------------------------ + virtual lldb_private::FileSpecList + GetDebugSymbolFilePaths() + { + return FileSpecList(); + } + + //------------------------------------------------------------------ /// Gets whether endian swapping should occur when extracting data /// from this object file. /// @@ -485,6 +514,7 @@ public: { return lldb::RegisterContextSP(); } + //------------------------------------------------------------------ /// The object file should be able to calculate its type by looking /// at its file header and possibly the sections or other data in @@ -501,6 +531,17 @@ public: CalculateType() = 0; //------------------------------------------------------------------ + /// In cases where the type can't be calculated (elf files), this + /// routine allows someone to explicitly set it. As an example, + /// SymbolVendorELF uses this routine to set eTypeDebugInfo when + /// loading debug link files. + virtual void + SetType (Type type) + { + m_type = type; + } + + //------------------------------------------------------------------ /// The object file should be able to calculate the strata of the /// object file. /// @@ -635,6 +676,8 @@ protected: const lldb::addr_t m_memory_addr; std::unique_ptr<lldb_private::SectionList> m_sections_ap; std::unique_ptr<lldb_private::Symtab> m_symtab_ap; + std::unique_ptr<lldb_private::Symtab> m_symtab_unified_ap; ///< Unified section list symbol table. + uint32_t m_symtab_unified_revisionid; ///< Unified section list symbol table revision id for when m_symtab_unified_ap was last modified. //------------------------------------------------------------------ /// Sets the architecture for a module. At present the architecture diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h index 212fceb8f..0ca2c0e9c 100644 --- a/include/lldb/Symbol/SymbolVendor.h +++ b/include/lldb/Symbol/SymbolVendor.h @@ -164,6 +164,14 @@ public: return m_sym_file_ap.get(); } + // Get module unified section list symbol table. + virtual Symtab * + GetSymtab (); + + // Clear module unified section list symbol table. + virtual void + ClearSymtab (); + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ @@ -184,7 +192,7 @@ protected: TypeList m_type_list; // Uniqued types for all parsers owned by this module CompileUnits m_compile_units; // The current compile units lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in case it isn't the same as the module object file (debug symbols in a separate file) - std::unique_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Suclasses can add more of these if needed. + std::unique_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Subclasses can add more of these if needed. private: //------------------------------------------------------------------ diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h index 908c7b544..33effa1a1 100644 --- a/include/lldb/Target/Target.h +++ b/include/lldb/Target/Target.h @@ -118,6 +118,9 @@ public: FileSpecList & GetExecutableSearchPaths (); + + FileSpecList & + GetDebugFileSearchPaths (); bool GetEnableSyntheticValue () const; @@ -378,6 +381,9 @@ public: static FileSpecList GetDefaultExecutableSearchPaths (); + static FileSpecList + GetDefaultDebugFileSearchPaths (); + static ArchSpec GetDefaultArchitecture (); diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h index 3b3ff087b..6ec5ed6a3 100644 --- a/include/lldb/lldb-enumerations.h +++ b/include/lldb/lldb-enumerations.h @@ -515,6 +515,10 @@ namespace lldb { eSectionTypeDWARFAppleTypes, eSectionTypeDWARFAppleNamespaces, eSectionTypeDWARFAppleObjC, + eSectionTypeELFSymbolTable, // Elf SHT_SYMTAB section + eSectionTypeELFDynamicSymbols, // Elf SHT_DYNSYM section + eSectionTypeELFRelocationEntries, // Elf SHT_REL or SHT_REL section + eSectionTypeELFDynamicLinkInfo, // Elf SHT_DYNAMIC section eSectionTypeEHFrame, eSectionTypeOther |