Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Protocol/MCP/Resource.h
213845 views
1
//===----------------------------------------------------------------------===//
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
9
#ifndef LLDB_PLUGINS_PROTOCOL_MCP_RESOURCE_H
10
#define LLDB_PLUGINS_PROTOCOL_MCP_RESOURCE_H
11
12
#include "Protocol.h"
13
#include "lldb/lldb-private.h"
14
#include <vector>
15
16
namespace lldb_private::mcp {
17
18
class ResourceProvider {
19
public:
20
ResourceProvider() = default;
21
virtual ~ResourceProvider() = default;
22
23
virtual std::vector<protocol::Resource> GetResources() const = 0;
24
virtual llvm::Expected<protocol::ResourceResult>
25
ReadResource(llvm::StringRef uri) const = 0;
26
};
27
28
class DebuggerResourceProvider : public ResourceProvider {
29
public:
30
using ResourceProvider::ResourceProvider;
31
virtual ~DebuggerResourceProvider() = default;
32
33
virtual std::vector<protocol::Resource> GetResources() const override;
34
virtual llvm::Expected<protocol::ResourceResult>
35
ReadResource(llvm::StringRef uri) const override;
36
37
private:
38
static protocol::Resource GetDebuggerResource(Debugger &debugger);
39
static protocol::Resource GetTargetResource(size_t target_idx,
40
Target &target);
41
42
static llvm::Expected<protocol::ResourceResult>
43
ReadDebuggerResource(llvm::StringRef uri, lldb::user_id_t debugger_id);
44
static llvm::Expected<protocol::ResourceResult>
45
ReadTargetResource(llvm::StringRef uri, lldb::user_id_t debugger_id,
46
size_t target_idx);
47
};
48
49
} // namespace lldb_private::mcp
50
51
#endif
52
53