GDBRemoteCommunicationClient.h revision 276479
1254721Semaste//===-- GDBRemoteCommunicationClient.h --------------------------*- C++ -*-===//
2254721Semaste//
3254721Semaste//                     The LLVM Compiler Infrastructure
4254721Semaste//
5254721Semaste// This file is distributed under the University of Illinois Open Source
6254721Semaste// License. See LICENSE.TXT for details.
7254721Semaste//
8254721Semaste//===----------------------------------------------------------------------===//
9254721Semaste
10254721Semaste#ifndef liblldb_GDBRemoteCommunicationClient_h_
11254721Semaste#define liblldb_GDBRemoteCommunicationClient_h_
12254721Semaste
13254721Semaste// C Includes
14254721Semaste// C++ Includes
15254721Semaste#include <vector>
16254721Semaste
17254721Semaste// Other libraries and framework includes
18254721Semaste// Project includes
19254721Semaste#include "lldb/Core/ArchSpec.h"
20254721Semaste#include "lldb/Target/Process.h"
21254721Semaste
22254721Semaste#include "GDBRemoteCommunication.h"
23254721Semaste
24254721Semastetypedef enum
25254721Semaste{
26254721Semaste    eBreakpointSoftware = 0,
27254721Semaste    eBreakpointHardware,
28254721Semaste    eWatchpointWrite,
29254721Semaste    eWatchpointRead,
30254721Semaste    eWatchpointReadWrite
31254721Semaste} GDBStoppointType;
32254721Semaste
33254721Semasteclass GDBRemoteCommunicationClient : public GDBRemoteCommunication
34254721Semaste{
35254721Semastepublic:
36254721Semaste    //------------------------------------------------------------------
37254721Semaste    // Constructors and Destructors
38254721Semaste    //------------------------------------------------------------------
39254721Semaste    GDBRemoteCommunicationClient(bool is_platform);
40254721Semaste
41254721Semaste    ~GDBRemoteCommunicationClient();
42254721Semaste
43254721Semaste    //------------------------------------------------------------------
44254721Semaste    // After connecting, send the handshake to the server to make sure
45254721Semaste    // we are communicating with it.
46254721Semaste    //------------------------------------------------------------------
47254721Semaste    bool
48254721Semaste    HandshakeWithServer (lldb_private::Error *error_ptr);
49254721Semaste
50262528Semaste    PacketResult
51254721Semaste    SendPacketAndWaitForResponse (const char *send_payload,
52254721Semaste                                  StringExtractorGDBRemote &response,
53254721Semaste                                  bool send_async);
54254721Semaste
55262528Semaste    PacketResult
56254721Semaste    SendPacketAndWaitForResponse (const char *send_payload,
57254721Semaste                                  size_t send_length,
58254721Semaste                                  StringExtractorGDBRemote &response,
59254721Semaste                                  bool send_async);
60254721Semaste
61262528Semaste    // For packets which specify a range of output to be returned,
62262528Semaste    // return all of the output via a series of request packets of the form
63262528Semaste    // <prefix>0,<size>
64262528Semaste    // <prefix><size>,<size>
65262528Semaste    // <prefix><size>*2,<size>
66262528Semaste    // <prefix><size>*3,<size>
67262528Semaste    // ...
68262528Semaste    // until a "$l..." packet is received, indicating the end.
69262528Semaste    // (size is in hex; this format is used by a standard gdbserver to
70262528Semaste    // return the given portion of the output specified by <prefix>;
71262528Semaste    // for example, "qXfer:libraries-svr4:read::fff,1000" means
72262528Semaste    // "return a chunk of the xml description file for shared
73262528Semaste    // library load addresses, where the chunk starts at offset 0xfff
74262528Semaste    // and continues for 0x1000 bytes").
75262528Semaste    // Concatenate the resulting server response packets together and
76262528Semaste    // return in response_string.  If any packet fails, the return value
77262528Semaste    // indicates that failure and the returned string value is undefined.
78262528Semaste    PacketResult
79262528Semaste    SendPacketsAndConcatenateResponses (const char *send_payload_prefix,
80262528Semaste                                        std::string &response_string);
81262528Semaste
82254721Semaste    lldb::StateType
83254721Semaste    SendContinuePacketAndWaitForResponse (ProcessGDBRemote *process,
84254721Semaste                                          const char *packet_payload,
85254721Semaste                                          size_t packet_length,
86254721Semaste                                          StringExtractorGDBRemote &response);
87254721Semaste
88258884Semaste    bool
89254721Semaste    GetThreadSuffixSupported ();
90254721Semaste
91258884Semaste    // This packet is usually sent first and the boolean return value
92258884Semaste    // indicates if the packet was send and any response was received
93258884Semaste    // even in the response is UNIMPLEMENTED. If the packet failed to
94258884Semaste    // get a response, then false is returned. This quickly tells us
95276479Sdim    // if we were able to connect and communicate with the remote GDB
96258884Semaste    // server
97258884Semaste    bool
98254721Semaste    QueryNoAckModeSupported ();
99254721Semaste
100254721Semaste    void
101254721Semaste    GetListThreadsInStopReplySupported ();
102254721Semaste
103254721Semaste    bool
104254721Semaste    SendAsyncSignal (int signo);
105254721Semaste
106254721Semaste    bool
107254721Semaste    SendInterrupt (lldb_private::Mutex::Locker &locker,
108254721Semaste                   uint32_t seconds_to_wait_for_stop,
109254721Semaste                   bool &timed_out);
110254721Semaste
111254721Semaste    lldb::pid_t
112254721Semaste    GetCurrentProcessID ();
113254721Semaste
114254721Semaste    bool
115254721Semaste    GetLaunchSuccess (std::string &error_str);
116254721Semaste
117254721Semaste    uint16_t
118262528Semaste    LaunchGDBserverAndGetPort (lldb::pid_t &pid, const char *remote_accept_hostname);
119258054Semaste
120258054Semaste    bool
121258054Semaste    KillSpawnedProcess (lldb::pid_t pid);
122254721Semaste
123254721Semaste    //------------------------------------------------------------------
124254721Semaste    /// Sends a GDB remote protocol 'A' packet that delivers program
125254721Semaste    /// arguments to the remote server.
126254721Semaste    ///
127254721Semaste    /// @param[in] argv
128254721Semaste    ///     A NULL terminated array of const C strings to use as the
129254721Semaste    ///     arguments.
130254721Semaste    ///
131254721Semaste    /// @return
132254721Semaste    ///     Zero if the response was "OK", a positive value if the
133254721Semaste    ///     the response was "Exx" where xx are two hex digits, or
134254721Semaste    ///     -1 if the call is unsupported or any other unexpected
135254721Semaste    ///     response was received.
136254721Semaste    //------------------------------------------------------------------
137254721Semaste    int
138258884Semaste    SendArgumentsPacket (const lldb_private::ProcessLaunchInfo &launch_info);
139254721Semaste
140254721Semaste    //------------------------------------------------------------------
141254721Semaste    /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
142254721Semaste    /// environment that will get used when launching an application
143254721Semaste    /// in conjunction with the 'A' packet. This function can be called
144254721Semaste    /// multiple times in a row in order to pass on the desired
145254721Semaste    /// environment that the inferior should be launched with.
146254721Semaste    ///
147254721Semaste    /// @param[in] name_equal_value
148254721Semaste    ///     A NULL terminated C string that contains a single environment
149254721Semaste    ///     in the format "NAME=VALUE".
150254721Semaste    ///
151254721Semaste    /// @return
152254721Semaste    ///     Zero if the response was "OK", a positive value if the
153254721Semaste    ///     the response was "Exx" where xx are two hex digits, or
154254721Semaste    ///     -1 if the call is unsupported or any other unexpected
155254721Semaste    ///     response was received.
156254721Semaste    //------------------------------------------------------------------
157254721Semaste    int
158254721Semaste    SendEnvironmentPacket (char const *name_equal_value);
159254721Semaste
160254721Semaste    int
161254721Semaste    SendLaunchArchPacket (const char *arch);
162276479Sdim
163276479Sdim    int
164276479Sdim    SendLaunchEventDataPacket (const char *data, bool *was_supported = NULL);
165276479Sdim
166254721Semaste    //------------------------------------------------------------------
167254721Semaste    /// Sends a "vAttach:PID" where PID is in hex.
168254721Semaste    ///
169254721Semaste    /// @param[in] pid
170254721Semaste    ///     A process ID for the remote gdb server to attach to.
171254721Semaste    ///
172254721Semaste    /// @param[out] response
173254721Semaste    ///     The response received from the gdb server. If the return
174254721Semaste    ///     value is zero, \a response will contain a stop reply
175254721Semaste    ///     packet.
176254721Semaste    ///
177254721Semaste    /// @return
178254721Semaste    ///     Zero if the attach was successful, or an error indicating
179254721Semaste    ///     an error code.
180254721Semaste    //------------------------------------------------------------------
181254721Semaste    int
182254721Semaste    SendAttach (lldb::pid_t pid,
183254721Semaste                StringExtractorGDBRemote& response);
184254721Semaste
185254721Semaste
186254721Semaste    //------------------------------------------------------------------
187254721Semaste    /// Sets the path to use for stdin/out/err for a process
188254721Semaste    /// that will be launched with the 'A' packet.
189254721Semaste    ///
190254721Semaste    /// @param[in] path
191254721Semaste    ///     The path to use for stdin/out/err
192254721Semaste    ///
193254721Semaste    /// @return
194254721Semaste    ///     Zero if the for success, or an error code for failure.
195254721Semaste    //------------------------------------------------------------------
196254721Semaste    int
197254721Semaste    SetSTDIN (char const *path);
198254721Semaste    int
199254721Semaste    SetSTDOUT (char const *path);
200254721Semaste    int
201254721Semaste    SetSTDERR (char const *path);
202254721Semaste
203254721Semaste    //------------------------------------------------------------------
204254721Semaste    /// Sets the disable ASLR flag to \a enable for a process that will
205254721Semaste    /// be launched with the 'A' packet.
206254721Semaste    ///
207254721Semaste    /// @param[in] enable
208276479Sdim    ///     A boolean value indicating whether to disable ASLR or not.
209254721Semaste    ///
210254721Semaste    /// @return
211254721Semaste    ///     Zero if the for success, or an error code for failure.
212254721Semaste    //------------------------------------------------------------------
213254721Semaste    int
214254721Semaste    SetDisableASLR (bool enable);
215276479Sdim
216276479Sdim    //------------------------------------------------------------------
217276479Sdim    /// Sets the DetachOnError flag to \a enable for the process controlled by the stub.
218276479Sdim    ///
219276479Sdim    /// @param[in] enable
220276479Sdim    ///     A boolean value indicating whether to detach on error or not.
221276479Sdim    ///
222276479Sdim    /// @return
223276479Sdim    ///     Zero if the for success, or an error code for failure.
224276479Sdim    //------------------------------------------------------------------
225276479Sdim    int
226276479Sdim    SetDetachOnError (bool enable);
227254721Semaste
228254721Semaste    //------------------------------------------------------------------
229254721Semaste    /// Sets the working directory to \a path for a process that will
230258884Semaste    /// be launched with the 'A' packet for non platform based
231258884Semaste    /// connections. If this packet is sent to a GDB server that
232258884Semaste    /// implements the platform, it will change the current working
233258884Semaste    /// directory for the platform process.
234254721Semaste    ///
235254721Semaste    /// @param[in] path
236276479Sdim    ///     The path to a directory to use when launching our process
237254721Semaste    ///
238254721Semaste    /// @return
239254721Semaste    ///     Zero if the for success, or an error code for failure.
240254721Semaste    //------------------------------------------------------------------
241254721Semaste    int
242254721Semaste    SetWorkingDir (char const *path);
243254721Semaste
244258884Semaste    //------------------------------------------------------------------
245258884Semaste    /// Gets the current working directory of a remote platform GDB
246258884Semaste    /// server.
247258884Semaste    ///
248258884Semaste    /// @param[out] cwd
249258884Semaste    ///     The current working directory on the remote platform.
250258884Semaste    ///
251258884Semaste    /// @return
252258884Semaste    ///     Boolean for success
253258884Semaste    //------------------------------------------------------------------
254258884Semaste    bool
255258884Semaste    GetWorkingDir (std::string &cwd);
256258884Semaste
257254721Semaste    lldb::addr_t
258254721Semaste    AllocateMemory (size_t size, uint32_t permissions);
259254721Semaste
260254721Semaste    bool
261254721Semaste    DeallocateMemory (lldb::addr_t addr);
262254721Semaste
263254721Semaste    lldb_private::Error
264254721Semaste    Detach (bool keep_stopped);
265254721Semaste
266254721Semaste    lldb_private::Error
267254721Semaste    GetMemoryRegionInfo (lldb::addr_t addr,
268254721Semaste                        lldb_private::MemoryRegionInfo &range_info);
269254721Semaste
270254721Semaste    lldb_private::Error
271254721Semaste    GetWatchpointSupportInfo (uint32_t &num);
272254721Semaste
273254721Semaste    lldb_private::Error
274254721Semaste    GetWatchpointSupportInfo (uint32_t &num, bool& after);
275254721Semaste
276254721Semaste    lldb_private::Error
277254721Semaste    GetWatchpointsTriggerAfterInstruction (bool &after);
278254721Semaste
279254721Semaste    const lldb_private::ArchSpec &
280254721Semaste    GetHostArchitecture ();
281258054Semaste
282258054Semaste    uint32_t
283258054Semaste    GetHostDefaultPacketTimeout();
284254721Semaste
285254721Semaste    const lldb_private::ArchSpec &
286254721Semaste    GetProcessArchitecture ();
287254721Semaste
288262528Semaste    void
289262528Semaste    GetRemoteQSupported();
290262528Semaste
291254721Semaste    bool
292254721Semaste    GetVContSupported (char flavor);
293254721Semaste
294254721Semaste    bool
295258054Semaste    GetpPacketSupported (lldb::tid_t tid);
296258054Semaste
297258054Semaste    bool
298276479Sdim    GetxPacketSupported ();
299276479Sdim
300276479Sdim    bool
301254721Semaste    GetVAttachOrWaitSupported ();
302254721Semaste
303254721Semaste    bool
304254721Semaste    GetSyncThreadStateSupported();
305254721Semaste
306254721Semaste    void
307254721Semaste    ResetDiscoverableSettings();
308254721Semaste
309254721Semaste    bool
310254721Semaste    GetHostInfo (bool force = false);
311254721Semaste
312254721Semaste    bool
313254721Semaste    GetOSVersion (uint32_t &major,
314254721Semaste                  uint32_t &minor,
315254721Semaste                  uint32_t &update);
316254721Semaste
317254721Semaste    bool
318254721Semaste    GetOSBuildString (std::string &s);
319254721Semaste
320254721Semaste    bool
321254721Semaste    GetOSKernelDescription (std::string &s);
322254721Semaste
323254721Semaste    lldb_private::ArchSpec
324254721Semaste    GetSystemArchitecture ();
325254721Semaste
326254721Semaste    bool
327254721Semaste    GetHostname (std::string &s);
328254721Semaste
329254721Semaste    lldb::addr_t
330254721Semaste    GetShlibInfoAddr();
331254721Semaste
332254721Semaste    bool
333254721Semaste    GetSupportsThreadSuffix ();
334254721Semaste
335254721Semaste    bool
336254721Semaste    GetProcessInfo (lldb::pid_t pid,
337254721Semaste                    lldb_private::ProcessInstanceInfo &process_info);
338254721Semaste
339254721Semaste    uint32_t
340254721Semaste    FindProcesses (const lldb_private::ProcessInstanceInfoMatch &process_match_info,
341254721Semaste                   lldb_private::ProcessInstanceInfoList &process_infos);
342254721Semaste
343254721Semaste    bool
344254721Semaste    GetUserName (uint32_t uid, std::string &name);
345254721Semaste
346254721Semaste    bool
347254721Semaste    GetGroupName (uint32_t gid, std::string &name);
348254721Semaste
349254721Semaste    bool
350254721Semaste    HasFullVContSupport ()
351254721Semaste    {
352254721Semaste        return GetVContSupported ('A');
353254721Semaste    }
354254721Semaste
355254721Semaste    bool
356254721Semaste    HasAnyVContSupport ()
357254721Semaste    {
358254721Semaste        return GetVContSupported ('a');
359254721Semaste    }
360254721Semaste
361254721Semaste    bool
362254721Semaste    GetStopReply (StringExtractorGDBRemote &response);
363254721Semaste
364254721Semaste    bool
365254721Semaste    GetThreadStopInfo (lldb::tid_t tid,
366254721Semaste                       StringExtractorGDBRemote &response);
367254721Semaste
368254721Semaste    bool
369254721Semaste    SupportsGDBStoppointPacket (GDBStoppointType type)
370254721Semaste    {
371254721Semaste        switch (type)
372254721Semaste        {
373254721Semaste        case eBreakpointSoftware:   return m_supports_z0;
374254721Semaste        case eBreakpointHardware:   return m_supports_z1;
375254721Semaste        case eWatchpointWrite:      return m_supports_z2;
376254721Semaste        case eWatchpointRead:       return m_supports_z3;
377254721Semaste        case eWatchpointReadWrite:  return m_supports_z4;
378254721Semaste        }
379254721Semaste        return false;
380254721Semaste    }
381254721Semaste    uint8_t
382254721Semaste    SendGDBStoppointTypePacket (GDBStoppointType type,   // Type of breakpoint or watchpoint
383254721Semaste                                bool insert,              // Insert or remove?
384254721Semaste                                lldb::addr_t addr,        // Address of breakpoint or watchpoint
385254721Semaste                                uint32_t length);         // Byte Size of breakpoint or watchpoint
386254721Semaste
387254721Semaste    void
388254721Semaste    TestPacketSpeed (const uint32_t num_packets);
389254721Semaste
390254721Semaste    // This packet is for testing the speed of the interface only. Both
391254721Semaste    // the client and server need to support it, but this allows us to
392254721Semaste    // measure the packet speed without any other work being done on the
393254721Semaste    // other end and avoids any of that work affecting the packet send
394254721Semaste    // and response times.
395254721Semaste    bool
396254721Semaste    SendSpeedTestPacket (uint32_t send_size,
397254721Semaste                         uint32_t recv_size);
398254721Semaste
399254721Semaste    bool
400254721Semaste    SetCurrentThread (uint64_t tid);
401254721Semaste
402254721Semaste    bool
403254721Semaste    SetCurrentThreadForRun (uint64_t tid);
404254721Semaste
405262528Semaste    bool
406276479Sdim    GetQXferAuxvReadSupported ();
407276479Sdim
408276479Sdim    bool
409262528Semaste    GetQXferLibrariesReadSupported ();
410262528Semaste
411262528Semaste    bool
412262528Semaste    GetQXferLibrariesSVR4ReadSupported ();
413262528Semaste
414262528Semaste    uint64_t
415262528Semaste    GetRemoteMaxPacketSize();
416262528Semaste
417262528Semaste    bool
418262528Semaste    GetAugmentedLibrariesSVR4ReadSupported ();
419262528Semaste
420254721Semaste    lldb_private::LazyBool
421254721Semaste    SupportsAllocDeallocMemory () // const
422254721Semaste    {
423254721Semaste        // Uncomment this to have lldb pretend the debug server doesn't respond to alloc/dealloc memory packets.
424254721Semaste        // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
425254721Semaste        return m_supports_alloc_dealloc_memory;
426254721Semaste    }
427254721Semaste
428254721Semaste    size_t
429254721Semaste    GetCurrentThreadIDs (std::vector<lldb::tid_t> &thread_ids,
430254721Semaste                         bool &sequence_mutex_unavailable);
431254721Semaste
432254721Semaste    bool
433254721Semaste    GetInterruptWasSent () const
434254721Semaste    {
435254721Semaste        return m_interrupt_sent;
436254721Semaste    }
437254721Semaste
438258884Semaste    lldb::user_id_t
439258054Semaste    OpenFile (const lldb_private::FileSpec& file_spec,
440258054Semaste              uint32_t flags,
441258054Semaste              mode_t mode,
442258054Semaste              lldb_private::Error &error);
443258054Semaste
444258884Semaste    bool
445258054Semaste    CloseFile (lldb::user_id_t fd,
446258054Semaste               lldb_private::Error &error);
447258054Semaste
448258884Semaste    lldb::user_id_t
449258054Semaste    GetFileSize (const lldb_private::FileSpec& file_spec);
450258054Semaste
451258884Semaste    lldb_private::Error
452258884Semaste    GetFilePermissions(const char *path, uint32_t &file_permissions);
453258054Semaste
454258884Semaste    lldb_private::Error
455258884Semaste    SetFilePermissions(const char *path, uint32_t file_permissions);
456258884Semaste
457258884Semaste    uint64_t
458258054Semaste    ReadFile (lldb::user_id_t fd,
459258054Semaste              uint64_t offset,
460258054Semaste              void *dst,
461258054Semaste              uint64_t dst_len,
462258054Semaste              lldb_private::Error &error);
463258054Semaste
464258884Semaste    uint64_t
465258054Semaste    WriteFile (lldb::user_id_t fd,
466258054Semaste               uint64_t offset,
467258054Semaste               const void* src,
468258054Semaste               uint64_t src_len,
469258054Semaste               lldb_private::Error &error);
470258054Semaste
471258884Semaste    lldb_private::Error
472258884Semaste    CreateSymlink (const char *src,
473258884Semaste                   const char *dst);
474258054Semaste
475258884Semaste    lldb_private::Error
476258884Semaste    Unlink (const char *path);
477258884Semaste
478258884Semaste    lldb_private::Error
479258884Semaste    MakeDirectory (const char *path,
480258884Semaste                   uint32_t mode);
481258884Semaste
482258884Semaste    bool
483258054Semaste    GetFileExists (const lldb_private::FileSpec& file_spec);
484258054Semaste
485258884Semaste    lldb_private::Error
486258054Semaste    RunShellCommand (const char *command,           // Shouldn't be NULL
487258054Semaste                     const char *working_dir,       // Pass NULL to use the current working directory
488258054Semaste                     int *status_ptr,               // Pass NULL if you don't want the process exit status
489258054Semaste                     int *signo_ptr,                // Pass NULL if you don't want the signal that caused the process to exit
490258054Semaste                     std::string *command_output,   // Pass NULL if you don't want the command output
491258054Semaste                     uint32_t timeout_sec);         // Timeout in seconds to wait for shell program to finish
492258054Semaste
493258884Semaste    bool
494258054Semaste    CalculateMD5 (const lldb_private::FileSpec& file_spec,
495258054Semaste                  uint64_t &high,
496258054Semaste                  uint64_t &low);
497258054Semaste
498254721Semaste    std::string
499254721Semaste    HarmonizeThreadIdsForProfileData (ProcessGDBRemote *process,
500254721Semaste                                      StringExtractorGDBRemote &inputStringExtractor);
501258054Semaste
502258884Semaste    bool
503258884Semaste    ReadRegister(lldb::tid_t tid,
504258884Semaste                 uint32_t reg_num,
505258884Semaste                 StringExtractorGDBRemote &response);
506258884Semaste
507258884Semaste    bool
508258884Semaste    ReadAllRegisters (lldb::tid_t tid,
509258884Semaste                      StringExtractorGDBRemote &response);
510258884Semaste
511258884Semaste    bool
512258884Semaste    SaveRegisterState (lldb::tid_t tid, uint32_t &save_id);
513258884Semaste
514258884Semaste    bool
515258884Semaste    RestoreRegisterState (lldb::tid_t tid, uint32_t save_id);
516276479Sdim
517276479Sdim    const char *
518276479Sdim    GetGDBServerProgramName();
519258884Semaste
520276479Sdim    uint32_t
521276479Sdim    GetGDBServerProgramVersion();
522276479Sdim
523276479Sdim    bool
524276479Sdim    AvoidGPackets(ProcessGDBRemote *process);
525276479Sdim
526276479Sdim    bool
527276479Sdim    GetThreadExtendedInfoSupported();
528276479Sdim
529254721Semasteprotected:
530254721Semaste
531262528Semaste    PacketResult
532262528Semaste    SendPacketAndWaitForResponseNoLock (const char *payload,
533262528Semaste                                        size_t payload_length,
534262528Semaste                                        StringExtractorGDBRemote &response);
535262528Semaste
536254721Semaste    bool
537254721Semaste    GetCurrentProcessInfo ();
538254721Semaste
539276479Sdim    bool
540276479Sdim    GetGDBServerVersion();
541276479Sdim
542254721Semaste    //------------------------------------------------------------------
543254721Semaste    // Classes that inherit from GDBRemoteCommunicationClient can see and modify these
544254721Semaste    //------------------------------------------------------------------
545254721Semaste    lldb_private::LazyBool m_supports_not_sending_acks;
546254721Semaste    lldb_private::LazyBool m_supports_thread_suffix;
547254721Semaste    lldb_private::LazyBool m_supports_threads_in_stop_reply;
548254721Semaste    lldb_private::LazyBool m_supports_vCont_all;
549254721Semaste    lldb_private::LazyBool m_supports_vCont_any;
550254721Semaste    lldb_private::LazyBool m_supports_vCont_c;
551254721Semaste    lldb_private::LazyBool m_supports_vCont_C;
552254721Semaste    lldb_private::LazyBool m_supports_vCont_s;
553254721Semaste    lldb_private::LazyBool m_supports_vCont_S;
554254721Semaste    lldb_private::LazyBool m_qHostInfo_is_valid;
555276479Sdim    lldb_private::LazyBool m_curr_pid_is_valid;
556254721Semaste    lldb_private::LazyBool m_qProcessInfo_is_valid;
557276479Sdim    lldb_private::LazyBool m_qGDBServerVersion_is_valid;
558254721Semaste    lldb_private::LazyBool m_supports_alloc_dealloc_memory;
559254721Semaste    lldb_private::LazyBool m_supports_memory_region_info;
560254721Semaste    lldb_private::LazyBool m_supports_watchpoint_support_info;
561254721Semaste    lldb_private::LazyBool m_supports_detach_stay_stopped;
562254721Semaste    lldb_private::LazyBool m_watchpoints_trigger_after_instruction;
563254721Semaste    lldb_private::LazyBool m_attach_or_wait_reply;
564254721Semaste    lldb_private::LazyBool m_prepare_for_reg_writing_reply;
565258054Semaste    lldb_private::LazyBool m_supports_p;
566276479Sdim    lldb_private::LazyBool m_supports_x;
567276479Sdim    lldb_private::LazyBool m_avoid_g_packets;
568258884Semaste    lldb_private::LazyBool m_supports_QSaveRegisterState;
569276479Sdim    lldb_private::LazyBool m_supports_qXfer_auxv_read;
570262528Semaste    lldb_private::LazyBool m_supports_qXfer_libraries_read;
571262528Semaste    lldb_private::LazyBool m_supports_qXfer_libraries_svr4_read;
572262528Semaste    lldb_private::LazyBool m_supports_augmented_libraries_svr4_read;
573276479Sdim    lldb_private::LazyBool m_supports_jThreadExtendedInfo;
574262528Semaste
575254721Semaste    bool
576254721Semaste        m_supports_qProcessInfoPID:1,
577254721Semaste        m_supports_qfProcessInfo:1,
578254721Semaste        m_supports_qUserName:1,
579254721Semaste        m_supports_qGroupName:1,
580254721Semaste        m_supports_qThreadStopInfo:1,
581254721Semaste        m_supports_z0:1,
582254721Semaste        m_supports_z1:1,
583254721Semaste        m_supports_z2:1,
584254721Semaste        m_supports_z3:1,
585258054Semaste        m_supports_z4:1,
586258054Semaste        m_supports_QEnvironment:1,
587258054Semaste        m_supports_QEnvironmentHexEncoded:1;
588254721Semaste
589276479Sdim    lldb::pid_t m_curr_pid;
590254721Semaste    lldb::tid_t m_curr_tid;         // Current gdb remote protocol thread index for all other operations
591254721Semaste    lldb::tid_t m_curr_tid_run;     // Current gdb remote protocol thread index for continue, step, etc
592254721Semaste
593254721Semaste
594254721Semaste    uint32_t m_num_supported_hardware_watchpoints;
595254721Semaste
596254721Semaste    // If we need to send a packet while the target is running, the m_async_XXX
597254721Semaste    // member variables take care of making this happen.
598254721Semaste    lldb_private::Mutex m_async_mutex;
599254721Semaste    lldb_private::Predicate<bool> m_async_packet_predicate;
600254721Semaste    std::string m_async_packet;
601262528Semaste    PacketResult m_async_result;
602254721Semaste    StringExtractorGDBRemote m_async_response;
603254721Semaste    int m_async_signal; // We were asked to deliver a signal to the inferior process.
604254721Semaste    bool m_interrupt_sent;
605254721Semaste    std::string m_partial_profile_data;
606254721Semaste    std::map<uint64_t, uint32_t> m_thread_id_to_used_usec_map;
607254721Semaste
608254721Semaste    lldb_private::ArchSpec m_host_arch;
609254721Semaste    lldb_private::ArchSpec m_process_arch;
610254721Semaste    uint32_t m_os_version_major;
611254721Semaste    uint32_t m_os_version_minor;
612254721Semaste    uint32_t m_os_version_update;
613254721Semaste    std::string m_os_build;
614254721Semaste    std::string m_os_kernel;
615254721Semaste    std::string m_hostname;
616276479Sdim    std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if qGDBServerVersion is not supported
617276479Sdim    uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if qGDBServerVersion is not supported
618258054Semaste    uint32_t m_default_packet_timeout;
619262528Semaste    uint64_t m_max_packet_size;  // as returned by qSupported
620254721Semaste
621254721Semaste    bool
622254721Semaste    DecodeProcessInfoResponse (StringExtractorGDBRemote &response,
623254721Semaste                               lldb_private::ProcessInstanceInfo &process_info);
624254721Semasteprivate:
625254721Semaste    //------------------------------------------------------------------
626254721Semaste    // For GDBRemoteCommunicationClient only
627254721Semaste    //------------------------------------------------------------------
628254721Semaste    DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient);
629254721Semaste};
630254721Semaste
631254721Semaste#endif  // liblldb_GDBRemoteCommunicationClient_h_
632