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
24class ProcessGDBRemote;
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
110 static void CreateProcessInfoResponse(const ProcessInstanceInfo &proc_info,
111 StreamString &response);
112
114 const ProcessInstanceInfo &proc_info, StreamString &response);
115
116 template <typename T>
119 PacketResult (T::*handler)(StringExtractorGDBRemote &packet)) {
120 RegisterPacketHandler(packet_type,
121 [this, handler](StringExtractorGDBRemote packet,
122 Status &error, bool &interrupt,
123 bool &quit) {
124 return (static_cast<T *>(this)->*handler)(packet);
125 });
126 }
127
128 /// Launch a process with the current launch settings.
129 ///
130 /// This method supports running an lldb-gdbserver or similar
131 /// server in a situation where the startup code has been provided
132 /// with all the information for a child process to be launched.
133 ///
134 /// \return
135 /// An Status object indicating the success or failure of the
136 /// launch.
137 virtual Status LaunchProcess() = 0;
138
139 virtual FileSpec FindModuleFile(const std::string &module_path,
140 const ArchSpec &arch);
141
142 // Process client_features (qSupported) and return an array of server features
143 // to be returned in response.
144 virtual std::vector<std::string>
145 HandleFeatures(llvm::ArrayRef<llvm::StringRef> client_features);
146
147private:
148 ModuleSpec GetModuleInfo(llvm::StringRef module_path, llvm::StringRef triple);
149};
150
151} // namespace process_gdb_remote
152} // namespace lldb_private
153
154#endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONSERVERCOMMON_H
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition: ArchSpec.h:31
A file utility class.
Definition: FileSpec.h:56
An error handling class.
Definition: Status.h:44
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