blob: a1e982b3ec4e9d0d206c316fa646138bd0c1423c [file] [log] [blame]
Greg Clayton576d8832011-03-22 04:00:09 +00001//===-- GDBRemoteCommunicationClient.h --------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_GDBRemoteCommunicationClient_h_
11#define liblldb_GDBRemoteCommunicationClient_h_
12
13// C Includes
14// C++ Includes
Greg Claytonadc00cb2011-05-20 23:38:13 +000015#include <vector>
16
Greg Clayton576d8832011-03-22 04:00:09 +000017// Other libraries and framework includes
18// Project includes
19#include "lldb/Core/ArchSpec.h"
Greg Clayton46fb5582011-11-18 07:03:08 +000020#include "lldb/Target/Process.h"
Greg Clayton576d8832011-03-22 04:00:09 +000021
22#include "GDBRemoteCommunication.h"
23
Greg Clayton8b82f082011-04-12 05:54:46 +000024typedef enum
25{
26 eBreakpointSoftware = 0,
27 eBreakpointHardware,
28 eWatchpointWrite,
29 eWatchpointRead,
30 eWatchpointReadWrite
31} GDBStoppointType;
32
Greg Clayton576d8832011-03-22 04:00:09 +000033class GDBRemoteCommunicationClient : public GDBRemoteCommunication
34{
35public:
36 //------------------------------------------------------------------
37 // Constructors and Destructors
38 //------------------------------------------------------------------
Greg Clayton8b82f082011-04-12 05:54:46 +000039 GDBRemoteCommunicationClient(bool is_platform);
Greg Clayton576d8832011-03-22 04:00:09 +000040
Greg Clayton576d8832011-03-22 04:00:09 +000041 ~GDBRemoteCommunicationClient();
42
Greg Clayton1cb64962011-03-24 04:28:38 +000043 //------------------------------------------------------------------
44 // After connecting, send the handshake to the server to make sure
45 // we are communicating with it.
46 //------------------------------------------------------------------
47 bool
48 HandshakeWithServer (lldb_private::Error *error_ptr);
49
Greg Clayton3dedae12013-12-06 21:45:27 +000050 PacketResult
Greg Clayton576d8832011-03-22 04:00:09 +000051 SendPacketAndWaitForResponse (const char *send_payload,
52 StringExtractorGDBRemote &response,
53 bool send_async);
54
Greg Clayton3dedae12013-12-06 21:45:27 +000055 PacketResult
Greg Clayton576d8832011-03-22 04:00:09 +000056 SendPacketAndWaitForResponse (const char *send_payload,
57 size_t send_length,
58 StringExtractorGDBRemote &response,
59 bool send_async);
60
Steve Pucci5ae54ae2014-01-25 05:46:51 +000061 // For packets which specify a range of output to be returned,
62 // return all of the output via a series of request packets of the form
63 // <prefix>0,<size>
64 // <prefix><size>,<size>
65 // <prefix><size>*2,<size>
66 // <prefix><size>*3,<size>
67 // ...
68 // until a "$l..." packet is received, indicating the end.
69 // (size is in hex; this format is used by a standard gdbserver to
70 // return the given portion of the output specified by <prefix>;
71 // for example, "qXfer:libraries-svr4:read::fff,1000" means
72 // "return a chunk of the xml description file for shared
73 // library load addresses, where the chunk starts at offset 0xfff
74 // and continues for 0x1000 bytes").
75 // Concatenate the resulting server response packets together and
76 // return in response_string. If any packet fails, the return value
77 // indicates that failure and the returned string value is undefined.
78 PacketResult
79 SendPacketsAndConcatenateResponses (const char *send_payload_prefix,
80 std::string &response_string);
81
Greg Clayton576d8832011-03-22 04:00:09 +000082 lldb::StateType
83 SendContinuePacketAndWaitForResponse (ProcessGDBRemote *process,
84 const char *packet_payload,
85 size_t packet_length,
86 StringExtractorGDBRemote &response);
87
Greg Claytonfbb76342013-11-20 21:07:01 +000088 bool
Greg Clayton576d8832011-03-22 04:00:09 +000089 GetThreadSuffixSupported ();
90
Greg Claytonfb909312013-11-23 01:58:15 +000091 // This packet is usually sent first and the boolean return value
92 // indicates if the packet was send and any response was received
93 // even in the response is UNIMPLEMENTED. If the packet failed to
94 // get a response, then false is returned. This quickly tells us
95 // if we were able to connect and communicte with the remote GDB
96 // server
97 bool
Greg Clayton1cb64962011-03-24 04:28:38 +000098 QueryNoAckModeSupported ();
Greg Clayton576d8832011-03-22 04:00:09 +000099
Greg Clayton44633992012-04-10 03:22:03 +0000100 void
101 GetListThreadsInStopReplySupported ();
102
Greg Clayton576d8832011-03-22 04:00:09 +0000103 bool
104 SendAsyncSignal (int signo);
105
106 bool
107 SendInterrupt (lldb_private::Mutex::Locker &locker,
108 uint32_t seconds_to_wait_for_stop,
Greg Clayton576d8832011-03-22 04:00:09 +0000109 bool &timed_out);
110
111 lldb::pid_t
112 GetCurrentProcessID ();
113
114 bool
115 GetLaunchSuccess (std::string &error_str);
116
Greg Clayton8b82f082011-04-12 05:54:46 +0000117 uint16_t
Greg Claytondbf04572013-12-04 19:40:33 +0000118 LaunchGDBserverAndGetPort (lldb::pid_t &pid, const char *remote_accept_hostname);
Daniel Maleae0f8f572013-08-26 23:57:52 +0000119
120 bool
121 KillSpawnedProcess (lldb::pid_t pid);
Greg Clayton8b82f082011-04-12 05:54:46 +0000122
Greg Clayton576d8832011-03-22 04:00:09 +0000123 //------------------------------------------------------------------
124 /// Sends a GDB remote protocol 'A' packet that delivers program
125 /// arguments to the remote server.
126 ///
127 /// @param[in] argv
128 /// A NULL terminated array of const C strings to use as the
129 /// arguments.
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 //------------------------------------------------------------------
137 int
Greg Claytonfbb76342013-11-20 21:07:01 +0000138 SendArgumentsPacket (const lldb_private::ProcessLaunchInfo &launch_info);
Greg Clayton576d8832011-03-22 04:00:09 +0000139
140 //------------------------------------------------------------------
141 /// Sends a "QEnvironment:NAME=VALUE" packet that will build up the
142 /// environment that will get used when launching an application
143 /// in conjunction with the 'A' packet. This function can be called
144 /// multiple times in a row in order to pass on the desired
145 /// environment that the inferior should be launched with.
146 ///
147 /// @param[in] name_equal_value
148 /// A NULL terminated C string that contains a single environment
149 /// in the format "NAME=VALUE".
150 ///
151 /// @return
152 /// Zero if the response was "OK", a positive value if the
153 /// the response was "Exx" where xx are two hex digits, or
154 /// -1 if the call is unsupported or any other unexpected
155 /// response was received.
156 //------------------------------------------------------------------
157 int
158 SendEnvironmentPacket (char const *name_equal_value);
159
Greg Claytonc4103b32011-05-08 04:53:50 +0000160 int
161 SendLaunchArchPacket (const char *arch);
Greg Clayton576d8832011-03-22 04:00:09 +0000162 //------------------------------------------------------------------
163 /// Sends a "vAttach:PID" where PID is in hex.
164 ///
165 /// @param[in] pid
166 /// A process ID for the remote gdb server to attach to.
167 ///
168 /// @param[out] response
169 /// The response received from the gdb server. If the return
170 /// value is zero, \a response will contain a stop reply
171 /// packet.
172 ///
173 /// @return
174 /// Zero if the attach was successful, or an error indicating
175 /// an error code.
176 //------------------------------------------------------------------
177 int
178 SendAttach (lldb::pid_t pid,
179 StringExtractorGDBRemote& response);
180
181
182 //------------------------------------------------------------------
183 /// Sets the path to use for stdin/out/err for a process
184 /// that will be launched with the 'A' packet.
185 ///
186 /// @param[in] path
187 /// The path to use for stdin/out/err
188 ///
189 /// @return
190 /// Zero if the for success, or an error code for failure.
191 //------------------------------------------------------------------
192 int
193 SetSTDIN (char const *path);
194 int
195 SetSTDOUT (char const *path);
196 int
197 SetSTDERR (char const *path);
198
199 //------------------------------------------------------------------
200 /// Sets the disable ASLR flag to \a enable for a process that will
201 /// be launched with the 'A' packet.
202 ///
203 /// @param[in] enable
204 /// A boolean value indicating wether to disable ASLR or not.
205 ///
206 /// @return
207 /// Zero if the for success, or an error code for failure.
208 //------------------------------------------------------------------
209 int
210 SetDisableASLR (bool enable);
211
212 //------------------------------------------------------------------
213 /// Sets the working directory to \a path for a process that will
Greg Claytonfbb76342013-11-20 21:07:01 +0000214 /// be launched with the 'A' packet for non platform based
215 /// connections. If this packet is sent to a GDB server that
216 /// implements the platform, it will change the current working
217 /// directory for the platform process.
Greg Clayton576d8832011-03-22 04:00:09 +0000218 ///
219 /// @param[in] path
220 /// The path to a directory to use when launching our processs
221 ///
222 /// @return
223 /// Zero if the for success, or an error code for failure.
224 //------------------------------------------------------------------
225 int
226 SetWorkingDir (char const *path);
227
Greg Claytonfbb76342013-11-20 21:07:01 +0000228 //------------------------------------------------------------------
229 /// Gets the current working directory of a remote platform GDB
230 /// server.
231 ///
232 /// @param[out] cwd
233 /// The current working directory on the remote platform.
234 ///
235 /// @return
236 /// Boolean for success
237 //------------------------------------------------------------------
238 bool
239 GetWorkingDir (std::string &cwd);
240
Greg Clayton576d8832011-03-22 04:00:09 +0000241 lldb::addr_t
242 AllocateMemory (size_t size, uint32_t permissions);
243
244 bool
245 DeallocateMemory (lldb::addr_t addr);
246
Jim Inghamacff8952013-05-02 00:27:30 +0000247 lldb_private::Error
248 Detach (bool keep_stopped);
Greg Clayton37a0a242012-04-11 00:24:49 +0000249
Greg Clayton46fb5582011-11-18 07:03:08 +0000250 lldb_private::Error
251 GetMemoryRegionInfo (lldb::addr_t addr,
252 lldb_private::MemoryRegionInfo &range_info);
253
Johnny Chen64637202012-05-23 21:09:52 +0000254 lldb_private::Error
255 GetWatchpointSupportInfo (uint32_t &num);
256
Enrico Granataf04a2192012-07-13 23:18:48 +0000257 lldb_private::Error
258 GetWatchpointSupportInfo (uint32_t &num, bool& after);
259
260 lldb_private::Error
261 GetWatchpointsTriggerAfterInstruction (bool &after);
262
Greg Clayton576d8832011-03-22 04:00:09 +0000263 const lldb_private::ArchSpec &
264 GetHostArchitecture ();
Greg Clayton9ac6d2d2013-10-25 18:13:17 +0000265
266 uint32_t
267 GetHostDefaultPacketTimeout();
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000268
269 const lldb_private::ArchSpec &
270 GetProcessArchitecture ();
271
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000272 void
273 GetRemoteQSupported();
274
Greg Clayton576d8832011-03-22 04:00:09 +0000275 bool
276 GetVContSupported (char flavor);
277
Jim Inghamcd16df92012-07-20 21:37:13 +0000278 bool
Sean Callananb1de1142013-09-04 23:24:15 +0000279 GetpPacketSupported (lldb::tid_t tid);
Hafiz Abid Qadeer9a78cdf2013-08-29 09:09:45 +0000280
281 bool
Jim Inghamcd16df92012-07-20 21:37:13 +0000282 GetVAttachOrWaitSupported ();
283
Jim Ingham279ceec2012-07-25 21:12:43 +0000284 bool
285 GetSyncThreadStateSupported();
286
Greg Clayton576d8832011-03-22 04:00:09 +0000287 void
288 ResetDiscoverableSettings();
289
290 bool
Greg Clayton9b1e1cd2011-04-04 18:18:57 +0000291 GetHostInfo (bool force = false);
Greg Clayton576d8832011-03-22 04:00:09 +0000292
293 bool
Greg Clayton1cb64962011-03-24 04:28:38 +0000294 GetOSVersion (uint32_t &major,
295 uint32_t &minor,
296 uint32_t &update);
297
298 bool
299 GetOSBuildString (std::string &s);
300
301 bool
302 GetOSKernelDescription (std::string &s);
303
304 lldb_private::ArchSpec
305 GetSystemArchitecture ();
306
307 bool
308 GetHostname (std::string &s);
309
Greg Clayton37a0a242012-04-11 00:24:49 +0000310 lldb::addr_t
311 GetShlibInfoAddr();
312
Greg Clayton1cb64962011-03-24 04:28:38 +0000313 bool
Greg Clayton576d8832011-03-22 04:00:09 +0000314 GetSupportsThreadSuffix ();
315
316 bool
Greg Clayton32e0a752011-03-30 18:16:51 +0000317 GetProcessInfo (lldb::pid_t pid,
Greg Clayton8b82f082011-04-12 05:54:46 +0000318 lldb_private::ProcessInstanceInfo &process_info);
Greg Clayton32e0a752011-03-30 18:16:51 +0000319
320 uint32_t
Greg Clayton8b82f082011-04-12 05:54:46 +0000321 FindProcesses (const lldb_private::ProcessInstanceInfoMatch &process_match_info,
322 lldb_private::ProcessInstanceInfoList &process_infos);
Greg Clayton32e0a752011-03-30 18:16:51 +0000323
324 bool
325 GetUserName (uint32_t uid, std::string &name);
326
327 bool
328 GetGroupName (uint32_t gid, std::string &name);
329
330 bool
Greg Clayton576d8832011-03-22 04:00:09 +0000331 HasFullVContSupport ()
332 {
333 return GetVContSupported ('A');
334 }
335
336 bool
337 HasAnyVContSupport ()
338 {
339 return GetVContSupported ('a');
340 }
341
Greg Clayton8b82f082011-04-12 05:54:46 +0000342 bool
343 GetStopReply (StringExtractorGDBRemote &response);
344
345 bool
Greg Claytonf402f782012-10-13 02:11:55 +0000346 GetThreadStopInfo (lldb::tid_t tid,
Greg Clayton8b82f082011-04-12 05:54:46 +0000347 StringExtractorGDBRemote &response);
348
349 bool
350 SupportsGDBStoppointPacket (GDBStoppointType type)
351 {
352 switch (type)
353 {
354 case eBreakpointSoftware: return m_supports_z0;
355 case eBreakpointHardware: return m_supports_z1;
356 case eWatchpointWrite: return m_supports_z2;
357 case eWatchpointRead: return m_supports_z3;
358 case eWatchpointReadWrite: return m_supports_z4;
Greg Clayton8b82f082011-04-12 05:54:46 +0000359 }
360 return false;
361 }
362 uint8_t
363 SendGDBStoppointTypePacket (GDBStoppointType type, // Type of breakpoint or watchpoint
364 bool insert, // Insert or remove?
365 lldb::addr_t addr, // Address of breakpoint or watchpoint
366 uint32_t length); // Byte Size of breakpoint or watchpoint
367
Greg Clayton9b1e1cd2011-04-04 18:18:57 +0000368 void
369 TestPacketSpeed (const uint32_t num_packets);
370
371 // This packet is for testing the speed of the interface only. Both
372 // the client and server need to support it, but this allows us to
373 // measure the packet speed without any other work being done on the
374 // other end and avoids any of that work affecting the packet send
375 // and response times.
376 bool
377 SendSpeedTestPacket (uint32_t send_size,
378 uint32_t recv_size);
Greg Clayton8b82f082011-04-12 05:54:46 +0000379
380 bool
Jason Molendae9ca4af2013-02-23 02:04:45 +0000381 SetCurrentThread (uint64_t tid);
Greg Clayton8b82f082011-04-12 05:54:46 +0000382
383 bool
Jason Molendae9ca4af2013-02-23 02:04:45 +0000384 SetCurrentThreadForRun (uint64_t tid);
Greg Clayton8b82f082011-04-12 05:54:46 +0000385
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000386 bool
387 GetQXferLibrariesReadSupported ();
388
389 bool
390 GetQXferLibrariesSVR4ReadSupported ();
391
392 uint64_t
393 GetRemoteMaxPacketSize();
394
395 bool
396 GetAugmentedLibrariesSVR4ReadSupported ();
397
Greg Clayton2a48f522011-05-14 01:50:35 +0000398 lldb_private::LazyBool
Jim Ingham372787f2012-04-07 00:00:41 +0000399 SupportsAllocDeallocMemory () // const
Greg Clayton2a48f522011-05-14 01:50:35 +0000400 {
Jim Ingham372787f2012-04-07 00:00:41 +0000401 // Uncomment this to have lldb pretend the debug server doesn't respond to alloc/dealloc memory packets.
402 // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
Greg Clayton70b57652011-05-15 01:25:55 +0000403 return m_supports_alloc_dealloc_memory;
Greg Clayton2a48f522011-05-14 01:50:35 +0000404 }
405
Greg Claytonadc00cb2011-05-20 23:38:13 +0000406 size_t
407 GetCurrentThreadIDs (std::vector<lldb::tid_t> &thread_ids,
408 bool &sequence_mutex_unavailable);
409
Greg Clayton2687cd12012-03-29 01:55:41 +0000410 bool
411 GetInterruptWasSent () const
412 {
413 return m_interrupt_sent;
414 }
Han Ming Ong4b6459f2013-01-18 23:11:53 +0000415
Greg Claytonfbb76342013-11-20 21:07:01 +0000416 lldb::user_id_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000417 OpenFile (const lldb_private::FileSpec& file_spec,
418 uint32_t flags,
419 mode_t mode,
420 lldb_private::Error &error);
421
Greg Claytonfbb76342013-11-20 21:07:01 +0000422 bool
Daniel Maleae0f8f572013-08-26 23:57:52 +0000423 CloseFile (lldb::user_id_t fd,
424 lldb_private::Error &error);
425
Greg Claytonfbb76342013-11-20 21:07:01 +0000426 lldb::user_id_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000427 GetFileSize (const lldb_private::FileSpec& file_spec);
428
Greg Claytonfbb76342013-11-20 21:07:01 +0000429 lldb_private::Error
430 GetFilePermissions(const char *path, uint32_t &file_permissions);
Daniel Maleae0f8f572013-08-26 23:57:52 +0000431
Greg Claytonfbb76342013-11-20 21:07:01 +0000432 lldb_private::Error
433 SetFilePermissions(const char *path, uint32_t file_permissions);
434
435 uint64_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000436 ReadFile (lldb::user_id_t fd,
437 uint64_t offset,
438 void *dst,
439 uint64_t dst_len,
440 lldb_private::Error &error);
441
Greg Claytonfbb76342013-11-20 21:07:01 +0000442 uint64_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000443 WriteFile (lldb::user_id_t fd,
444 uint64_t offset,
445 const void* src,
446 uint64_t src_len,
447 lldb_private::Error &error);
448
Greg Claytonfbb76342013-11-20 21:07:01 +0000449 lldb_private::Error
450 CreateSymlink (const char *src,
451 const char *dst);
Daniel Maleae0f8f572013-08-26 23:57:52 +0000452
Greg Claytonfbb76342013-11-20 21:07:01 +0000453 lldb_private::Error
454 Unlink (const char *path);
455
456 lldb_private::Error
457 MakeDirectory (const char *path,
458 uint32_t mode);
459
460 bool
Daniel Maleae0f8f572013-08-26 23:57:52 +0000461 GetFileExists (const lldb_private::FileSpec& file_spec);
462
Greg Claytonfbb76342013-11-20 21:07:01 +0000463 lldb_private::Error
Daniel Maleae0f8f572013-08-26 23:57:52 +0000464 RunShellCommand (const char *command, // Shouldn't be NULL
465 const char *working_dir, // Pass NULL to use the current working directory
466 int *status_ptr, // Pass NULL if you don't want the process exit status
467 int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
468 std::string *command_output, // Pass NULL if you don't want the command output
469 uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
470
Greg Claytonfbb76342013-11-20 21:07:01 +0000471 bool
Daniel Maleae0f8f572013-08-26 23:57:52 +0000472 CalculateMD5 (const lldb_private::FileSpec& file_spec,
473 uint64_t &high,
474 uint64_t &low);
475
Han Ming Ong4b6459f2013-01-18 23:11:53 +0000476 std::string
477 HarmonizeThreadIdsForProfileData (ProcessGDBRemote *process,
478 StringExtractorGDBRemote &inputStringExtractor);
Daniel Maleae0f8f572013-08-26 23:57:52 +0000479
Greg Claytonf74cf862013-11-13 23:28:31 +0000480 bool
481 ReadRegister(lldb::tid_t tid,
482 uint32_t reg_num,
483 StringExtractorGDBRemote &response);
484
485 bool
486 ReadAllRegisters (lldb::tid_t tid,
487 StringExtractorGDBRemote &response);
488
489 bool
490 SaveRegisterState (lldb::tid_t tid, uint32_t &save_id);
491
492 bool
493 RestoreRegisterState (lldb::tid_t tid, uint32_t save_id);
494
Greg Clayton576d8832011-03-22 04:00:09 +0000495protected:
496
Greg Clayton3dedae12013-12-06 21:45:27 +0000497 PacketResult
498 SendPacketAndWaitForResponseNoLock (const char *payload,
499 size_t payload_length,
500 StringExtractorGDBRemote &response);
501
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000502 bool
503 GetCurrentProcessInfo ();
504
Greg Clayton576d8832011-03-22 04:00:09 +0000505 //------------------------------------------------------------------
506 // Classes that inherit from GDBRemoteCommunicationClient can see and modify these
507 //------------------------------------------------------------------
Greg Claytone0d378b2011-03-24 21:19:54 +0000508 lldb_private::LazyBool m_supports_not_sending_acks;
509 lldb_private::LazyBool m_supports_thread_suffix;
Greg Clayton44633992012-04-10 03:22:03 +0000510 lldb_private::LazyBool m_supports_threads_in_stop_reply;
Greg Claytone0d378b2011-03-24 21:19:54 +0000511 lldb_private::LazyBool m_supports_vCont_all;
512 lldb_private::LazyBool m_supports_vCont_any;
513 lldb_private::LazyBool m_supports_vCont_c;
514 lldb_private::LazyBool m_supports_vCont_C;
515 lldb_private::LazyBool m_supports_vCont_s;
516 lldb_private::LazyBool m_supports_vCont_S;
Greg Clayton32e0a752011-03-30 18:16:51 +0000517 lldb_private::LazyBool m_qHostInfo_is_valid;
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000518 lldb_private::LazyBool m_qProcessInfo_is_valid;
Greg Clayton70b57652011-05-15 01:25:55 +0000519 lldb_private::LazyBool m_supports_alloc_dealloc_memory;
Greg Clayton46fb5582011-11-18 07:03:08 +0000520 lldb_private::LazyBool m_supports_memory_region_info;
Johnny Chen64637202012-05-23 21:09:52 +0000521 lldb_private::LazyBool m_supports_watchpoint_support_info;
Jim Inghamacff8952013-05-02 00:27:30 +0000522 lldb_private::LazyBool m_supports_detach_stay_stopped;
Enrico Granataf04a2192012-07-13 23:18:48 +0000523 lldb_private::LazyBool m_watchpoints_trigger_after_instruction;
Jim Inghamcd16df92012-07-20 21:37:13 +0000524 lldb_private::LazyBool m_attach_or_wait_reply;
Jim Ingham279ceec2012-07-25 21:12:43 +0000525 lldb_private::LazyBool m_prepare_for_reg_writing_reply;
Hafiz Abid Qadeer9a78cdf2013-08-29 09:09:45 +0000526 lldb_private::LazyBool m_supports_p;
Greg Claytonf74cf862013-11-13 23:28:31 +0000527 lldb_private::LazyBool m_supports_QSaveRegisterState;
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000528 lldb_private::LazyBool m_supports_qXfer_libraries_read;
529 lldb_private::LazyBool m_supports_qXfer_libraries_svr4_read;
530 lldb_private::LazyBool m_supports_augmented_libraries_svr4_read;
531
Greg Clayton8b82f082011-04-12 05:54:46 +0000532 bool
533 m_supports_qProcessInfoPID:1,
534 m_supports_qfProcessInfo:1,
535 m_supports_qUserName:1,
536 m_supports_qGroupName:1,
537 m_supports_qThreadStopInfo:1,
538 m_supports_z0:1,
539 m_supports_z1:1,
540 m_supports_z2:1,
541 m_supports_z3:1,
Greg Clayton89600582013-10-10 17:53:50 +0000542 m_supports_z4:1,
543 m_supports_QEnvironment:1,
544 m_supports_QEnvironmentHexEncoded:1;
Greg Clayton2a48f522011-05-14 01:50:35 +0000545
Greg Clayton8b82f082011-04-12 05:54:46 +0000546
547 lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all other operations
548 lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for continue, step, etc
549
Greg Clayton576d8832011-03-22 04:00:09 +0000550
Johnny Chen64637202012-05-23 21:09:52 +0000551 uint32_t m_num_supported_hardware_watchpoints;
552
Greg Clayton576d8832011-03-22 04:00:09 +0000553 // If we need to send a packet while the target is running, the m_async_XXX
554 // member variables take care of making this happen.
555 lldb_private::Mutex m_async_mutex;
556 lldb_private::Predicate<bool> m_async_packet_predicate;
557 std::string m_async_packet;
Jim Inghama6195b72013-12-18 01:24:33 +0000558 PacketResult m_async_result;
Greg Clayton576d8832011-03-22 04:00:09 +0000559 StringExtractorGDBRemote m_async_response;
560 int m_async_signal; // We were asked to deliver a signal to the inferior process.
Greg Clayton2687cd12012-03-29 01:55:41 +0000561 bool m_interrupt_sent;
Han Ming Ong4b6459f2013-01-18 23:11:53 +0000562 std::string m_partial_profile_data;
563 std::map<uint64_t, uint32_t> m_thread_id_to_used_usec_map;
Greg Clayton576d8832011-03-22 04:00:09 +0000564
Greg Claytond314e812011-03-23 00:09:55 +0000565 lldb_private::ArchSpec m_host_arch;
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000566 lldb_private::ArchSpec m_process_arch;
Greg Clayton1cb64962011-03-24 04:28:38 +0000567 uint32_t m_os_version_major;
568 uint32_t m_os_version_minor;
569 uint32_t m_os_version_update;
570 std::string m_os_build;
571 std::string m_os_kernel;
572 std::string m_hostname;
Greg Clayton9ac6d2d2013-10-25 18:13:17 +0000573 uint32_t m_default_packet_timeout;
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000574 uint64_t m_max_packet_size; // as returned by qSupported
Greg Clayton576d8832011-03-22 04:00:09 +0000575
Greg Clayton32e0a752011-03-30 18:16:51 +0000576 bool
577 DecodeProcessInfoResponse (StringExtractorGDBRemote &response,
Greg Clayton8b82f082011-04-12 05:54:46 +0000578 lldb_private::ProcessInstanceInfo &process_info);
Greg Clayton576d8832011-03-22 04:00:09 +0000579private:
580 //------------------------------------------------------------------
581 // For GDBRemoteCommunicationClient only
582 //------------------------------------------------------------------
583 DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient);
584};
585
586#endif // liblldb_GDBRemoteCommunicationClient_h_