1 //===-- GDBRemoteCommunicationServerCommon.h --------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_GDBRemoteCommunicationServerCommon_h_
11 #define liblldb_GDBRemoteCommunicationServerCommon_h_
17 // Other libraries and framework includes
19 #include "lldb/lldb-private-forward.h"
20 #include "lldb/Target/Process.h"
22 #include "GDBRemoteCommunicationServer.h"
23 #include "GDBRemoteCommunicationServerCommon.h"
25 class StringExtractorGDBRemote;
27 namespace lldb_private {
28 namespace process_gdb_remote {
30 class ProcessGDBRemote;
32 class GDBRemoteCommunicationServerCommon :
33 public GDBRemoteCommunicationServer
36 GDBRemoteCommunicationServerCommon(const char *comm_name, const char *listener_name);
38 ~GDBRemoteCommunicationServerCommon() override;
41 ProcessLaunchInfo m_process_launch_info;
42 Error m_process_launch_error;
43 ProcessInstanceInfoList m_proc_infos;
44 uint32_t m_proc_infos_index;
45 bool m_thread_suffix_supported;
46 bool m_list_threads_in_stop_reply;
49 Handle_A (StringExtractorGDBRemote &packet);
52 Handle_qHostInfo (StringExtractorGDBRemote &packet);
55 Handle_qProcessInfoPID (StringExtractorGDBRemote &packet);
58 Handle_qfProcessInfo (StringExtractorGDBRemote &packet);
61 Handle_qsProcessInfo (StringExtractorGDBRemote &packet);
64 Handle_qUserName (StringExtractorGDBRemote &packet);
67 Handle_qGroupName (StringExtractorGDBRemote &packet);
70 Handle_qSpeedTest (StringExtractorGDBRemote &packet);
73 Handle_vFile_Open (StringExtractorGDBRemote &packet);
76 Handle_vFile_Close (StringExtractorGDBRemote &packet);
79 Handle_vFile_pRead (StringExtractorGDBRemote &packet);
82 Handle_vFile_pWrite (StringExtractorGDBRemote &packet);
85 Handle_vFile_Size (StringExtractorGDBRemote &packet);
88 Handle_vFile_Mode (StringExtractorGDBRemote &packet);
91 Handle_vFile_Exists (StringExtractorGDBRemote &packet);
94 Handle_vFile_symlink (StringExtractorGDBRemote &packet);
97 Handle_vFile_unlink (StringExtractorGDBRemote &packet);
100 Handle_vFile_Stat (StringExtractorGDBRemote &packet);
103 Handle_vFile_MD5 (StringExtractorGDBRemote &packet);
106 Handle_qEcho (StringExtractorGDBRemote &packet);
109 Handle_qModuleInfo (StringExtractorGDBRemote &packet);
112 Handle_qPlatform_shell (StringExtractorGDBRemote &packet);
115 Handle_qPlatform_mkdir (StringExtractorGDBRemote &packet);
118 Handle_qPlatform_chmod (StringExtractorGDBRemote &packet);
121 Handle_qSupported (StringExtractorGDBRemote &packet);
124 Handle_QThreadSuffixSupported (StringExtractorGDBRemote &packet);
127 Handle_QListThreadsInStopReply (StringExtractorGDBRemote &packet);
130 Handle_QSetDetachOnError (StringExtractorGDBRemote &packet);
133 Handle_QStartNoAckMode (StringExtractorGDBRemote &packet);
136 Handle_QSetSTDIN (StringExtractorGDBRemote &packet);
139 Handle_QSetSTDOUT (StringExtractorGDBRemote &packet);
142 Handle_QSetSTDERR (StringExtractorGDBRemote &packet);
145 Handle_qLaunchSuccess (StringExtractorGDBRemote &packet);
148 Handle_QEnvironment (StringExtractorGDBRemote &packet);
151 Handle_QEnvironmentHexEncoded (StringExtractorGDBRemote &packet);
154 Handle_QLaunchArch (StringExtractorGDBRemote &packet);
157 CreateProcessInfoResponse (const ProcessInstanceInfo &proc_info,
158 StreamString &response);
161 CreateProcessInfoResponse_DebugServerStyle (const ProcessInstanceInfo &proc_info,
162 StreamString &response);
164 template <typename T>
166 RegisterMemberFunctionHandler (StringExtractorGDBRemote::ServerPacketType packet_type,
167 PacketResult (T::*handler) (StringExtractorGDBRemote& packet))
169 RegisterPacketHandler(packet_type,
170 [this, handler] (StringExtractorGDBRemote packet,
175 return (static_cast<T*>(this)->*handler) (packet);
180 GetThreadSuffixSupported () override
185 //------------------------------------------------------------------
186 /// Launch a process with the current launch settings.
188 /// This method supports running an lldb-gdbserver or similar
189 /// server in a situation where the startup code has been provided
190 /// with all the information for a child process to be launched.
193 /// An Error object indicating the success or failure of the
195 //------------------------------------------------------------------
197 LaunchProcess () = 0;
200 FindModuleFile (const std::string& module_path, const ArchSpec& arch);
203 } // namespace process_gdb_remote
204 } // namespace lldb_private
206 #endif // liblldb_GDBRemoteCommunicationServerCommon_h_