diff options
Diffstat (limited to 'contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h')
-rw-r--r-- | contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h b/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h index e5d21c1bf4b3..fe0a82306c4f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h @@ -131,7 +131,86 @@ public: bool add_demangled, bool add_mangled, NameToIndexMap &name_to_index_map) const; - ObjectFile *GetObjectFile() { return m_objfile; } + ObjectFile *GetObjectFile() const { return m_objfile; } + + /// Decode a serialized version of this object from data. + /// + /// \param data + /// The decoder object that references the serialized data. + /// + /// \param offset_ptr + /// A pointer that contains the offset from which the data will be decoded + /// from that gets updated as data gets decoded. + /// + /// \param[out] uuid_mismatch + /// Set to true if a cache file exists but the UUID didn't match, false + /// otherwise. + /// + /// \return + /// True if the symbol table is successfully decoded and can be used, + /// false otherwise. + bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr, + bool &uuid_mismatch); + + /// Encode this object into a data encoder object. + /// + /// This allows this object to be serialized to disk. The object file must + /// have a valid Signature in order to be serialized as it is used to make + /// sure the cached information matches when cached data is loaded at a later + /// time. If the object file doesn't have a valid signature false will be + /// returned and it will indicate we should not cache this data. + /// + /// \param encoder + /// A data encoder object that serialized bytes will be encoded into. + /// + /// \return + /// True if the symbol table's object file can generate a valid signature + /// and all data for the symbol table was encoded, false otherwise. + bool Encode(DataEncoder &encoder) const; + + /// Get the cache key string for this symbol table. + /// + /// The cache key must start with the module's cache key and is followed + /// by information that indicates this key is for caching the symbol table + /// contents and should also include the has of the object file. A module can + /// be represented by an ObjectFile object for the main executable, but can + /// also have a symbol file that is from the same or a different object file. + /// This means we might have two symbol tables cached in the index cache, one + /// for the main executable and one for the symbol file. + /// + /// \return + /// The unique cache key used to save and retrieve data from the index cache. + std::string GetCacheKey(); + + /// Save the symbol table data out into a cache. + /// + /// The symbol table will only be saved to a cache file if caching is enabled. + /// + /// We cache the contents of the symbol table since symbol tables in LLDB take + /// some time to initialize. This is due to the many sources for data that are + /// used to create a symbol table: + /// - standard symbol table + /// - dynamic symbol table (ELF) + /// - compressed debug info sections + /// - unwind information + /// - function pointers found in runtimes for global constructor/destructors + /// - other sources. + /// All of the above sources are combined and one symbol table results after + /// all sources have been considered. + void SaveToCache(); + + /// Load the symbol table from the index cache. + /// + /// Quickly load the finalized symbol table from the index cache. This saves + /// time when the debugger starts up. The index cache file for the symbol + /// table has the modification time set to the same time as the main module. + /// If the cache file exists and the modification times match, we will load + /// the symbol table from the serlized cache file. + /// + /// \return + /// True if the symbol table was successfully loaded from the index cache, + /// false if the symbol table wasn't cached or was out of date. + bool LoadFromCache(); protected: typedef std::vector<Symbol> collection; |