1 //===-- GDBRemoteCommunicationClient.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_GDBREMOTECOMMUNICATIONCLIENT_H
10 #define LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONCLIENT_H
11 
12 #include "GDBRemoteClientBase.h"
13 
14 #include <chrono>
15 #include <map>
16 #include <mutex>
17 #include <string>
18 #include <vector>
19 
20 #include "lldb/Host/File.h"
21 #include "lldb/Utility/ArchSpec.h"
22 #include "lldb/Utility/GDBRemote.h"
23 #include "lldb/Utility/ProcessInfo.h"
24 #include "lldb/Utility/StructuredData.h"
25 #include "lldb/Utility/TraceGDBRemotePackets.h"
26 #if defined(_WIN32)
27 #include "lldb/Host/windows/PosixApi.h"
28 #endif
29 
30 #include "llvm/ADT/Optional.h"
31 #include "llvm/Support/VersionTuple.h"
32 
33 namespace lldb_private {
34 namespace process_gdb_remote {
35 
36 /// The offsets used by the target when relocating the executable. Decoded from
37 /// qOffsets packet response.
38 struct QOffsets {
39   /// If true, the offsets field describes segments. Otherwise, it describes
40   /// sections.
41   bool segments;
42 
43   /// The individual offsets. Section offsets have two or three members.
44   /// Segment offsets have either one of two.
45   std::vector<uint64_t> offsets;
46 };
47 inline bool operator==(const QOffsets &a, const QOffsets &b) {
48   return a.segments == b.segments && a.offsets == b.offsets;
49 }
50 llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const QOffsets &offsets);
51 
52 class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
53 public:
54   GDBRemoteCommunicationClient();
55 
56   ~GDBRemoteCommunicationClient() override;
57 
58   // After connecting, send the handshake to the server to make sure
59   // we are communicating with it.
60   bool HandshakeWithServer(Status *error_ptr);
61 
62   // For packets which specify a range of output to be returned,
63   // return all of the output via a series of request packets of the form
64   // <prefix>0,<size>
65   // <prefix><size>,<size>
66   // <prefix><size>*2,<size>
67   // <prefix><size>*3,<size>
68   // ...
69   // until a "$l..." packet is received, indicating the end.
70   // (size is in hex; this format is used by a standard gdbserver to
71   // return the given portion of the output specified by <prefix>;
72   // for example, "qXfer:libraries-svr4:read::fff,1000" means
73   // "return a chunk of the xml description file for shared
74   // library load addresses, where the chunk starts at offset 0xfff
75   // and continues for 0x1000 bytes").
76   // Concatenate the resulting server response packets together and
77   // return in response_string.  If any packet fails, the return value
78   // indicates that failure and the returned string value is undefined.
79   PacketResult
80   SendPacketsAndConcatenateResponses(const char *send_payload_prefix,
81                                      std::string &response_string);
82 
83   bool GetThreadSuffixSupported();
84 
85   // This packet is usually sent first and the boolean return value
86   // indicates if the packet was send and any response was received
87   // even in the response is UNIMPLEMENTED. If the packet failed to
88   // get a response, then false is returned. This quickly tells us
89   // if we were able to connect and communicate with the remote GDB
90   // server
91   bool QueryNoAckModeSupported();
92 
93   void GetListThreadsInStopReplySupported();
94 
95   lldb::pid_t GetCurrentProcessID(bool allow_lazy = true);
96 
97   bool GetLaunchSuccess(std::string &error_str);
98 
99   bool LaunchGDBServer(const char *remote_accept_hostname, lldb::pid_t &pid,
100                        uint16_t &port, std::string &socket_name);
101 
102   size_t QueryGDBServer(
103       std::vector<std::pair<uint16_t, std::string>> &connection_urls);
104 
105   bool KillSpawnedProcess(lldb::pid_t pid);
106 
107   /// Sends a GDB remote protocol 'A' packet that delivers program
108   /// arguments to the remote server.
109   ///
110   /// \param[in] launch_info
111   ///     A NULL terminated array of const C strings to use as the
112   ///     arguments.
113   ///
114   /// \return
115   ///     Zero if the response was "OK", a positive value if the
116   ///     the response was "Exx" where xx are two hex digits, or
117   ///     -1 if the call is unsupported or any other unexpected
118   ///     response was received.
119   int SendArgumentsPacket(const ProcessLaunchInfo &launch_info);
120 
121   /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
122   /// environment that will get used when launching an application
123   /// in conjunction with the 'A' packet. This function can be called
124   /// multiple times in a row in order to pass on the desired
125   /// environment that the inferior should be launched with.
126   ///
127   /// \param[in] name_equal_value
128   ///     A NULL terminated C string that contains a single environment
129   ///     in the format "NAME=VALUE".
130   ///
131   /// \return
132   ///     Zero if the response was "OK", a positive value if the
133   ///     the response was "Exx" where xx are two hex digits, or
134   ///     -1 if the call is unsupported or any other unexpected
135   ///     response was received.
136   int SendEnvironmentPacket(char const *name_equal_value);
137   int SendEnvironment(const Environment &env);
138 
139   int SendLaunchArchPacket(const char *arch);
140 
141   int SendLaunchEventDataPacket(const char *data,
142                                 bool *was_supported = nullptr);
143 
144   /// Sends a "vAttach:PID" where PID is in hex.
145   ///
146   /// \param[in] pid
147   ///     A process ID for the remote gdb server to attach to.
148   ///
149   /// \param[out] response
150   ///     The response received from the gdb server. If the return
151   ///     value is zero, \a response will contain a stop reply
152   ///     packet.
153   ///
154   /// \return
155   ///     Zero if the attach was successful, or an error indicating
156   ///     an error code.
157   int SendAttach(lldb::pid_t pid, StringExtractorGDBRemote &response);
158 
159   /// Sends a GDB remote protocol 'I' packet that delivers stdin
160   /// data to the remote process.
161   ///
162   /// \param[in] data
163   ///     A pointer to stdin data.
164   ///
165   /// \param[in] data_len
166   ///     The number of bytes available at \a data.
167   ///
168   /// \return
169   ///     Zero if the attach was successful, or an error indicating
170   ///     an error code.
171   int SendStdinNotification(const char *data, size_t data_len);
172 
173   /// Sets the path to use for stdin/out/err for a process
174   /// that will be launched with the 'A' packet.
175   ///
176   /// \param[in] file_spec
177   ///     The path to use for stdin/out/err
178   ///
179   /// \return
180   ///     Zero if the for success, or an error code for failure.
181   int SetSTDIN(const FileSpec &file_spec);
182   int SetSTDOUT(const FileSpec &file_spec);
183   int SetSTDERR(const FileSpec &file_spec);
184 
185   /// Sets the disable ASLR flag to \a enable for a process that will
186   /// be launched with the 'A' packet.
187   ///
188   /// \param[in] enable
189   ///     A boolean value indicating whether to disable ASLR or not.
190   ///
191   /// \return
192   ///     Zero if the for success, or an error code for failure.
193   int SetDisableASLR(bool enable);
194 
195   /// Sets the DetachOnError flag to \a enable for the process controlled by the
196   /// stub.
197   ///
198   /// \param[in] enable
199   ///     A boolean value indicating whether to detach on error or not.
200   ///
201   /// \return
202   ///     Zero if the for success, or an error code for failure.
203   int SetDetachOnError(bool enable);
204 
205   /// Sets the working directory to \a path for a process that will
206   /// be launched with the 'A' packet for non platform based
207   /// connections. If this packet is sent to a GDB server that
208   /// implements the platform, it will change the current working
209   /// directory for the platform process.
210   ///
211   /// \param[in] working_dir
212   ///     The path to a directory to use when launching our process
213   ///
214   /// \return
215   ///     Zero if the for success, or an error code for failure.
216   int SetWorkingDir(const FileSpec &working_dir);
217 
218   /// Gets the current working directory of a remote platform GDB
219   /// server.
220   ///
221   /// \param[out] working_dir
222   ///     The current working directory on the remote platform.
223   ///
224   /// \return
225   ///     Boolean for success
226   bool GetWorkingDir(FileSpec &working_dir);
227 
228   lldb::addr_t AllocateMemory(size_t size, uint32_t permissions);
229 
230   bool DeallocateMemory(lldb::addr_t addr);
231 
232   Status Detach(bool keep_stopped);
233 
234   Status GetMemoryRegionInfo(lldb::addr_t addr, MemoryRegionInfo &range_info);
235 
236   Status GetWatchpointSupportInfo(uint32_t &num);
237 
238   Status GetWatchpointSupportInfo(uint32_t &num, bool &after,
239                                   const ArchSpec &arch);
240 
241   Status GetWatchpointsTriggerAfterInstruction(bool &after,
242                                                const ArchSpec &arch);
243 
244   const ArchSpec &GetHostArchitecture();
245 
246   std::chrono::seconds GetHostDefaultPacketTimeout();
247 
248   const ArchSpec &GetProcessArchitecture();
249 
250   void GetRemoteQSupported();
251 
252   bool GetVContSupported(char flavor);
253 
254   bool GetpPacketSupported(lldb::tid_t tid);
255 
256   bool GetxPacketSupported();
257 
258   bool GetVAttachOrWaitSupported();
259 
260   bool GetSyncThreadStateSupported();
261 
262   void ResetDiscoverableSettings(bool did_exec);
263 
264   bool GetHostInfo(bool force = false);
265 
266   bool GetDefaultThreadId(lldb::tid_t &tid);
267 
268   llvm::VersionTuple GetOSVersion();
269 
270   llvm::VersionTuple GetMacCatalystVersion();
271 
272   bool GetOSBuildString(std::string &s);
273 
274   bool GetOSKernelDescription(std::string &s);
275 
276   ArchSpec GetSystemArchitecture();
277 
278   bool GetHostname(std::string &s);
279 
280   lldb::addr_t GetShlibInfoAddr();
281 
282   bool GetSupportsThreadSuffix();
283 
284   bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info);
285 
286   uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info,
287                          ProcessInstanceInfoList &process_infos);
288 
289   bool GetUserName(uint32_t uid, std::string &name);
290 
291   bool GetGroupName(uint32_t gid, std::string &name);
292 
293   bool HasFullVContSupport() { return GetVContSupported('A'); }
294 
295   bool HasAnyVContSupport() { return GetVContSupported('a'); }
296 
297   bool GetStopReply(StringExtractorGDBRemote &response);
298 
299   bool GetThreadStopInfo(lldb::tid_t tid, StringExtractorGDBRemote &response);
300 
301   bool SupportsGDBStoppointPacket(GDBStoppointType type) {
302     switch (type) {
303     case eBreakpointSoftware:
304       return m_supports_z0;
305     case eBreakpointHardware:
306       return m_supports_z1;
307     case eWatchpointWrite:
308       return m_supports_z2;
309     case eWatchpointRead:
310       return m_supports_z3;
311     case eWatchpointReadWrite:
312       return m_supports_z4;
313     default:
314       return false;
315     }
316   }
317 
318   uint8_t SendGDBStoppointTypePacket(
319       GDBStoppointType type, // Type of breakpoint or watchpoint
320       bool insert,           // Insert or remove?
321       lldb::addr_t addr,     // Address of breakpoint or watchpoint
322       uint32_t length);      // Byte Size of breakpoint or watchpoint
323 
324   bool SetNonStopMode(const bool enable);
325 
326   void TestPacketSpeed(const uint32_t num_packets, uint32_t max_send,
327                        uint32_t max_recv, uint64_t recv_amount, bool json,
328                        Stream &strm);
329 
330   // This packet is for testing the speed of the interface only. Both
331   // the client and server need to support it, but this allows us to
332   // measure the packet speed without any other work being done on the
333   // other end and avoids any of that work affecting the packet send
334   // and response times.
335   bool SendSpeedTestPacket(uint32_t send_size, uint32_t recv_size);
336 
337   bool SetCurrentThread(uint64_t tid);
338 
339   bool SetCurrentThreadForRun(uint64_t tid);
340 
341   bool GetQXferAuxvReadSupported();
342 
343   void EnableErrorStringInPacket();
344 
345   bool GetQXferLibrariesReadSupported();
346 
347   bool GetQXferLibrariesSVR4ReadSupported();
348 
349   uint64_t GetRemoteMaxPacketSize();
350 
351   bool GetEchoSupported();
352 
353   bool GetQPassSignalsSupported();
354 
355   bool GetAugmentedLibrariesSVR4ReadSupported();
356 
357   bool GetQXferFeaturesReadSupported();
358 
359   bool GetQXferMemoryMapReadSupported();
360 
361   LazyBool SupportsAllocDeallocMemory() // const
362   {
363     // Uncomment this to have lldb pretend the debug server doesn't respond to
364     // alloc/dealloc memory packets.
365     // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
366     return m_supports_alloc_dealloc_memory;
367   }
368 
369   std::vector<std::pair<lldb::pid_t, lldb::tid_t>>
370   GetCurrentProcessAndThreadIDs(bool &sequence_mutex_unavailable);
371 
372   size_t GetCurrentThreadIDs(std::vector<lldb::tid_t> &thread_ids,
373                              bool &sequence_mutex_unavailable);
374 
375   lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
376                            mode_t mode, Status &error);
377 
378   bool CloseFile(lldb::user_id_t fd, Status &error);
379 
380   lldb::user_id_t GetFileSize(const FileSpec &file_spec);
381 
382   void AutoCompleteDiskFileOrDirectory(CompletionRequest &request,
383                                        bool only_dir);
384 
385   Status GetFilePermissions(const FileSpec &file_spec,
386                             uint32_t &file_permissions);
387 
388   Status SetFilePermissions(const FileSpec &file_spec,
389                             uint32_t file_permissions);
390 
391   uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
392                     uint64_t dst_len, Status &error);
393 
394   uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
395                      uint64_t src_len, Status &error);
396 
397   Status CreateSymlink(const FileSpec &src, const FileSpec &dst);
398 
399   Status Unlink(const FileSpec &file_spec);
400 
401   Status MakeDirectory(const FileSpec &file_spec, uint32_t mode);
402 
403   bool GetFileExists(const FileSpec &file_spec);
404 
405   Status RunShellCommand(
406       llvm::StringRef command,
407       const FileSpec &working_dir, // Pass empty FileSpec to use the current
408                                    // working directory
409       int *status_ptr, // Pass nullptr if you don't want the process exit status
410       int *signo_ptr,  // Pass nullptr if you don't want the signal that caused
411                        // the process to exit
412       std::string
413           *command_output, // Pass nullptr if you don't want the command output
414       const Timeout<std::micro> &timeout);
415 
416   bool CalculateMD5(const FileSpec &file_spec, uint64_t &high, uint64_t &low);
417 
418   lldb::DataBufferSP ReadRegister(
419       lldb::tid_t tid,
420       uint32_t
421           reg_num); // Must be the eRegisterKindProcessPlugin register number
422 
423   lldb::DataBufferSP ReadAllRegisters(lldb::tid_t tid);
424 
425   bool
426   WriteRegister(lldb::tid_t tid,
427                 uint32_t reg_num, // eRegisterKindProcessPlugin register number
428                 llvm::ArrayRef<uint8_t> data);
429 
430   bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data);
431 
432   bool SaveRegisterState(lldb::tid_t tid, uint32_t &save_id);
433 
434   bool RestoreRegisterState(lldb::tid_t tid, uint32_t save_id);
435 
436   bool SyncThreadState(lldb::tid_t tid);
437 
438   const char *GetGDBServerProgramName();
439 
440   uint32_t GetGDBServerProgramVersion();
441 
442   bool AvoidGPackets(ProcessGDBRemote *process);
443 
444   StructuredData::ObjectSP GetThreadsInfo();
445 
446   bool GetThreadExtendedInfoSupported();
447 
448   bool GetLoadedDynamicLibrariesInfosSupported();
449 
450   bool GetSharedCacheInfoSupported();
451 
452   /// Use qOffsets to query the offset used when relocating the target
453   /// executable. If successful, the returned structure will contain at least
454   /// one value in the offsets field.
455   llvm::Optional<QOffsets> GetQOffsets();
456 
457   bool GetModuleInfo(const FileSpec &module_file_spec,
458                      const ArchSpec &arch_spec, ModuleSpec &module_spec);
459 
460   llvm::Optional<std::vector<ModuleSpec>>
461   GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs,
462                  const llvm::Triple &triple);
463 
464   bool ReadExtFeature(const lldb_private::ConstString object,
465                       const lldb_private::ConstString annex, std::string &out,
466                       lldb_private::Status &err);
467 
468   void ServeSymbolLookups(lldb_private::Process *process);
469 
470   // Sends QPassSignals packet to the server with given signals to ignore.
471   Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals);
472 
473   /// Return the feature set supported by the gdb-remote server.
474   ///
475   /// This method returns the remote side's response to the qSupported
476   /// packet.  The response is the complete string payload returned
477   /// to the client.
478   ///
479   /// \return
480   ///     The string returned by the server to the qSupported query.
481   const std::string &GetServerSupportedFeatures() const {
482     return m_qSupported_response;
483   }
484 
485   /// Return the array of async JSON packet types supported by the remote.
486   ///
487   /// This method returns the remote side's array of supported JSON
488   /// packet types as a list of type names.  Each of the results are
489   /// expected to have an Enable{type_name} command to enable and configure
490   /// the related feature.  Each type_name for an enabled feature will
491   /// possibly send async-style packets that contain a payload of a
492   /// binhex-encoded JSON dictionary.  The dictionary will have a
493   /// string field named 'type', that contains the type_name of the
494   /// supported packet type.
495   ///
496   /// There is a Plugin category called structured-data plugins.
497   /// A plugin indicates whether it knows how to handle a type_name.
498   /// If so, it can be used to process the async JSON packet.
499   ///
500   /// \return
501   ///     The string returned by the server to the qSupported query.
502   lldb_private::StructuredData::Array *GetSupportedStructuredDataPlugins();
503 
504   /// Configure a StructuredData feature on the remote end.
505   ///
506   /// \see \b Process::ConfigureStructuredData(...) for details.
507   Status
508   ConfigureRemoteStructuredData(ConstString type_name,
509                                 const StructuredData::ObjectSP &config_sp);
510 
511   llvm::Expected<TraceSupportedResponse> SendTraceSupported();
512 
513   llvm::Error SendTraceStart(const llvm::json::Value &request);
514 
515   llvm::Error SendTraceStop(const TraceStopRequest &request);
516 
517   llvm::Expected<std::string> SendTraceGetState(llvm::StringRef type);
518 
519   llvm::Expected<std::vector<uint8_t>>
520   SendTraceGetBinaryData(const TraceGetBinaryDataRequest &request);
521 
522 protected:
523   LazyBool m_supports_not_sending_acks;
524   LazyBool m_supports_thread_suffix;
525   LazyBool m_supports_threads_in_stop_reply;
526   LazyBool m_supports_vCont_all;
527   LazyBool m_supports_vCont_any;
528   LazyBool m_supports_vCont_c;
529   LazyBool m_supports_vCont_C;
530   LazyBool m_supports_vCont_s;
531   LazyBool m_supports_vCont_S;
532   LazyBool m_qHostInfo_is_valid;
533   LazyBool m_curr_pid_is_valid;
534   LazyBool m_qProcessInfo_is_valid;
535   LazyBool m_qGDBServerVersion_is_valid;
536   LazyBool m_supports_alloc_dealloc_memory;
537   LazyBool m_supports_memory_region_info;
538   LazyBool m_supports_watchpoint_support_info;
539   LazyBool m_supports_detach_stay_stopped;
540   LazyBool m_watchpoints_trigger_after_instruction;
541   LazyBool m_attach_or_wait_reply;
542   LazyBool m_prepare_for_reg_writing_reply;
543   LazyBool m_supports_p;
544   LazyBool m_supports_x;
545   LazyBool m_avoid_g_packets;
546   LazyBool m_supports_QSaveRegisterState;
547   LazyBool m_supports_qXfer_auxv_read;
548   LazyBool m_supports_qXfer_libraries_read;
549   LazyBool m_supports_qXfer_libraries_svr4_read;
550   LazyBool m_supports_qXfer_features_read;
551   LazyBool m_supports_qXfer_memory_map_read;
552   LazyBool m_supports_augmented_libraries_svr4_read;
553   LazyBool m_supports_jThreadExtendedInfo;
554   LazyBool m_supports_jLoadedDynamicLibrariesInfos;
555   LazyBool m_supports_jGetSharedCacheInfo;
556   LazyBool m_supports_QPassSignals;
557   LazyBool m_supports_error_string_reply;
558   LazyBool m_supports_multiprocess;
559 
560   bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1,
561       m_supports_qUserName : 1, m_supports_qGroupName : 1,
562       m_supports_qThreadStopInfo : 1, m_supports_z0 : 1, m_supports_z1 : 1,
563       m_supports_z2 : 1, m_supports_z3 : 1, m_supports_z4 : 1,
564       m_supports_QEnvironment : 1, m_supports_QEnvironmentHexEncoded : 1,
565       m_supports_qSymbol : 1, m_qSymbol_requests_done : 1,
566       m_supports_qModuleInfo : 1, m_supports_jThreadsInfo : 1,
567       m_supports_jModulesInfo : 1;
568 
569   lldb::pid_t m_curr_pid;
570   lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all
571                           // other operations
572   lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for
573                               // continue, step, etc
574 
575   uint32_t m_num_supported_hardware_watchpoints;
576 
577   ArchSpec m_host_arch;
578   ArchSpec m_process_arch;
579   llvm::VersionTuple m_os_version;
580   llvm::VersionTuple m_maccatalyst_version;
581   std::string m_os_build;
582   std::string m_os_kernel;
583   std::string m_hostname;
584   std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if
585                                  // qGDBServerVersion is not supported
586   uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if
587                                  // qGDBServerVersion is not supported
588   std::chrono::seconds m_default_packet_timeout;
589   uint64_t m_max_packet_size;        // as returned by qSupported
590   std::string m_qSupported_response; // the complete response to qSupported
591 
592   bool m_supported_async_json_packets_is_valid;
593   lldb_private::StructuredData::ObjectSP m_supported_async_json_packets_sp;
594 
595   std::vector<MemoryRegionInfo> m_qXfer_memory_map;
596   bool m_qXfer_memory_map_loaded;
597 
598   bool GetCurrentProcessInfo(bool allow_lazy_pid = true);
599 
600   bool GetGDBServerVersion();
601 
602   // Given the list of compression types that the remote debug stub can support,
603   // possibly enable compression if we find an encoding we can handle.
604   void MaybeEnableCompression(
605       llvm::ArrayRef<llvm::StringRef> supported_compressions);
606 
607   bool DecodeProcessInfoResponse(StringExtractorGDBRemote &response,
608                                  ProcessInstanceInfo &process_info);
609 
610   void OnRunPacketSent(bool first) override;
611 
612   PacketResult SendThreadSpecificPacketAndWaitForResponse(
613       lldb::tid_t tid, StreamString &&payload,
614       StringExtractorGDBRemote &response, bool send_async);
615 
616   Status SendGetTraceDataPacket(StreamGDBRemote &packet, lldb::user_id_t uid,
617                                 lldb::tid_t thread_id,
618                                 llvm::MutableArrayRef<uint8_t> &buffer,
619                                 size_t offset);
620 
621   Status LoadQXferMemoryMap();
622 
623   Status GetQXferMemoryMapRegionInfo(lldb::addr_t addr,
624                                      MemoryRegionInfo &region);
625 
626   LazyBool GetThreadPacketSupported(lldb::tid_t tid, llvm::StringRef packetStr);
627 
628 private:
629   GDBRemoteCommunicationClient(const GDBRemoteCommunicationClient &) = delete;
630   const GDBRemoteCommunicationClient &
631   operator=(const GDBRemoteCommunicationClient &) = delete;
632 };
633 
634 } // namespace process_gdb_remote
635 } // namespace lldb_private
636 
637 #endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONCLIENT_H
638