|
LLDB mainline
|
A signature for a given file on disk. More...
#include <DataFileCache.h>
Public Member Functions | |
| CacheSignature ()=default | |
| CacheSignature (lldb_private::Module *module) | |
| Create a signature from a module. | |
| CacheSignature (lldb_private::ObjectFile *objfile) | |
| Create a signature from an object file. | |
| void | Clear () |
| bool | IsValid () const |
| Return true only if the CacheSignature is valid. | |
| bool | operator== (const CacheSignature &rhs) const |
| Check if two signatures are the same. | |
| bool | operator!= (const CacheSignature &rhs) const |
| Check if two signatures differ. | |
| bool | Encode (DataEncoder &encoder) const |
| Encode this object into a data encoder object. | |
| bool | Decode (const DataExtractor &data, lldb::offset_t *offset_ptr) |
| Decode a serialized version of this object from data. | |
Public Attributes | |
| std::optional< UUID > | m_uuid |
| UUID of object file or module. | |
| std::optional< std::time_t > | m_mod_time |
| Modification time of file on disk. | |
| std::optional< std::time_t > | m_obj_mod_time |
| If this describes a .o file with a BSD archive, the BSD archive's modification time will be in m_mod_time, and the .o file's modification time will be in this m_obj_mod_time. | |
A signature for a given file on disk.
There are two hashes for each file in the LLDB Index Cache. One hash uniquely identifies the binary, incorporating the name/filepath, triple, architecture – things that do not change as the same binary is recompiled with update code. ObjectFile::GetCacheHash() and Module::GetHash() provide these hashes.
The second hash, calculated in this class, is based on the mod date and UUID of the binary and does change on every recompile of the same binary.
The two hashes allow us to identify a file uniquely in the LLDB Index Cache and re-use the cache if the existing entry is a match for both. It also allows us to remove the entry for a previous build of a specific file, and save the new recompiled binary's symbol table in the LLDB Index Cache in its place.
Definition at line 117 of file DataFileCache.h.
|
default |
Referenced by operator!=(), and operator==().
| CacheSignature::CacheSignature | ( | lldb_private::Module * | module | ) |
Create a signature from a module.
Definition at line 176 of file DataFileCache.cpp.
References Clear(), lldb_private::Module::GetModificationTime(), lldb_private::Module::GetObjectModificationTime(), lldb_private::UUID::IsValid(), m_mod_time, m_obj_mod_time, and m_uuid.
| CacheSignature::CacheSignature | ( | lldb_private::ObjectFile * | objfile | ) |
Create a signature from an object file.
Definition at line 192 of file DataFileCache.cpp.
References Clear(), lldb_private::ObjectFile::GetFileSpec(), lldb_private::FileSystem::GetModificationTime(), lldb_private::ModuleChild::GetModule(), lldb_private::ObjectFile::GetUUID(), lldb_private::FileSystem::Instance(), lldb_private::UUID::IsValid(), m_mod_time, m_obj_mod_time, and m_uuid.
|
inline |
Definition at line 135 of file DataFileCache.h.
References m_mod_time, m_obj_mod_time, and m_uuid.
Referenced by CacheSignature(), CacheSignature(), and Decode().
| bool CacheSignature::Decode | ( | const DataExtractor & | data, |
| lldb::offset_t * | offset_ptr ) |
Decode a serialized version of this object from data.
| data | The decoder object that references the serialized data. |
| offset_ptr | A pointer that contains the offset from which the data will be decoded from that gets updated as data gets decoded. |
Definition at line 242 of file DataFileCache.cpp.
References Clear(), eSignatureEnd, eSignatureModTime, eSignatureObjectModTime, eSignatureUUID, lldb_private::DataExtractor::GetData(), lldb_private::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU8(), IsValid(), m_mod_time, m_obj_mod_time, and m_uuid.
Referenced by lldb_private::plugin::dwarf::ManualDWARFIndex::Decode(), and lldb_private::Symtab::Decode().
| bool CacheSignature::Encode | ( | DataEncoder & | encoder | ) | const |
Encode this object into a data encoder object.
This allows this object to be serialized to disk. The CacheSignature object must have at least one member variable that has a value in order to be serialized so that we can match this data to when the cached file is loaded at a later time.
| encoder | A data encoder object that serialized bytes will be encoded into. |
Definition at line 220 of file DataFileCache.cpp.
References lldb_private::DataEncoder::AppendData(), lldb_private::DataEncoder::AppendU32(), lldb_private::DataEncoder::AppendU8(), eSignatureEnd, eSignatureModTime, eSignatureObjectModTime, eSignatureUUID, IsValid(), m_mod_time, m_obj_mod_time, and m_uuid.
Referenced by lldb_private::plugin::dwarf::ManualDWARFIndex::Encode(), and lldb_private::Symtab::Encode().
|
inline |
Return true only if the CacheSignature is valid.
Cache signatures are considered valid only if there is a UUID in the file that can uniquely identify the file. Some build systems play with modification times of file so we can not trust them without using valid unique idenifier like the UUID being valid.
Definition at line 147 of file DataFileCache.h.
References m_uuid.
|
inline |
Check if two signatures differ.
Definition at line 156 of file DataFileCache.h.
References CacheSignature().
|
inline |
Check if two signatures are the same.
Definition at line 150 of file DataFileCache.h.
References CacheSignature(), m_mod_time, m_obj_mod_time, and m_uuid.
| std::optional<std::time_t> lldb_private::CacheSignature::m_mod_time |
Modification time of file on disk.
Definition at line 121 of file DataFileCache.h.
Referenced by CacheSignature(), CacheSignature(), Clear(), Decode(), Encode(), and operator==().
| std::optional<std::time_t> lldb_private::CacheSignature::m_obj_mod_time |
If this describes a .o file with a BSD archive, the BSD archive's modification time will be in m_mod_time, and the .o file's modification time will be in this m_obj_mod_time.
Definition at line 125 of file DataFileCache.h.
Referenced by CacheSignature(), CacheSignature(), Clear(), Decode(), Encode(), and operator==().
| std::optional<UUID> lldb_private::CacheSignature::m_uuid |
UUID of object file or module.
Definition at line 119 of file DataFileCache.h.
Referenced by CacheSignature(), CacheSignature(), Clear(), Decode(), Encode(), IsValid(), and operator==().