LLDB mainline
FileCache.h
Go to the documentation of this file.
1//===-- FileCache.h ---------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8#ifndef LLDB_HOST_FILECACHE_H
9#define LLDB_HOST_FILECACHE_H
10
11#include <cstdint>
12#include <map>
13
14#include "lldb/lldb-forward.h"
15#include "lldb/lldb-types.h"
16
17#include "lldb/Host/File.h"
19#include "lldb/Utility/Status.h"
20
21namespace lldb_private {
22class FileCache {
23private:
24 FileCache() = default;
25
26 typedef std::map<lldb::user_id_t, lldb::FileUP> FDToFileMap;
27
28public:
29 static FileCache &GetInstance();
30
31 lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
32 uint32_t mode, Status &error);
34
35 uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
36 uint64_t src_len, Status &error);
37 uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
38 uint64_t dst_len, Status &error);
39
40private:
42
44};
45}
46
47#endif
static llvm::raw_ostream & error(Stream &strm)
bool CloseFile(lldb::user_id_t fd, Status &error)
Definition: FileCache.cpp:43
uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Status &error)
Definition: FileCache.cpp:92
lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, Status &error)
Definition: FileCache.cpp:26
FDToFileMap m_cache
Definition: FileCache.h:43
std::map< lldb::user_id_t, lldb::FileUP > FDToFileMap
Definition: FileCache.h:26
uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Status &error)
Definition: FileCache.cpp:64
static FileCache * m_instance
Definition: FileCache.h:41
static FileCache & GetInstance()
Definition: FileCache.cpp:19
A file utility class.
Definition: FileSpec.h:56
An error handling class.
Definition: Status.h:115
A class that represents a running process on the host machine.
uint64_t user_id_t
Definition: lldb-types.h:82