#include "lldb/Target/ModuleCache.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/File.h"
#include "lldb/Host/LockFile.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FileUtilities.h"
#include <cassert>
#include <cstdio>
usingnamespacelldb;
usingnamespacelldb_private;
namespace {
const char *kModulesSubdir = …;
const char *kLockDirName = …;
const char *kTempFileName = …;
const char *kTempSymFileName = …;
const char *kSymFileExtension = …;
const char *kFSIllegalChars = …;
std::string GetEscapedHostname(const char *hostname) { … }
class ModuleLock { … };
static FileSpec JoinPath(const FileSpec &path1, const char *path2) { … }
static Status MakeDirectory(const FileSpec &dir_path) { … }
FileSpec GetModuleDirectory(const FileSpec &root_dir_spec, const UUID &uuid) { … }
FileSpec GetSymbolFileSpec(const FileSpec &module_file_spec) { … }
void DeleteExistingModule(const FileSpec &root_dir_spec,
const FileSpec &sysroot_module_path_spec) { … }
void DecrementRefExistingModule(const FileSpec &root_dir_spec,
const FileSpec &sysroot_module_path_spec) { … }
Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec,
const char *hostname,
const FileSpec &platform_module_spec,
const FileSpec &local_module_spec,
bool delete_existing) { … }
}
ModuleLock::ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid,
Status &error) { … }
void ModuleLock::Delete() { … }
Status ModuleCache::Put(const FileSpec &root_dir_spec, const char *hostname,
const ModuleSpec &module_spec, const FileSpec &tmp_file,
const FileSpec &target_file) { … }
Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname,
const ModuleSpec &module_spec,
ModuleSP &cached_module_sp, bool *did_create_ptr) { … }
Status ModuleCache::GetAndPut(const FileSpec &root_dir_spec,
const char *hostname,
const ModuleSpec &module_spec,
const ModuleDownloader &module_downloader,
const SymfileDownloader &symfile_downloader,
lldb::ModuleSP &cached_module_sp,
bool *did_create_ptr) { … }