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.
Any files that are cached in the LLDB index cached need some data that uniquely identifies a file on disk and this information should be written into each cache file so we can validate if the cache file still matches the file we are trying to load cached data for. Objects can fill out this signature and then encode and decode them to validate the signatures match. If they do not match, the cache file on disk should be removed as it is out of date.
Definition at line 109 of file DataFileCache.h.
|
default |
CacheSignature::CacheSignature | ( | lldb_private::Module * | module | ) |
Create a signature from a module.
Definition at line 166 of file DataFileCache.cpp.
References Clear(), lldb_private::Module::GetModificationTime(), lldb_private::Module::GetObjectModificationTime(), lldb_private::Module::GetUUID(), 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 182 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 127 of file DataFileCache.h.
References m_mod_time, m_obj_mod_time, and m_uuid.
Referenced by 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 232 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 210 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::Symtab::Encode(), and lldb_private::plugin::dwarf::ManualDWARFIndex::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 139 of file DataFileCache.h.
References m_uuid.
|
inline |
Check if two signatures differ.
Definition at line 148 of file DataFileCache.h.
|
inline |
Check if two signatures are the same.
Definition at line 142 of file DataFileCache.h.
References 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 113 of file DataFileCache.h.
Referenced by 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 117 of file DataFileCache.h.
Referenced by CacheSignature(), Clear(), Decode(), Encode(), and operator==().
std::optional<UUID> lldb_private::CacheSignature::m_uuid |
UUID of object file or module.
Definition at line 111 of file DataFileCache.h.
Referenced by CacheSignature(), Clear(), Decode(), Encode(), IsValid(), and operator==().