• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/TraceOptions.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 
HasFullVContSupport()293   bool HasFullVContSupport() { return GetVContSupported('A'); }
294 
HasAnyVContSupport()295   bool HasAnyVContSupport() { return GetVContSupported('a'); }
296 
297   bool GetStopReply(StringExtractorGDBRemote &response);
298 
299   bool GetThreadStopInfo(lldb::tid_t tid, StringExtractorGDBRemote &response);
300 
SupportsGDBStoppointPacket(GDBStoppointType type)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 
SupportsAllocDeallocMemory()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   size_t GetCurrentThreadIDs(std::vector<lldb::tid_t> &thread_ids,
370                              bool &sequence_mutex_unavailable);
371 
372   lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
373                            mode_t mode, Status &error);
374 
375   bool CloseFile(lldb::user_id_t fd, Status &error);
376 
377   lldb::user_id_t GetFileSize(const FileSpec &file_spec);
378 
379   void AutoCompleteDiskFileOrDirectory(CompletionRequest &request,
380                                        bool only_dir);
381 
382   Status GetFilePermissions(const FileSpec &file_spec,
383                             uint32_t &file_permissions);
384 
385   Status SetFilePermissions(const FileSpec &file_spec,
386                             uint32_t file_permissions);
387 
388   uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
389                     uint64_t dst_len, Status &error);
390 
391   uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
392                      uint64_t src_len, Status &error);
393 
394   Status CreateSymlink(const FileSpec &src, const FileSpec &dst);
395 
396   Status Unlink(const FileSpec &file_spec);
397 
398   Status MakeDirectory(const FileSpec &file_spec, uint32_t mode);
399 
400   bool GetFileExists(const FileSpec &file_spec);
401 
402   Status RunShellCommand(
403       llvm::StringRef command,
404       const FileSpec &working_dir, // Pass empty FileSpec to use the current
405                                    // working directory
406       int *status_ptr, // Pass nullptr if you don't want the process exit status
407       int *signo_ptr,  // Pass nullptr if you don't want the signal that caused
408                        // the process to exit
409       std::string
410           *command_output, // Pass nullptr if you don't want the command output
411       const Timeout<std::micro> &timeout);
412 
413   bool CalculateMD5(const FileSpec &file_spec, uint64_t &high, uint64_t &low);
414 
415   lldb::DataBufferSP ReadRegister(
416       lldb::tid_t tid,
417       uint32_t
418           reg_num); // Must be the eRegisterKindProcessPlugin register number
419 
420   lldb::DataBufferSP ReadAllRegisters(lldb::tid_t tid);
421 
422   bool
423   WriteRegister(lldb::tid_t tid,
424                 uint32_t reg_num, // eRegisterKindProcessPlugin register number
425                 llvm::ArrayRef<uint8_t> data);
426 
427   bool WriteAllRegisters(lldb::tid_t tid, llvm::ArrayRef<uint8_t> data);
428 
429   bool SaveRegisterState(lldb::tid_t tid, uint32_t &save_id);
430 
431   bool RestoreRegisterState(lldb::tid_t tid, uint32_t save_id);
432 
433   bool SyncThreadState(lldb::tid_t tid);
434 
435   const char *GetGDBServerProgramName();
436 
437   uint32_t GetGDBServerProgramVersion();
438 
439   bool AvoidGPackets(ProcessGDBRemote *process);
440 
441   StructuredData::ObjectSP GetThreadsInfo();
442 
443   bool GetThreadExtendedInfoSupported();
444 
445   bool GetLoadedDynamicLibrariesInfosSupported();
446 
447   bool GetSharedCacheInfoSupported();
448 
449   /// Use qOffsets to query the offset used when relocating the target
450   /// executable. If successful, the returned structure will contain at least
451   /// one value in the offsets field.
452   llvm::Optional<QOffsets> GetQOffsets();
453 
454   bool GetModuleInfo(const FileSpec &module_file_spec,
455                      const ArchSpec &arch_spec, ModuleSpec &module_spec);
456 
457   llvm::Optional<std::vector<ModuleSpec>>
458   GetModulesInfo(llvm::ArrayRef<FileSpec> module_file_specs,
459                  const llvm::Triple &triple);
460 
461   bool ReadExtFeature(const lldb_private::ConstString object,
462                       const lldb_private::ConstString annex, std::string &out,
463                       lldb_private::Status &err);
464 
465   void ServeSymbolLookups(lldb_private::Process *process);
466 
467   // Sends QPassSignals packet to the server with given signals to ignore.
468   Status SendSignalsToIgnore(llvm::ArrayRef<int32_t> signals);
469 
470   /// Return the feature set supported by the gdb-remote server.
471   ///
472   /// This method returns the remote side's response to the qSupported
473   /// packet.  The response is the complete string payload returned
474   /// to the client.
475   ///
476   /// \return
477   ///     The string returned by the server to the qSupported query.
GetServerSupportedFeatures()478   const std::string &GetServerSupportedFeatures() const {
479     return m_qSupported_response;
480   }
481 
482   /// Return the array of async JSON packet types supported by the remote.
483   ///
484   /// This method returns the remote side's array of supported JSON
485   /// packet types as a list of type names.  Each of the results are
486   /// expected to have an Enable{type_name} command to enable and configure
487   /// the related feature.  Each type_name for an enabled feature will
488   /// possibly send async-style packets that contain a payload of a
489   /// binhex-encoded JSON dictionary.  The dictionary will have a
490   /// string field named 'type', that contains the type_name of the
491   /// supported packet type.
492   ///
493   /// There is a Plugin category called structured-data plugins.
494   /// A plugin indicates whether it knows how to handle a type_name.
495   /// If so, it can be used to process the async JSON packet.
496   ///
497   /// \return
498   ///     The string returned by the server to the qSupported query.
499   lldb_private::StructuredData::Array *GetSupportedStructuredDataPlugins();
500 
501   /// Configure a StructuredData feature on the remote end.
502   ///
503   /// \see \b Process::ConfigureStructuredData(...) for details.
504   Status
505   ConfigureRemoteStructuredData(ConstString type_name,
506                                 const StructuredData::ObjectSP &config_sp);
507 
508   lldb::user_id_t SendStartTracePacket(const TraceOptions &options,
509                                        Status &error);
510 
511   Status SendStopTracePacket(lldb::user_id_t uid, lldb::tid_t thread_id);
512 
513   Status SendGetDataPacket(lldb::user_id_t uid, lldb::tid_t thread_id,
514                            llvm::MutableArrayRef<uint8_t> &buffer,
515                            size_t offset = 0);
516 
517   Status SendGetMetaDataPacket(lldb::user_id_t uid, lldb::tid_t thread_id,
518                                llvm::MutableArrayRef<uint8_t> &buffer,
519                                size_t offset = 0);
520 
521   Status SendGetTraceConfigPacket(lldb::user_id_t uid, TraceOptions &options);
522 
523   llvm::Expected<TraceTypeInfo> SendGetSupportedTraceType();
524 
525 protected:
526   LazyBool m_supports_not_sending_acks;
527   LazyBool m_supports_thread_suffix;
528   LazyBool m_supports_threads_in_stop_reply;
529   LazyBool m_supports_vCont_all;
530   LazyBool m_supports_vCont_any;
531   LazyBool m_supports_vCont_c;
532   LazyBool m_supports_vCont_C;
533   LazyBool m_supports_vCont_s;
534   LazyBool m_supports_vCont_S;
535   LazyBool m_qHostInfo_is_valid;
536   LazyBool m_curr_pid_is_valid;
537   LazyBool m_qProcessInfo_is_valid;
538   LazyBool m_qGDBServerVersion_is_valid;
539   LazyBool m_supports_alloc_dealloc_memory;
540   LazyBool m_supports_memory_region_info;
541   LazyBool m_supports_watchpoint_support_info;
542   LazyBool m_supports_detach_stay_stopped;
543   LazyBool m_watchpoints_trigger_after_instruction;
544   LazyBool m_attach_or_wait_reply;
545   LazyBool m_prepare_for_reg_writing_reply;
546   LazyBool m_supports_p;
547   LazyBool m_supports_x;
548   LazyBool m_avoid_g_packets;
549   LazyBool m_supports_QSaveRegisterState;
550   LazyBool m_supports_qXfer_auxv_read;
551   LazyBool m_supports_qXfer_libraries_read;
552   LazyBool m_supports_qXfer_libraries_svr4_read;
553   LazyBool m_supports_qXfer_features_read;
554   LazyBool m_supports_qXfer_memory_map_read;
555   LazyBool m_supports_augmented_libraries_svr4_read;
556   LazyBool m_supports_jThreadExtendedInfo;
557   LazyBool m_supports_jLoadedDynamicLibrariesInfos;
558   LazyBool m_supports_jGetSharedCacheInfo;
559   LazyBool m_supports_QPassSignals;
560   LazyBool m_supports_error_string_reply;
561 
562   bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1,
563       m_supports_qUserName : 1, m_supports_qGroupName : 1,
564       m_supports_qThreadStopInfo : 1, m_supports_z0 : 1, m_supports_z1 : 1,
565       m_supports_z2 : 1, m_supports_z3 : 1, m_supports_z4 : 1,
566       m_supports_QEnvironment : 1, m_supports_QEnvironmentHexEncoded : 1,
567       m_supports_qSymbol : 1, m_qSymbol_requests_done : 1,
568       m_supports_qModuleInfo : 1, m_supports_jThreadsInfo : 1,
569       m_supports_jModulesInfo : 1;
570 
571   lldb::pid_t m_curr_pid;
572   lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all
573                           // other operations
574   lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for
575                               // continue, step, etc
576 
577   uint32_t m_num_supported_hardware_watchpoints;
578 
579   ArchSpec m_host_arch;
580   ArchSpec m_process_arch;
581   llvm::VersionTuple m_os_version;
582   llvm::VersionTuple m_maccatalyst_version;
583   std::string m_os_build;
584   std::string m_os_kernel;
585   std::string m_hostname;
586   std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if
587                                  // qGDBServerVersion is not supported
588   uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if
589                                  // qGDBServerVersion is not supported
590   std::chrono::seconds m_default_packet_timeout;
591   uint64_t m_max_packet_size;        // as returned by qSupported
592   std::string m_qSupported_response; // the complete response to qSupported
593 
594   bool m_supported_async_json_packets_is_valid;
595   lldb_private::StructuredData::ObjectSP m_supported_async_json_packets_sp;
596 
597   std::vector<MemoryRegionInfo> m_qXfer_memory_map;
598   bool m_qXfer_memory_map_loaded;
599 
600   bool GetCurrentProcessInfo(bool allow_lazy_pid = true);
601 
602   bool GetGDBServerVersion();
603 
604   // Given the list of compression types that the remote debug stub can support,
605   // possibly enable compression if we find an encoding we can handle.
606   void MaybeEnableCompression(std::vector<std::string> supported_compressions);
607 
608   bool DecodeProcessInfoResponse(StringExtractorGDBRemote &response,
609                                  ProcessInstanceInfo &process_info);
610 
611   void OnRunPacketSent(bool first) override;
612 
613   PacketResult SendThreadSpecificPacketAndWaitForResponse(
614       lldb::tid_t tid, StreamString &&payload,
615       StringExtractorGDBRemote &response, bool send_async);
616 
617   Status SendGetTraceDataPacket(StreamGDBRemote &packet, lldb::user_id_t uid,
618                                 lldb::tid_t thread_id,
619                                 llvm::MutableArrayRef<uint8_t> &buffer,
620                                 size_t offset);
621 
622   Status LoadQXferMemoryMap();
623 
624   Status GetQXferMemoryMapRegionInfo(lldb::addr_t addr,
625                                      MemoryRegionInfo &region);
626 
627   LazyBool GetThreadPacketSupported(lldb::tid_t tid, llvm::StringRef packetStr);
628 
629 private:
630   GDBRemoteCommunicationClient(const GDBRemoteCommunicationClient &) = delete;
631   const GDBRemoteCommunicationClient &
632   operator=(const GDBRemoteCommunicationClient &) = delete;
633 };
634 
635 } // namespace process_gdb_remote
636 } // namespace lldb_private
637 
638 #endif // LLDB_SOURCE_PLUGINS_PROCESS_GDB_REMOTE_GDBREMOTECOMMUNICATIONCLIENT_H
639