LLDB mainline
GDBRemoteCommunicationServerCommon.h
Go to the documentation of this file.
1//===-- GDBRemoteCommunicationServerCommon.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
9#ifndef LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERCOMMON_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERCOMMON_H
11
12#include <string>
13
16
18
20
21namespace lldb_private {
22namespace process_gdb_remote {
23
25
27public:
29
31
32protected:
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
111
112 static void CreateProcessInfoResponse(const ProcessInstanceInfo &proc_info,
113 StreamString &response);
114
116 const ProcessInstanceInfo &proc_info, StreamString &response);
117
118 template <typename T>
121 PacketResult (T::*handler)(StringExtractorGDBRemote &packet)) {
122 RegisterPacketHandler(packet_type,
123 [this, handler](StringExtractorGDBRemote packet,
124 Status &error, bool &interrupt,
125 bool &quit) {
126 return (static_cast<T *>(this)->*handler)(packet);
127 });
128 }
129
130 /// Launch a process with the current launch settings.
131 ///
132 /// This method supports running an lldb-gdbserver or similar
133 /// server in a situation where the startup code has been provided
134 /// with all the information for a child process to be launched.
135 ///
136 /// \return
137 /// An Status object indicating the success or failure of the
138 /// launch.
139 virtual Status LaunchProcess() = 0;
140
141 virtual FileSpec FindModuleFile(const std::string &module_path,
142 const ArchSpec &arch);
143
144 // Process client_features (qSupported) and return an array of server features
145 // to be returned in response.
146 virtual std::vector<std::string>
147 HandleFeatures(llvm::ArrayRef<llvm::StringRef> client_features);
148
149private:
150 ModuleSpec GetModuleInfo(llvm::StringRef module_path, llvm::StringRef triple);
151};
152
153} // namespace process_gdb_remote
154} // namespace lldb_private
155
156#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERCOMMON_H
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition ArchSpec.h:32
A file utility class.
Definition FileSpec.h:57
An error handling class.
Definition Status.h:118
virtual Status LaunchProcess()=0
Launch a process with the current launch settings.
ModuleSpec GetModuleInfo(llvm::StringRef module_path, llvm::StringRef triple)
virtual FileSpec FindModuleFile(const std::string &module_path, const ArchSpec &arch)
void RegisterMemberFunctionHandler(StringExtractorGDBRemote::ServerPacketType packet_type, PacketResult(T::*handler)(StringExtractorGDBRemote &packet))
static void CreateProcessInfoResponse_DebugServerStyle(const ProcessInstanceInfo &proc_info, StreamString &response)
virtual std::vector< std::string > HandleFeatures(llvm::ArrayRef< llvm::StringRef > client_features)
static void CreateProcessInfoResponse(const ProcessInstanceInfo &proc_info, StreamString &response)
void RegisterPacketHandler(StringExtractorGDBRemote::ServerPacketType packet_type, PacketHandler handler)
A class that represents a running process on the host machine.
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition Host.h:32