blob: 6b1aec53928f95a81c18435de00ba53a0d134d40 [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);
Jason Molendaa3329782014-03-29 18:54:20 +0000162
163 int
164 SendLaunchEventDataPacket (const char *data, bool *was_supported = NULL);
165
Greg Clayton576d8832011-03-22 04:00:09 +0000166 //------------------------------------------------------------------
167 /// Sends a "vAttach:PID" where PID is in hex.
168 ///
169 /// @param[in] pid
170 /// A process ID for the remote gdb server to attach to.
171 ///
172 /// @param[out] response
173 /// The response received from the gdb server. If the return
174 /// value is zero, \a response will contain a stop reply
175 /// packet.
176 ///
177 /// @return
178 /// Zero if the attach was successful, or an error indicating
179 /// an error code.
180 //------------------------------------------------------------------
181 int
182 SendAttach (lldb::pid_t pid,
183 StringExtractorGDBRemote& response);
184
185
186 //------------------------------------------------------------------
187 /// Sets the path to use for stdin/out/err for a process
188 /// that will be launched with the 'A' packet.
189 ///
190 /// @param[in] path
191 /// The path to use for stdin/out/err
192 ///
193 /// @return
194 /// Zero if the for success, or an error code for failure.
195 //------------------------------------------------------------------
196 int
197 SetSTDIN (char const *path);
198 int
199 SetSTDOUT (char const *path);
200 int
201 SetSTDERR (char const *path);
202
203 //------------------------------------------------------------------
204 /// Sets the disable ASLR flag to \a enable for a process that will
205 /// be launched with the 'A' packet.
206 ///
207 /// @param[in] enable
208 /// A boolean value indicating wether to disable ASLR or not.
209 ///
210 /// @return
211 /// Zero if the for success, or an error code for failure.
212 //------------------------------------------------------------------
213 int
214 SetDisableASLR (bool enable);
215
216 //------------------------------------------------------------------
217 /// Sets the working directory to \a path for a process that will
Greg Claytonfbb76342013-11-20 21:07:01 +0000218 /// be launched with the 'A' packet for non platform based
219 /// connections. If this packet is sent to a GDB server that
220 /// implements the platform, it will change the current working
221 /// directory for the platform process.
Greg Clayton576d8832011-03-22 04:00:09 +0000222 ///
223 /// @param[in] path
224 /// The path to a directory to use when launching our processs
225 ///
226 /// @return
227 /// Zero if the for success, or an error code for failure.
228 //------------------------------------------------------------------
229 int
230 SetWorkingDir (char const *path);
231
Greg Claytonfbb76342013-11-20 21:07:01 +0000232 //------------------------------------------------------------------
233 /// Gets the current working directory of a remote platform GDB
234 /// server.
235 ///
236 /// @param[out] cwd
237 /// The current working directory on the remote platform.
238 ///
239 /// @return
240 /// Boolean for success
241 //------------------------------------------------------------------
242 bool
243 GetWorkingDir (std::string &cwd);
244
Greg Clayton576d8832011-03-22 04:00:09 +0000245 lldb::addr_t
246 AllocateMemory (size_t size, uint32_t permissions);
247
248 bool
249 DeallocateMemory (lldb::addr_t addr);
250
Jim Inghamacff8952013-05-02 00:27:30 +0000251 lldb_private::Error
252 Detach (bool keep_stopped);
Greg Clayton37a0a242012-04-11 00:24:49 +0000253
Greg Clayton46fb5582011-11-18 07:03:08 +0000254 lldb_private::Error
255 GetMemoryRegionInfo (lldb::addr_t addr,
256 lldb_private::MemoryRegionInfo &range_info);
257
Johnny Chen64637202012-05-23 21:09:52 +0000258 lldb_private::Error
259 GetWatchpointSupportInfo (uint32_t &num);
260
Enrico Granataf04a2192012-07-13 23:18:48 +0000261 lldb_private::Error
262 GetWatchpointSupportInfo (uint32_t &num, bool& after);
263
264 lldb_private::Error
265 GetWatchpointsTriggerAfterInstruction (bool &after);
266
Greg Clayton576d8832011-03-22 04:00:09 +0000267 const lldb_private::ArchSpec &
268 GetHostArchitecture ();
Greg Clayton9ac6d2d2013-10-25 18:13:17 +0000269
270 uint32_t
271 GetHostDefaultPacketTimeout();
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000272
273 const lldb_private::ArchSpec &
274 GetProcessArchitecture ();
275
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000276 void
277 GetRemoteQSupported();
278
Greg Clayton576d8832011-03-22 04:00:09 +0000279 bool
280 GetVContSupported (char flavor);
281
Jim Inghamcd16df92012-07-20 21:37:13 +0000282 bool
Sean Callananb1de1142013-09-04 23:24:15 +0000283 GetpPacketSupported (lldb::tid_t tid);
Hafiz Abid Qadeer9a78cdf2013-08-29 09:09:45 +0000284
285 bool
Jason Molendabdc4f122014-05-06 02:59:39 +0000286 GetxPacketSupported ();
287
288 bool
Jim Inghamcd16df92012-07-20 21:37:13 +0000289 GetVAttachOrWaitSupported ();
290
Jim Ingham279ceec2012-07-25 21:12:43 +0000291 bool
292 GetSyncThreadStateSupported();
293
Greg Clayton576d8832011-03-22 04:00:09 +0000294 void
295 ResetDiscoverableSettings();
296
297 bool
Greg Clayton9b1e1cd2011-04-04 18:18:57 +0000298 GetHostInfo (bool force = false);
Greg Clayton576d8832011-03-22 04:00:09 +0000299
300 bool
Greg Clayton1cb64962011-03-24 04:28:38 +0000301 GetOSVersion (uint32_t &major,
302 uint32_t &minor,
303 uint32_t &update);
304
305 bool
306 GetOSBuildString (std::string &s);
307
308 bool
309 GetOSKernelDescription (std::string &s);
310
311 lldb_private::ArchSpec
312 GetSystemArchitecture ();
313
314 bool
315 GetHostname (std::string &s);
316
Greg Clayton37a0a242012-04-11 00:24:49 +0000317 lldb::addr_t
318 GetShlibInfoAddr();
319
Greg Clayton1cb64962011-03-24 04:28:38 +0000320 bool
Greg Clayton576d8832011-03-22 04:00:09 +0000321 GetSupportsThreadSuffix ();
322
323 bool
Greg Clayton32e0a752011-03-30 18:16:51 +0000324 GetProcessInfo (lldb::pid_t pid,
Greg Clayton8b82f082011-04-12 05:54:46 +0000325 lldb_private::ProcessInstanceInfo &process_info);
Greg Clayton32e0a752011-03-30 18:16:51 +0000326
327 uint32_t
Greg Clayton8b82f082011-04-12 05:54:46 +0000328 FindProcesses (const lldb_private::ProcessInstanceInfoMatch &process_match_info,
329 lldb_private::ProcessInstanceInfoList &process_infos);
Greg Clayton32e0a752011-03-30 18:16:51 +0000330
331 bool
332 GetUserName (uint32_t uid, std::string &name);
333
334 bool
335 GetGroupName (uint32_t gid, std::string &name);
336
337 bool
Greg Clayton576d8832011-03-22 04:00:09 +0000338 HasFullVContSupport ()
339 {
340 return GetVContSupported ('A');
341 }
342
343 bool
344 HasAnyVContSupport ()
345 {
346 return GetVContSupported ('a');
347 }
348
Greg Clayton8b82f082011-04-12 05:54:46 +0000349 bool
350 GetStopReply (StringExtractorGDBRemote &response);
351
352 bool
Greg Claytonf402f782012-10-13 02:11:55 +0000353 GetThreadStopInfo (lldb::tid_t tid,
Greg Clayton8b82f082011-04-12 05:54:46 +0000354 StringExtractorGDBRemote &response);
355
356 bool
357 SupportsGDBStoppointPacket (GDBStoppointType type)
358 {
359 switch (type)
360 {
361 case eBreakpointSoftware: return m_supports_z0;
362 case eBreakpointHardware: return m_supports_z1;
363 case eWatchpointWrite: return m_supports_z2;
364 case eWatchpointRead: return m_supports_z3;
365 case eWatchpointReadWrite: return m_supports_z4;
Greg Clayton8b82f082011-04-12 05:54:46 +0000366 }
367 return false;
368 }
369 uint8_t
370 SendGDBStoppointTypePacket (GDBStoppointType type, // Type of breakpoint or watchpoint
371 bool insert, // Insert or remove?
372 lldb::addr_t addr, // Address of breakpoint or watchpoint
373 uint32_t length); // Byte Size of breakpoint or watchpoint
374
Greg Clayton9b1e1cd2011-04-04 18:18:57 +0000375 void
376 TestPacketSpeed (const uint32_t num_packets);
377
378 // This packet is for testing the speed of the interface only. Both
379 // the client and server need to support it, but this allows us to
380 // measure the packet speed without any other work being done on the
381 // other end and avoids any of that work affecting the packet send
382 // and response times.
383 bool
384 SendSpeedTestPacket (uint32_t send_size,
385 uint32_t recv_size);
Greg Clayton8b82f082011-04-12 05:54:46 +0000386
387 bool
Jason Molendae9ca4af2013-02-23 02:04:45 +0000388 SetCurrentThread (uint64_t tid);
Greg Clayton8b82f082011-04-12 05:54:46 +0000389
390 bool
Jason Molendae9ca4af2013-02-23 02:04:45 +0000391 SetCurrentThreadForRun (uint64_t tid);
Greg Clayton8b82f082011-04-12 05:54:46 +0000392
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000393 bool
Steve Pucci03904ac2014-03-04 23:18:46 +0000394 GetQXferAuxvReadSupported ();
395
396 bool
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000397 GetQXferLibrariesReadSupported ();
398
399 bool
400 GetQXferLibrariesSVR4ReadSupported ();
401
402 uint64_t
403 GetRemoteMaxPacketSize();
404
405 bool
406 GetAugmentedLibrariesSVR4ReadSupported ();
407
Greg Clayton2a48f522011-05-14 01:50:35 +0000408 lldb_private::LazyBool
Jim Ingham372787f2012-04-07 00:00:41 +0000409 SupportsAllocDeallocMemory () // const
Greg Clayton2a48f522011-05-14 01:50:35 +0000410 {
Jim Ingham372787f2012-04-07 00:00:41 +0000411 // Uncomment this to have lldb pretend the debug server doesn't respond to alloc/dealloc memory packets.
412 // m_supports_alloc_dealloc_memory = lldb_private::eLazyBoolNo;
Greg Clayton70b57652011-05-15 01:25:55 +0000413 return m_supports_alloc_dealloc_memory;
Greg Clayton2a48f522011-05-14 01:50:35 +0000414 }
415
Greg Claytonadc00cb2011-05-20 23:38:13 +0000416 size_t
417 GetCurrentThreadIDs (std::vector<lldb::tid_t> &thread_ids,
418 bool &sequence_mutex_unavailable);
419
Greg Clayton2687cd12012-03-29 01:55:41 +0000420 bool
421 GetInterruptWasSent () const
422 {
423 return m_interrupt_sent;
424 }
Han Ming Ong4b6459f2013-01-18 23:11:53 +0000425
Greg Claytonfbb76342013-11-20 21:07:01 +0000426 lldb::user_id_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000427 OpenFile (const lldb_private::FileSpec& file_spec,
428 uint32_t flags,
429 mode_t mode,
430 lldb_private::Error &error);
431
Greg Claytonfbb76342013-11-20 21:07:01 +0000432 bool
Daniel Maleae0f8f572013-08-26 23:57:52 +0000433 CloseFile (lldb::user_id_t fd,
434 lldb_private::Error &error);
435
Greg Claytonfbb76342013-11-20 21:07:01 +0000436 lldb::user_id_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000437 GetFileSize (const lldb_private::FileSpec& file_spec);
438
Greg Claytonfbb76342013-11-20 21:07:01 +0000439 lldb_private::Error
440 GetFilePermissions(const char *path, uint32_t &file_permissions);
Daniel Maleae0f8f572013-08-26 23:57:52 +0000441
Greg Claytonfbb76342013-11-20 21:07:01 +0000442 lldb_private::Error
443 SetFilePermissions(const char *path, uint32_t file_permissions);
444
445 uint64_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000446 ReadFile (lldb::user_id_t fd,
447 uint64_t offset,
448 void *dst,
449 uint64_t dst_len,
450 lldb_private::Error &error);
451
Greg Claytonfbb76342013-11-20 21:07:01 +0000452 uint64_t
Daniel Maleae0f8f572013-08-26 23:57:52 +0000453 WriteFile (lldb::user_id_t fd,
454 uint64_t offset,
455 const void* src,
456 uint64_t src_len,
457 lldb_private::Error &error);
458
Greg Claytonfbb76342013-11-20 21:07:01 +0000459 lldb_private::Error
460 CreateSymlink (const char *src,
461 const char *dst);
Daniel Maleae0f8f572013-08-26 23:57:52 +0000462
Greg Claytonfbb76342013-11-20 21:07:01 +0000463 lldb_private::Error
464 Unlink (const char *path);
465
466 lldb_private::Error
467 MakeDirectory (const char *path,
468 uint32_t mode);
469
470 bool
Daniel Maleae0f8f572013-08-26 23:57:52 +0000471 GetFileExists (const lldb_private::FileSpec& file_spec);
472
Greg Claytonfbb76342013-11-20 21:07:01 +0000473 lldb_private::Error
Daniel Maleae0f8f572013-08-26 23:57:52 +0000474 RunShellCommand (const char *command, // Shouldn't be NULL
475 const char *working_dir, // Pass NULL to use the current working directory
476 int *status_ptr, // Pass NULL if you don't want the process exit status
477 int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
478 std::string *command_output, // Pass NULL if you don't want the command output
479 uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
480
Greg Claytonfbb76342013-11-20 21:07:01 +0000481 bool
Daniel Maleae0f8f572013-08-26 23:57:52 +0000482 CalculateMD5 (const lldb_private::FileSpec& file_spec,
483 uint64_t &high,
484 uint64_t &low);
485
Han Ming Ong4b6459f2013-01-18 23:11:53 +0000486 std::string
487 HarmonizeThreadIdsForProfileData (ProcessGDBRemote *process,
488 StringExtractorGDBRemote &inputStringExtractor);
Daniel Maleae0f8f572013-08-26 23:57:52 +0000489
Greg Claytonf74cf862013-11-13 23:28:31 +0000490 bool
491 ReadRegister(lldb::tid_t tid,
492 uint32_t reg_num,
493 StringExtractorGDBRemote &response);
494
495 bool
496 ReadAllRegisters (lldb::tid_t tid,
497 StringExtractorGDBRemote &response);
498
499 bool
500 SaveRegisterState (lldb::tid_t tid, uint32_t &save_id);
501
502 bool
503 RestoreRegisterState (lldb::tid_t tid, uint32_t save_id);
Jason Molendaa3329782014-03-29 18:54:20 +0000504
505 const char *
506 GetGDBServerProgramName();
Greg Claytonf74cf862013-11-13 23:28:31 +0000507
Jason Molendaa3329782014-03-29 18:54:20 +0000508 uint32_t
509 GetGDBServerProgramVersion();
510
511 bool
512 AvoidGPackets(ProcessGDBRemote *process);
513
Greg Clayton576d8832011-03-22 04:00:09 +0000514protected:
515
Greg Clayton3dedae12013-12-06 21:45:27 +0000516 PacketResult
517 SendPacketAndWaitForResponseNoLock (const char *payload,
518 size_t payload_length,
519 StringExtractorGDBRemote &response);
520
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000521 bool
522 GetCurrentProcessInfo ();
523
Jason Molendaa3329782014-03-29 18:54:20 +0000524 bool
525 GetGDBServerVersion();
526
Greg Clayton576d8832011-03-22 04:00:09 +0000527 //------------------------------------------------------------------
528 // Classes that inherit from GDBRemoteCommunicationClient can see and modify these
529 //------------------------------------------------------------------
Greg Claytone0d378b2011-03-24 21:19:54 +0000530 lldb_private::LazyBool m_supports_not_sending_acks;
531 lldb_private::LazyBool m_supports_thread_suffix;
Greg Clayton44633992012-04-10 03:22:03 +0000532 lldb_private::LazyBool m_supports_threads_in_stop_reply;
Greg Claytone0d378b2011-03-24 21:19:54 +0000533 lldb_private::LazyBool m_supports_vCont_all;
534 lldb_private::LazyBool m_supports_vCont_any;
535 lldb_private::LazyBool m_supports_vCont_c;
536 lldb_private::LazyBool m_supports_vCont_C;
537 lldb_private::LazyBool m_supports_vCont_s;
538 lldb_private::LazyBool m_supports_vCont_S;
Greg Clayton32e0a752011-03-30 18:16:51 +0000539 lldb_private::LazyBool m_qHostInfo_is_valid;
Todd Fiala9f72b3a2014-05-07 19:28:21 +0000540 lldb_private::LazyBool m_curr_pid_is_valid;
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000541 lldb_private::LazyBool m_qProcessInfo_is_valid;
Jason Molendaa3329782014-03-29 18:54:20 +0000542 lldb_private::LazyBool m_qGDBServerVersion_is_valid;
Greg Clayton70b57652011-05-15 01:25:55 +0000543 lldb_private::LazyBool m_supports_alloc_dealloc_memory;
Greg Clayton46fb5582011-11-18 07:03:08 +0000544 lldb_private::LazyBool m_supports_memory_region_info;
Johnny Chen64637202012-05-23 21:09:52 +0000545 lldb_private::LazyBool m_supports_watchpoint_support_info;
Jim Inghamacff8952013-05-02 00:27:30 +0000546 lldb_private::LazyBool m_supports_detach_stay_stopped;
Enrico Granataf04a2192012-07-13 23:18:48 +0000547 lldb_private::LazyBool m_watchpoints_trigger_after_instruction;
Jim Inghamcd16df92012-07-20 21:37:13 +0000548 lldb_private::LazyBool m_attach_or_wait_reply;
Jim Ingham279ceec2012-07-25 21:12:43 +0000549 lldb_private::LazyBool m_prepare_for_reg_writing_reply;
Hafiz Abid Qadeer9a78cdf2013-08-29 09:09:45 +0000550 lldb_private::LazyBool m_supports_p;
Jason Molendabdc4f122014-05-06 02:59:39 +0000551 lldb_private::LazyBool m_supports_x;
Jason Molendaa3329782014-03-29 18:54:20 +0000552 lldb_private::LazyBool m_avoid_g_packets;
Greg Claytonf74cf862013-11-13 23:28:31 +0000553 lldb_private::LazyBool m_supports_QSaveRegisterState;
Steve Pucci03904ac2014-03-04 23:18:46 +0000554 lldb_private::LazyBool m_supports_qXfer_auxv_read;
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000555 lldb_private::LazyBool m_supports_qXfer_libraries_read;
556 lldb_private::LazyBool m_supports_qXfer_libraries_svr4_read;
557 lldb_private::LazyBool m_supports_augmented_libraries_svr4_read;
558
Greg Clayton8b82f082011-04-12 05:54:46 +0000559 bool
560 m_supports_qProcessInfoPID:1,
561 m_supports_qfProcessInfo:1,
562 m_supports_qUserName:1,
563 m_supports_qGroupName:1,
564 m_supports_qThreadStopInfo:1,
565 m_supports_z0:1,
566 m_supports_z1:1,
567 m_supports_z2:1,
568 m_supports_z3:1,
Greg Clayton89600582013-10-10 17:53:50 +0000569 m_supports_z4:1,
570 m_supports_QEnvironment:1,
571 m_supports_QEnvironmentHexEncoded:1;
Greg Clayton2a48f522011-05-14 01:50:35 +0000572
Todd Fiala9f72b3a2014-05-07 19:28:21 +0000573 lldb::pid_t m_curr_pid;
Greg Clayton8b82f082011-04-12 05:54:46 +0000574 lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all other operations
575 lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for continue, step, etc
576
Greg Clayton576d8832011-03-22 04:00:09 +0000577
Johnny Chen64637202012-05-23 21:09:52 +0000578 uint32_t m_num_supported_hardware_watchpoints;
579
Greg Clayton576d8832011-03-22 04:00:09 +0000580 // If we need to send a packet while the target is running, the m_async_XXX
581 // member variables take care of making this happen.
582 lldb_private::Mutex m_async_mutex;
583 lldb_private::Predicate<bool> m_async_packet_predicate;
584 std::string m_async_packet;
Jim Inghama6195b72013-12-18 01:24:33 +0000585 PacketResult m_async_result;
Greg Clayton576d8832011-03-22 04:00:09 +0000586 StringExtractorGDBRemote m_async_response;
587 int m_async_signal; // We were asked to deliver a signal to the inferior process.
Greg Clayton2687cd12012-03-29 01:55:41 +0000588 bool m_interrupt_sent;
Han Ming Ong4b6459f2013-01-18 23:11:53 +0000589 std::string m_partial_profile_data;
590 std::map<uint64_t, uint32_t> m_thread_id_to_used_usec_map;
Greg Clayton576d8832011-03-22 04:00:09 +0000591
Greg Claytond314e812011-03-23 00:09:55 +0000592 lldb_private::ArchSpec m_host_arch;
Jason Molendaf17b5ac2012-12-19 02:54:03 +0000593 lldb_private::ArchSpec m_process_arch;
Greg Clayton1cb64962011-03-24 04:28:38 +0000594 uint32_t m_os_version_major;
595 uint32_t m_os_version_minor;
596 uint32_t m_os_version_update;
597 std::string m_os_build;
598 std::string m_os_kernel;
599 std::string m_hostname;
Jason Molendaa3329782014-03-29 18:54:20 +0000600 std::string m_gdb_server_name; // from reply to qGDBServerVersion, empty if qGDBServerVersion is not supported
601 uint32_t m_gdb_server_version; // from reply to qGDBServerVersion, zero if qGDBServerVersion is not supported
Greg Clayton9ac6d2d2013-10-25 18:13:17 +0000602 uint32_t m_default_packet_timeout;
Steve Pucci5ae54ae2014-01-25 05:46:51 +0000603 uint64_t m_max_packet_size; // as returned by qSupported
Greg Clayton576d8832011-03-22 04:00:09 +0000604
Greg Clayton32e0a752011-03-30 18:16:51 +0000605 bool
606 DecodeProcessInfoResponse (StringExtractorGDBRemote &response,
Greg Clayton8b82f082011-04-12 05:54:46 +0000607 lldb_private::ProcessInstanceInfo &process_info);
Greg Clayton576d8832011-03-22 04:00:09 +0000608private:
609 //------------------------------------------------------------------
610 // For GDBRemoteCommunicationClient only
611 //------------------------------------------------------------------
612 DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient);
613};
614
615#endif // liblldb_GDBRemoteCommunicationClient_h_