LLDB  mainline
StringExtractorGDBRemote.cpp
Go to the documentation of this file.
1 //===-- StringExtractorGDBRemote.cpp --------------------------------------===//
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 
10 
11 #include <cctype>
12 #include <cstring>
13 
16 
19  if (m_packet.empty())
20  return eUnsupported;
21 
22  switch (m_packet[0]) {
23  case 'E':
24  if (isxdigit(m_packet[1]) && isxdigit(m_packet[2])) {
25  if (m_packet.size() == 3)
26  return eError;
27  llvm::StringRef packet_ref(m_packet);
28  if (packet_ref[3] == ';') {
29  auto err_string = packet_ref.substr(4);
30  for (auto e : err_string)
31  if (!isxdigit(e))
32  return eResponse;
33  return eError;
34  }
35  }
36  break;
37 
38  case 'O':
39  if (m_packet.size() == 2 && m_packet[1] == 'K')
40  return eOK;
41  break;
42 
43  case '+':
44  if (m_packet.size() == 1)
45  return eAck;
46  break;
47 
48  case '-':
49  if (m_packet.size() == 1)
50  return eNack;
51  break;
52  }
53  return eResponse;
54 }
55 
58 #define PACKET_MATCHES(s) \
59  ((packet_size == (sizeof(s) - 1)) && (strcmp((packet_cstr), (s)) == 0))
60 #define PACKET_STARTS_WITH(s) \
61  ((packet_size >= (sizeof(s) - 1)) && \
62  ::strncmp(packet_cstr, s, (sizeof(s) - 1)) == 0)
63 
64  // Empty is not a supported packet...
65  if (m_packet.empty())
67 
68  const size_t packet_size = m_packet.size();
69  const char *packet_cstr = m_packet.c_str();
70  switch (m_packet[0]) {
71 
72  case '%':
74 
75  case '\x03':
76  if (packet_size == 1)
78  break;
79 
80  case '-':
81  if (packet_size == 1)
83  break;
84 
85  case '+':
86  if (packet_size == 1)
87  return eServerPacketType_ack;
88  break;
89 
90  case 'A':
91  return eServerPacketType_A;
92 
93  case 'Q':
94 
95  switch (packet_cstr[1]) {
96  case 'E':
97  if (PACKET_STARTS_WITH("QEnvironment:"))
99  if (PACKET_STARTS_WITH("QEnvironmentHexEncoded:"))
101  if (PACKET_STARTS_WITH("QEnableErrorStrings"))
103  break;
104 
105  case 'P':
106  if (PACKET_STARTS_WITH("QPassSignals:"))
108  break;
109 
110  case 'S':
111  if (PACKET_MATCHES("QStartNoAckMode"))
113  if (PACKET_STARTS_WITH("QSaveRegisterState"))
115  if (PACKET_STARTS_WITH("QSetDisableASLR:"))
117  if (PACKET_STARTS_WITH("QSetDetachOnError:"))
119  if (PACKET_STARTS_WITH("QSetSTDIN:"))
121  if (PACKET_STARTS_WITH("QSetSTDOUT:"))
123  if (PACKET_STARTS_WITH("QSetSTDERR:"))
125  if (PACKET_STARTS_WITH("QSetWorkingDir:"))
127  if (PACKET_STARTS_WITH("QSetLogging:"))
129  if (PACKET_STARTS_WITH("QSetIgnoredExceptions"))
131  if (PACKET_STARTS_WITH("QSetMaxPacketSize:"))
133  if (PACKET_STARTS_WITH("QSetMaxPayloadSize:"))
135  if (PACKET_STARTS_WITH("QSetEnableAsyncProfiling;"))
137  if (PACKET_STARTS_WITH("QSyncThreadState:"))
139  break;
140 
141  case 'L':
142  if (PACKET_STARTS_WITH("QLaunchArch:"))
144  if (PACKET_MATCHES("QListThreadsInStopReply"))
146  break;
147 
148  case 'M':
149  if (PACKET_STARTS_WITH("QMemTags"))
151  break;
152 
153  case 'N':
154  if (PACKET_STARTS_WITH("QNonStop:"))
156  break;
157 
158  case 'R':
159  if (PACKET_STARTS_WITH("QRestoreRegisterState:"))
161  break;
162 
163  case 'T':
164  if (PACKET_MATCHES("QThreadSuffixSupported"))
166  break;
167  }
168  break;
169 
170  case 'q':
171  switch (packet_cstr[1]) {
172  case 's':
173  if (PACKET_MATCHES("qsProcessInfo"))
175  if (PACKET_MATCHES("qsThreadInfo"))
177  break;
178 
179  case 'f':
180  if (PACKET_STARTS_WITH("qfProcessInfo"))
182  if (PACKET_STARTS_WITH("qfThreadInfo"))
184  break;
185 
186  case 'C':
187  if (packet_size == 2)
188  return eServerPacketType_qC;
189  break;
190 
191  case 'E':
192  if (PACKET_STARTS_WITH("qEcho:"))
194  break;
195 
196  case 'F':
197  if (PACKET_STARTS_WITH("qFileLoadAddress:"))
199  break;
200 
201  case 'G':
202  if (PACKET_STARTS_WITH("qGroupName:"))
204  if (PACKET_MATCHES("qGetWorkingDir"))
206  if (PACKET_MATCHES("qGetPid"))
208  if (PACKET_STARTS_WITH("qGetProfileData;"))
210  if (PACKET_MATCHES("qGDBServerVersion"))
212  break;
213 
214  case 'H':
215  if (PACKET_MATCHES("qHostInfo"))
217  break;
218 
219  case 'K':
220  if (PACKET_STARTS_WITH("qKillSpawnedProcess"))
222  break;
223 
224  case 'L':
225  if (PACKET_STARTS_WITH("qLaunchGDBServer"))
227  if (PACKET_MATCHES("qLaunchSuccess"))
229  break;
230 
231  case 'M':
232  if (PACKET_STARTS_WITH("qMemoryRegionInfo:"))
234  if (PACKET_MATCHES("qMemoryRegionInfo"))
236  if (PACKET_STARTS_WITH("qModuleInfo:"))
238  if (PACKET_STARTS_WITH("qMemTags:"))
240  break;
241 
242  case 'P':
243  if (PACKET_STARTS_WITH("qProcessInfoPID:"))
245  if (PACKET_STARTS_WITH("qPlatform_shell:"))
247  if (PACKET_STARTS_WITH("qPlatform_mkdir:"))
249  if (PACKET_STARTS_WITH("qPlatform_chmod:"))
251  if (PACKET_MATCHES("qProcessInfo"))
253  if (PACKET_STARTS_WITH("qPathComplete:"))
255  break;
256 
257  case 'Q':
258  if (PACKET_MATCHES("qQueryGDBServer"))
260  break;
261 
262  case 'R':
263  if (PACKET_STARTS_WITH("qRcmd,"))
265  if (PACKET_STARTS_WITH("qRegisterInfo"))
267  break;
268 
269  case 'S':
270  if (PACKET_STARTS_WITH("qSaveCore"))
272  if (PACKET_STARTS_WITH("qSpeedTest:"))
274  if (PACKET_MATCHES("qShlibInfoAddr"))
276  if (PACKET_MATCHES("qStepPacketSupported"))
278  if (PACKET_STARTS_WITH("qSupported"))
280  if (PACKET_MATCHES("qSyncThreadStateSupported"))
282  break;
283 
284  case 'T':
285  if (PACKET_STARTS_WITH("qThreadExtraInfo,"))
287  if (PACKET_STARTS_WITH("qThreadStopInfo"))
289  break;
290 
291  case 'U':
292  if (PACKET_STARTS_WITH("qUserName:"))
294  break;
295 
296  case 'V':
297  if (PACKET_MATCHES("qVAttachOrWaitSupported"))
299  break;
300 
301  case 'W':
302  if (PACKET_STARTS_WITH("qWatchpointSupportInfo:"))
304  if (PACKET_MATCHES("qWatchpointSupportInfo"))
306  break;
307 
308  case 'X':
309  if (PACKET_STARTS_WITH("qXfer:"))
311  break;
312  }
313  break;
314 
315  case 'j':
316  if (PACKET_STARTS_WITH("jModulesInfo:"))
318  if (PACKET_MATCHES("jSignalsInfo"))
320  if (PACKET_MATCHES("jThreadsInfo"))
322 
323  if (PACKET_MATCHES("jLLDBTraceSupported"))
325  if (PACKET_STARTS_WITH("jLLDBTraceStop:"))
327  if (PACKET_STARTS_WITH("jLLDBTraceStart:"))
329  if (PACKET_STARTS_WITH("jLLDBTraceGetState:"))
331  if (PACKET_STARTS_WITH("jLLDBTraceGetBinaryData:"))
333  break;
334 
335  case 'v':
336  if (PACKET_STARTS_WITH("vFile:")) {
337  if (PACKET_STARTS_WITH("vFile:open:"))
339  else if (PACKET_STARTS_WITH("vFile:close:"))
341  else if (PACKET_STARTS_WITH("vFile:pread"))
343  else if (PACKET_STARTS_WITH("vFile:pwrite"))
345  else if (PACKET_STARTS_WITH("vFile:size"))
347  else if (PACKET_STARTS_WITH("vFile:exists"))
349  else if (PACKET_STARTS_WITH("vFile:fstat"))
351  else if (PACKET_STARTS_WITH("vFile:stat"))
353  else if (PACKET_STARTS_WITH("vFile:mode"))
355  else if (PACKET_STARTS_WITH("vFile:MD5"))
357  else if (PACKET_STARTS_WITH("vFile:symlink"))
359  else if (PACKET_STARTS_WITH("vFile:unlink"))
361 
362  } else {
363  if (PACKET_STARTS_WITH("vAttach;"))
365  if (PACKET_STARTS_WITH("vAttachWait;"))
367  if (PACKET_STARTS_WITH("vAttachOrWait;"))
369  if (PACKET_STARTS_WITH("vAttachName;"))
371  if (PACKET_STARTS_WITH("vCont;"))
373  if (PACKET_MATCHES("vCont?"))
375  if (PACKET_STARTS_WITH("vKill;"))
377  if (PACKET_STARTS_WITH("vRun;"))
378  return eServerPacketType_vRun;
379  if (PACKET_MATCHES("vStopped"))
381  if (PACKET_MATCHES("vCtrlC"))
383  if (PACKET_MATCHES("vStdio"))
385  break;
386 
387  }
388  break;
389  case '_':
390  switch (packet_cstr[1]) {
391  case 'M':
392  return eServerPacketType__M;
393 
394  case 'm':
395  return eServerPacketType__m;
396  }
397  break;
398 
399  case '?':
400  if (packet_size == 1)
402  break;
403 
404  case 'c':
405  return eServerPacketType_c;
406 
407  case 'C':
408  return eServerPacketType_C;
409 
410  case 'D':
411  return eServerPacketType_D;
412 
413  case 'g':
414  return eServerPacketType_g;
415 
416  case 'G':
417  return eServerPacketType_G;
418 
419  case 'H':
420  return eServerPacketType_H;
421 
422  case 'I':
423  return eServerPacketType_I;
424 
425  case 'k':
426  if (packet_size == 1)
427  return eServerPacketType_k;
428  break;
429 
430  case 'm':
431  return eServerPacketType_m;
432 
433  case 'M':
434  return eServerPacketType_M;
435 
436  case 'p':
437  return eServerPacketType_p;
438 
439  case 'P':
440  return eServerPacketType_P;
441 
442  case 's':
443  if (packet_size == 1)
444  return eServerPacketType_s;
445  break;
446 
447  case 'S':
448  return eServerPacketType_S;
449 
450  case 'x':
451  return eServerPacketType_x;
452 
453  case 'X':
454  return eServerPacketType_X;
455 
456  case 'T':
457  return eServerPacketType_T;
458 
459  case 'z':
460  if (packet_cstr[1] >= '0' && packet_cstr[1] <= '4')
461  return eServerPacketType_z;
462  break;
463 
464  case 'Z':
465  if (packet_cstr[1] >= '0' && packet_cstr[1] <= '4')
466  return eServerPacketType_Z;
467  break;
468  }
470 }
471 
473  return GetResponseType() == eOK;
474 }
475 
477  return GetResponseType() == eUnsupported;
478 }
479 
481  return GetResponseType() == eResponse;
482 }
483 
485  return GetResponseType() == eError && isxdigit(m_packet[1]) &&
486  isxdigit(m_packet[2]);
487 }
488 
490  if (GetResponseType() == eError) {
491  SetFilePos(1);
492  return GetHexU8(255);
493  }
494  return 0;
495 }
496 
499  if (GetResponseType() == eError) {
500  SetFilePos(1);
501  uint8_t errc = GetHexU8(255);
502  error.SetError(errc, lldb::eErrorTypeGeneric);
503 
504  error.SetErrorStringWithFormat("Error %u", errc);
505  std::string error_messg;
506  if (GetChar() == ';') {
507  GetHexByteString(error_messg);
508  error.SetErrorString(error_messg);
509  }
510  }
511  return error;
512 }
513 
515  // Just get the data bytes in the string as
516  // GDBRemoteCommunication::CheckForPacket() already removes any 0x7d escaped
517  // characters. If any 0x7d characters are left in the packet, then they are
518  // supposed to be there...
519  str.clear();
520  const size_t bytes_left = GetBytesLeft();
521  if (bytes_left > 0) {
522  str.assign(m_packet, m_index, bytes_left);
523  m_index += bytes_left;
524  }
525  return str.size();
526 }
527 
528 static bool
530  const StringExtractorGDBRemote &response) {
531  switch (response.GetResponseType()) {
535  return true;
536 
540  break;
541  }
542  return false;
543 }
544 
545 static bool JSONResponseValidator(void *,
546  const StringExtractorGDBRemote &response) {
547  switch (response.GetResponseType()) {
550  return true; // Accept unsupported or EXX as valid responses
551 
555  break;
556 
558  // JSON that is returned in from JSON query packets is currently always
559  // either a dictionary which starts with a '{', or an array which starts
560  // with a '['. This is a quick validator to just make sure the response
561  // could be valid JSON without having to validate all of the
562  // JSON content.
563  switch (response.GetStringRef()[0]) {
564  case '{':
565  return true;
566  case '[':
567  return true;
568  default:
569  break;
570  }
571  break;
572  }
573  return false;
574 }
575 
576 static bool
578  const StringExtractorGDBRemote &response) {
579  switch (response.GetResponseType()) {
582  return true; // Accept unsupported or EXX as valid responses
583 
587  break;
588 
590  uint32_t valid_count = 0;
591  for (const char ch : response.GetStringRef()) {
592  if (!isxdigit(ch)) {
593  return false;
594  }
595  if (++valid_count >= 16)
596  break; // Don't validate all the characters in case the packet is very
597  // large
598  }
599  return true;
600  } break;
601  }
602  return false;
603 }
604 
606  const StringExtractorGDBRemote &rhs) {
607  m_validator = rhs.m_validator;
609 }
610 
612  ResponseValidatorCallback callback, void *baton) {
613  m_validator = callback;
614  m_validator_baton = baton;
615 }
616 
619  m_validator_baton = nullptr;
620 }
621 
624  m_validator_baton = nullptr;
625 }
626 
629  m_validator_baton = nullptr;
630 }
631 
633  // If we have a validator callback, try to validate the callback
634  if (m_validator)
635  return m_validator(m_validator_baton, *this);
636  else
637  return true; // No validator, so response is valid
638 }
639 
640 llvm::Optional<std::pair<lldb::pid_t, lldb::tid_t>>
642  llvm::StringRef view = llvm::StringRef(m_packet).substr(m_index);
643  size_t initial_length = view.size();
645  lldb::tid_t tid;
646 
647  if (view.consume_front("p")) {
648  // process identifier
649  if (view.consume_front("-1")) {
650  // -1 is a special case
651  pid = AllProcesses;
652  } else if (view.consumeInteger(16, pid) || pid == 0) {
653  // not a valid hex integer OR unsupported pid 0
655  return llvm::None;
656  }
657 
658  // "." must follow if we expect TID too; otherwise, we assume -1
659  if (!view.consume_front(".")) {
660  // update m_index
661  m_index += initial_length - view.size();
662 
663  return {{pid, AllThreads}};
664  }
665  }
666 
667  // thread identifier
668  if (view.consume_front("-1")) {
669  // -1 is a special case
670  tid = AllThreads;
671  } else if (view.consumeInteger(16, tid) || tid == 0 || pid == AllProcesses) {
672  // not a valid hex integer OR tid 0 OR pid -1 + a specific tid
674  return llvm::None;
675  }
676 
677  // update m_index
678  m_index += initial_length - view.size();
679 
680  return {{pid != LLDB_INVALID_PROCESS_ID ? pid : default_pid, tid}};
681 }
StringExtractorGDBRemote::eServerPacketType_D
@ eServerPacketType_D
Definition: StringExtractorGDBRemote.h:146
StringExtractorGDBRemote::GetServerPacketType
ServerPacketType GetServerPacketType() const
Definition: StringExtractorGDBRemote.cpp:57
StringExtractorGDBRemote::eServerPacketType__m
@ eServerPacketType__m
Definition: StringExtractorGDBRemote.h:165
StringExtractorGDBRemote::AllProcesses
static constexpr lldb::pid_t AllProcesses
Definition: StringExtractorGDBRemote.h:207
StringExtractorGDBRemote::eServerPacketType_qUserName
@ eServerPacketType_qUserName
Definition: StringExtractorGDBRemote.h:66
StringExtractorGDBRemote::eServerPacketType_qThreadExtraInfo
@ eServerPacketType_qThreadExtraInfo
Definition: StringExtractorGDBRemote.h:123
StringExtractorGDBRemote::eServerPacketType_vFile_pread
@ eServerPacketType_vFile_pread
Definition: StringExtractorGDBRemote.h:85
StringExtractorGDBRemote::eServerPacketType_qMemoryRegionInfoSupported
@ eServerPacketType_qMemoryRegionInfoSupported
Definition: StringExtractorGDBRemote.h:115
StringExtractorGDBRemote::eError
@ eError
Definition: StringExtractorGDBRemote.h:187
StringExtractorGDBRemote::eServerPacketType_x
@ eServerPacketType_x
Definition: StringExtractorGDBRemote.h:159
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:81
StringExtractorGDBRemote::eServerPacketType_QListThreadsInStopReply
@ eServerPacketType_QListThreadsInStopReply
Definition: StringExtractorGDBRemote.h:97
StringExtractorGDBRemote::m_validator_baton
void * m_validator_baton
Definition: StringExtractorGDBRemote.h:218
StringExtractorGDBRemote::eServerPacketType_QSetIgnoredExceptions
@ eServerPacketType_QSetIgnoredExceptions
Definition: StringExtractorGDBRemote.h:178
StringExtractor::SetFilePos
void SetFilePos(uint32_t idx)
Definition: StringExtractor.h:39
StringExtractorGDBRemote::CopyResponseValidator
void CopyResponseValidator(const StringExtractorGDBRemote &rhs)
Definition: StringExtractorGDBRemote.cpp:605
StringExtractor::GetBytesLeft
size_t GetBytesLeft()
Definition: StringExtractor.h:52
StringExtractorGDBRemote::eServerPacketType_qfThreadInfo
@ eServerPacketType_qfThreadInfo
Definition: StringExtractorGDBRemote.h:110
StringExtractorGDBRemote::eServerPacketType_unimplemented
@ eServerPacketType_unimplemented
Definition: StringExtractorGDBRemote.h:50
StringExtractorGDBRemote::eServerPacketType_A
@ eServerPacketType_A
Definition: StringExtractorGDBRemote.h:52
StringExtractorGDBRemote::eServerPacketType_vKill
@ eServerPacketType_vKill
Definition: StringExtractorGDBRemote.h:139
StringExtractorGDBRemote::eServerPacketType_QNonStop
@ eServerPacketType_QNonStop
Definition: StringExtractorGDBRemote.h:179
StringExtractorGDBRemote::ResponseType
ResponseType
Definition: StringExtractorGDBRemote.h:187
StringExtractor::GetStringRef
llvm::StringRef GetStringRef() const
Definition: StringExtractor.h:48
StringExtractorGDBRemote::eServerPacketType_qQueryGDBServer
@ eServerPacketType_qQueryGDBServer
Definition: StringExtractorGDBRemote.h:60
OKErrorNotSupportedResponseValidator
static bool OKErrorNotSupportedResponseValidator(void *, const StringExtractorGDBRemote &response)
Definition: StringExtractorGDBRemote.cpp:529
StringExtractorGDBRemote::eServerPacketType_qSyncThreadStateSupported
@ eServerPacketType_qSyncThreadStateSupported
Definition: StringExtractorGDBRemote.h:122
StringExtractorGDBRemote::eOK
@ eOK
Definition: StringExtractorGDBRemote.h:187
StringExtractorGDBRemote::eServerPacketType_stop_reason
@ eServerPacketType_stop_reason
Definition: StringExtractorGDBRemote.h:142
StringExtractorGDBRemote::eServerPacketType_QStartNoAckMode
@ eServerPacketType_QStartNoAckMode
Definition: StringExtractorGDBRemote.h:78
StringExtractorGDBRemote::eServerPacketType_vAttachOrWait
@ eServerPacketType_vAttachOrWait
Definition: StringExtractorGDBRemote.h:135
StringExtractorGDBRemote::eServerPacketType_qLLDBSaveCore
@ eServerPacketType_qLLDBSaveCore
Definition: StringExtractorGDBRemote.h:177
StringExtractorGDBRemote::eServerPacketType_QSetMaxPayloadSize
@ eServerPacketType_QSetMaxPayloadSize
Definition: StringExtractorGDBRemote.h:103
StringExtractorGDBRemote::eServerPacketType_vFile_stat
@ eServerPacketType_vFile_stat
Definition: StringExtractorGDBRemote.h:92
StringExtractorGDBRemote::eServerPacketType_qMemoryRegionInfo
@ eServerPacketType_qMemoryRegionInfo
Definition: StringExtractorGDBRemote.h:114
StringExtractorGDBRemote::eServerPacketType_qC
@ eServerPacketType_qC
Definition: StringExtractorGDBRemote.h:55
StringExtractorGDBRemote::eServerPacketType_I
@ eServerPacketType_I
Definition: StringExtractorGDBRemote.h:150
StringExtractorGDBRemote::eServerPacketType_qProcessInfo
@ eServerPacketType_qProcessInfo
Definition: StringExtractorGDBRemote.h:116
StringExtractorGDBRemote::eServerPacketType_M
@ eServerPacketType_M
Definition: StringExtractorGDBRemote.h:153
StringExtractorGDBRemote::eServerPacketType_vRun
@ eServerPacketType_vRun
Definition: StringExtractorGDBRemote.h:140
StringExtractorGDBRemote.h
StringExtractorGDBRemote::eServerPacketType_qPlatform_chmod
@ eServerPacketType_qPlatform_chmod
Definition: StringExtractorGDBRemote.h:82
StringExtractorGDBRemote::eServerPacketType_QEnvironment
@ eServerPacketType_QEnvironment
Definition: StringExtractorGDBRemote.h:69
StringExtractorGDBRemote::eServerPacketType_vStdio
@ eServerPacketType_vStdio
Definition: StringExtractorGDBRemote.h:182
StringExtractorGDBRemote::eServerPacketType_vAttachWait
@ eServerPacketType_vAttachWait
Definition: StringExtractorGDBRemote.h:134
StringExtractorGDBRemote::eServerPacketType_G
@ eServerPacketType_G
Definition: StringExtractorGDBRemote.h:148
StringExtractorGDBRemote::eServerPacketType_qWatchpointSupportInfoSupported
@ eServerPacketType_qWatchpointSupportInfoSupported
Definition: StringExtractorGDBRemote.h:127
StringExtractorGDBRemote::eServerPacketType_jLLDBTraceSupported
@ eServerPacketType_jLLDBTraceSupported
Definition: StringExtractorGDBRemote.h:168
StringExtractorGDBRemote::eServerPacketType_qRcmd
@ eServerPacketType_qRcmd
Definition: StringExtractorGDBRemote.h:117
StringExtractorGDBRemote::eServerPacketType_QSetSTDOUT
@ eServerPacketType_QSetSTDOUT
Definition: StringExtractorGDBRemote.h:75
StringExtractorGDBRemote::eServerPacketType_QSetLogging
@ eServerPacketType_QSetLogging
Definition: StringExtractorGDBRemote.h:101
StringExtractorGDBRemote::SetResponseValidatorToASCIIHexBytes
void SetResponseValidatorToASCIIHexBytes()
Definition: StringExtractorGDBRemote.cpp:622
StringExtractorGDBRemote::eServerPacketType_invalid
@ eServerPacketType_invalid
Definition: StringExtractorGDBRemote.h:49
PACKET_STARTS_WITH
#define PACKET_STARTS_WITH(s)
StringExtractorGDBRemote::IsErrorResponse
bool IsErrorResponse() const
Definition: StringExtractorGDBRemote.cpp:484
StringExtractorGDBRemote::eServerPacketType_qfProcessInfo
@ eServerPacketType_qfProcessInfo
Definition: StringExtractorGDBRemote.h:53
StringExtractorGDBRemote::eServerPacketType_jLLDBTraceStart
@ eServerPacketType_jLLDBTraceStart
Definition: StringExtractorGDBRemote.h:169
ASCIIHexBytesResponseValidator
static bool ASCIIHexBytesResponseValidator(void *, const StringExtractorGDBRemote &response)
Definition: StringExtractorGDBRemote.cpp:577
StringExtractorGDBRemote::eServerPacketType_vFile_symlink
@ eServerPacketType_vFile_symlink
Definition: StringExtractorGDBRemote.h:93
StringExtractorGDBRemote::eServerPacketType_qPlatform_mkdir
@ eServerPacketType_qPlatform_mkdir
Definition: StringExtractorGDBRemote.h:81
StringExtractorGDBRemote::eUnsupported
@ eUnsupported
Definition: StringExtractorGDBRemote.h:187
StringExtractorGDBRemote::GetEscapedBinaryData
size_t GetEscapedBinaryData(std::string &str)
Definition: StringExtractorGDBRemote.cpp:514
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
StringExtractorGDBRemote::eServerPacketType_QSaveRegisterState
@ eServerPacketType_QSaveRegisterState
Definition: StringExtractorGDBRemote.h:100
StringExtractorGDBRemote::eServerPacketType_c
@ eServerPacketType_c
Definition: StringExtractorGDBRemote.h:144
StringExtractorGDBRemote::eServerPacketType_QSetEnableAsyncProfiling
@ eServerPacketType_QSetEnableAsyncProfiling
Definition: StringExtractorGDBRemote.h:104
StringExtractorGDBRemote::eServerPacketType_nack
@ eServerPacketType_nack
Definition: StringExtractorGDBRemote.h:47
StringExtractorGDBRemote::eServerPacketType_T
@ eServerPacketType_T
Definition: StringExtractorGDBRemote.h:158
StringExtractorGDBRemote::eServerPacketType_vFile_fstat
@ eServerPacketType_vFile_fstat
Definition: StringExtractorGDBRemote.h:91
StringExtractorGDBRemote::eServerPacketType_qMemTags
@ eServerPacketType_qMemTags
Definition: StringExtractorGDBRemote.h:174
StringExtractorGDBRemote::eServerPacketType_Z
@ eServerPacketType_Z
Definition: StringExtractorGDBRemote.h:161
StringExtractorGDBRemote::eServerPacketType_vFile_size
@ eServerPacketType_vFile_size
Definition: StringExtractorGDBRemote.h:87
StringExtractorGDBRemote::eServerPacketType_QSetDisableASLR
@ eServerPacketType_QSetDisableASLR
Definition: StringExtractorGDBRemote.h:72
StringExtractorGDBRemote::eServerPacketType_qThreadStopInfo
@ eServerPacketType_qThreadStopInfo
Definition: StringExtractorGDBRemote.h:124
StringExtractorGDBRemote::eServerPacketType_qWatchpointSupportInfo
@ eServerPacketType_qWatchpointSupportInfo
Definition: StringExtractorGDBRemote.h:126
StringExtractorGDBRemote::eServerPacketType_qProcessInfoPID
@ eServerPacketType_qProcessInfoPID
Definition: StringExtractorGDBRemote.h:64
StringExtractorGDBRemote::eAck
@ eAck
Definition: StringExtractorGDBRemote.h:187
StringExtractorGDBRemote::eServerPacketType_QSyncThreadState
@ eServerPacketType_QSyncThreadState
Definition: StringExtractorGDBRemote.h:105
StringExtractorGDBRemote::eServerPacketType_jLLDBTraceGetBinaryData
@ eServerPacketType_jLLDBTraceGetBinaryData
Definition: StringExtractorGDBRemote.h:172
StringExtractorGDBRemote::eServerPacketType_qPathComplete
@ eServerPacketType_qPathComplete
Definition: StringExtractorGDBRemote.h:79
StringExtractorGDBRemote::eServerPacketType_vCont_actions
@ eServerPacketType_vCont_actions
Definition: StringExtractorGDBRemote.h:138
StringExtractorGDBRemote::eServerPacketType_QSetDetachOnError
@ eServerPacketType_QSetDetachOnError
Definition: StringExtractorGDBRemote.h:73
StringExtractorGDBRemote::eServerPacketType_jSignalsInfo
@ eServerPacketType_jSignalsInfo
Definition: StringExtractorGDBRemote.h:130
StringExtractorGDBRemote::eServerPacketType_jLLDBTraceGetState
@ eServerPacketType_jLLDBTraceGetState
Definition: StringExtractorGDBRemote.h:171
StringExtractorGDBRemote::eServerPacketType_QRestoreRegisterState
@ eServerPacketType_QRestoreRegisterState
Definition: StringExtractorGDBRemote.h:99
StringExtractorGDBRemote::eServerPacketType_vStopped
@ eServerPacketType_vStopped
Definition: StringExtractorGDBRemote.h:180
StringExtractorGDBRemote::eServerPacketType_qKillSpawnedProcess
@ eServerPacketType_qKillSpawnedProcess
Definition: StringExtractorGDBRemote.h:61
StringExtractorGDBRemote::eResponse
@ eResponse
Definition: StringExtractorGDBRemote.h:187
StringExtractorGDBRemote::eServerPacketType_vAttachName
@ eServerPacketType_vAttachName
Definition: StringExtractorGDBRemote.h:136
StringExtractorGDBRemote::eServerPacketType_g
@ eServerPacketType_g
Definition: StringExtractorGDBRemote.h:147
StringExtractorGDBRemote::GetResponseType
ResponseType GetResponseType() const
Definition: StringExtractorGDBRemote.cpp:18
StringExtractorGDBRemote::eServerPacketType_qGroupName
@ eServerPacketType_qGroupName
Definition: StringExtractorGDBRemote.h:57
StringExtractorGDBRemote::eServerPacketType_qSpeedTest
@ eServerPacketType_qSpeedTest
Definition: StringExtractorGDBRemote.h:65
StringExtractorGDBRemote::eServerPacketType_QSetSTDERR
@ eServerPacketType_QSetSTDERR
Definition: StringExtractorGDBRemote.h:76
StringExtractorGDBRemote::eServerPacketType_jModulesInfo
@ eServerPacketType_jModulesInfo
Definition: StringExtractorGDBRemote.h:131
StringExtractorGDBRemote::eServerPacketType__M
@ eServerPacketType__M
Definition: StringExtractorGDBRemote.h:164
StringExtractorGDBRemote::eServerPacketType_qXfer
@ eServerPacketType_qXfer
Definition: StringExtractorGDBRemote.h:128
StringExtractorGDBRemote::IsUnsupportedResponse
bool IsUnsupportedResponse() const
Definition: StringExtractorGDBRemote.cpp:476
lldb::eErrorTypeGeneric
@ eErrorTypeGeneric
Generic errors that can be any value.
Definition: lldb-enumerations.h:309
StringExtractorGDBRemote::SetResponseValidatorToJSON
void SetResponseValidatorToJSON()
Definition: StringExtractorGDBRemote.cpp:627
StringExtractor::GetChar
char GetChar(char fail_value='\0')
Definition: StringExtractor.cpp:43
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
StringExtractorGDBRemote::GetPidTid
llvm::Optional< std::pair< lldb::pid_t, lldb::tid_t > > GetPidTid(lldb::pid_t default_pid)
Definition: StringExtractorGDBRemote.cpp:641
StringExtractor::GetHexU8
uint8_t GetHexU8(uint8_t fail_value=0, bool set_eof_on_fail=true)
Definition: StringExtractor.cpp:74
StringExtractorGDBRemote::eServerPacketType_qLaunchGDBServer
@ eServerPacketType_qLaunchGDBServer
Definition: StringExtractorGDBRemote.h:59
StringExtractorGDBRemote::eServerPacketType_QSetWorkingDir
@ eServerPacketType_QSetWorkingDir
Definition: StringExtractorGDBRemote.h:77
StringExtractorGDBRemote::GetStatus
lldb_private::Status GetStatus()
Definition: StringExtractorGDBRemote.cpp:497
StringExtractor::m_packet
std::string m_packet
The string in which to extract data.
Definition: StringExtractor.h:113
StringExtractorGDBRemote::eServerPacketType_X
@ eServerPacketType_X
Definition: StringExtractorGDBRemote.h:160
StringExtractorGDBRemote::eServerPacketType_qSupported
@ eServerPacketType_qSupported
Definition: StringExtractorGDBRemote.h:121
StringExtractorGDBRemote::eServerPacketType_QSetMaxPacketSize
@ eServerPacketType_QSetMaxPacketSize
Definition: StringExtractorGDBRemote.h:102
StringExtractorGDBRemote::AllThreads
static constexpr lldb::tid_t AllThreads
Definition: StringExtractorGDBRemote.h:208
StringExtractorGDBRemote::eServerPacketType_qGDBServerVersion
@ eServerPacketType_qGDBServerVersion
Definition: StringExtractorGDBRemote.h:113
StringExtractorGDBRemote::eServerPacketType_qLaunchSuccess
@ eServerPacketType_qLaunchSuccess
Definition: StringExtractorGDBRemote.h:62
StringExtractorGDBRemote::eServerPacketType_P
@ eServerPacketType_P
Definition: StringExtractorGDBRemote.h:155
StringExtractorGDBRemote::eServerPacketType_vFile_unlink
@ eServerPacketType_vFile_unlink
Definition: StringExtractorGDBRemote.h:94
StringExtractorGDBRemote::eServerPacketType_vFile_md5
@ eServerPacketType_vFile_md5
Definition: StringExtractorGDBRemote.h:90
StringExtractorGDBRemote::eServerPacketType_qModuleInfo
@ eServerPacketType_qModuleInfo
Definition: StringExtractorGDBRemote.h:63
StringExtractor::GetHexByteString
size_t GetHexByteString(std::string &str)
Definition: StringExtractor.cpp:298
StringExtractorGDBRemote::eServerPacketType_vCont
@ eServerPacketType_vCont
Definition: StringExtractorGDBRemote.h:137
StringExtractorGDBRemote::SetResponseValidatorToOKErrorNotSupported
void SetResponseValidatorToOKErrorNotSupported()
Definition: StringExtractorGDBRemote.cpp:617
StringExtractorGDBRemote::ServerPacketType
ServerPacketType
Definition: StringExtractorGDBRemote.h:46
StringExtractorGDBRemote::eServerPacketType_jThreadsInfo
@ eServerPacketType_jThreadsInfo
Definition: StringExtractorGDBRemote.h:108
StringExtractorGDBRemote::eServerPacketType_s
@ eServerPacketType_s
Definition: StringExtractorGDBRemote.h:156
StringExtractorGDBRemote::eServerPacketType_vFile_exists
@ eServerPacketType_vFile_exists
Definition: StringExtractorGDBRemote.h:89
lldb_private::Status
Definition: Status.h:44
StringExtractorGDBRemote::ValidateResponse
bool ValidateResponse() const
Definition: StringExtractorGDBRemote.cpp:632
uint32_t
StringExtractorGDBRemote::eServerPacketType_qsThreadInfo
@ eServerPacketType_qsThreadInfo
Definition: StringExtractorGDBRemote.h:109
StringExtractorGDBRemote::SetResponseValidator
void SetResponseValidator(ResponseValidatorCallback callback, void *baton)
Definition: StringExtractorGDBRemote.cpp:611
StringExtractorGDBRemote::eServerPacketType_notify
@ eServerPacketType_notify
Definition: StringExtractorGDBRemote.h:166
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
StringExtractorGDBRemote::eServerPacketType_vFile_pwrite
@ eServerPacketType_vFile_pwrite
Definition: StringExtractorGDBRemote.h:86
StringExtractorGDBRemote::eServerPacketType_QEnableErrorStrings
@ eServerPacketType_QEnableErrorStrings
Definition: StringExtractorGDBRemote.h:70
StringExtractorGDBRemote::eNack
@ eNack
Definition: StringExtractorGDBRemote.h:187
StringExtractor::m_index
uint64_t m_index
When extracting data from a packet, this index will march along as things get extracted.
Definition: StringExtractor.h:118
StringExtractorGDBRemote::eServerPacketType_interrupt
@ eServerPacketType_interrupt
Definition: StringExtractorGDBRemote.h:51
StringExtractorGDBRemote::eServerPacketType_ack
@ eServerPacketType_ack
Definition: StringExtractorGDBRemote.h:48
StringExtractorGDBRemote::eServerPacketType_qFileLoadAddress
@ eServerPacketType_qFileLoadAddress
Definition: StringExtractorGDBRemote.h:68
StringExtractorGDBRemote::IsOKResponse
bool IsOKResponse() const
Definition: StringExtractorGDBRemote.cpp:472
StringExtractorGDBRemote::eServerPacketType_jLLDBTraceStop
@ eServerPacketType_jLLDBTraceStop
Definition: StringExtractorGDBRemote.h:170
StringExtractorGDBRemote::eServerPacketType_QEnvironmentHexEncoded
@ eServerPacketType_QEnvironmentHexEncoded
Definition: StringExtractorGDBRemote.h:96
StringExtractorGDBRemote::eServerPacketType_qEcho
@ eServerPacketType_qEcho
Definition: StringExtractorGDBRemote.h:56
StringExtractorGDBRemote::eServerPacketType_QLaunchArch
@ eServerPacketType_QLaunchArch
Definition: StringExtractorGDBRemote.h:71
JSONResponseValidator
static bool JSONResponseValidator(void *, const StringExtractorGDBRemote &response)
Definition: StringExtractorGDBRemote.cpp:545
StringExtractorGDBRemote::eServerPacketType_qPlatform_shell
@ eServerPacketType_qPlatform_shell
Definition: StringExtractorGDBRemote.h:80
StringExtractorGDBRemote::eServerPacketType_vFile_mode
@ eServerPacketType_vFile_mode
Definition: StringExtractorGDBRemote.h:88
StringExtractorGDBRemote::eServerPacketType_m
@ eServerPacketType_m
Definition: StringExtractorGDBRemote.h:152
StringExtractorGDBRemote::eServerPacketType_H
@ eServerPacketType_H
Definition: StringExtractorGDBRemote.h:149
StringExtractorGDBRemote::eServerPacketType_qShlibInfoAddr
@ eServerPacketType_qShlibInfoAddr
Definition: StringExtractorGDBRemote.h:119
StringExtractorGDBRemote::eServerPacketType_qGetProfileData
@ eServerPacketType_qGetProfileData
Definition: StringExtractorGDBRemote.h:112
StringExtractorGDBRemote::eServerPacketType_qGetWorkingDir
@ eServerPacketType_qGetWorkingDir
Definition: StringExtractorGDBRemote.h:67
StringExtractorGDBRemote
Definition: StringExtractorGDBRemote.h:21
StringExtractorGDBRemote::eServerPacketType_z
@ eServerPacketType_z
Definition: StringExtractorGDBRemote.h:162
StringExtractorGDBRemote::eServerPacketType_C
@ eServerPacketType_C
Definition: StringExtractorGDBRemote.h:145
StringExtractorGDBRemote::eServerPacketType_QPassSignals
@ eServerPacketType_QPassSignals
Definition: StringExtractorGDBRemote.h:98
StringExtractorGDBRemote::eServerPacketType_vAttach
@ eServerPacketType_vAttach
Definition: StringExtractorGDBRemote.h:133
StringExtractorGDBRemote::eServerPacketType_p
@ eServerPacketType_p
Definition: StringExtractorGDBRemote.h:154
StringExtractorGDBRemote::GetError
uint8_t GetError()
Definition: StringExtractorGDBRemote.cpp:489
StringExtractorGDBRemote::eServerPacketType_qHostInfo
@ eServerPacketType_qHostInfo
Definition: StringExtractorGDBRemote.h:58
StringExtractorGDBRemote::eServerPacketType_S
@ eServerPacketType_S
Definition: StringExtractorGDBRemote.h:157
StringExtractorGDBRemote::m_validator
ResponseValidatorCallback m_validator
Definition: StringExtractorGDBRemote.h:217
StringExtractorGDBRemote::eServerPacketType_QMemTags
@ eServerPacketType_QMemTags
Definition: StringExtractorGDBRemote.h:175
StringExtractorGDBRemote::eServerPacketType_vCtrlC
@ eServerPacketType_vCtrlC
Definition: StringExtractorGDBRemote.h:181
StringExtractorGDBRemote::eServerPacketType_QSetSTDIN
@ eServerPacketType_QSetSTDIN
Definition: StringExtractorGDBRemote.h:74
StringExtractorGDBRemote::eServerPacketType_qsProcessInfo
@ eServerPacketType_qsProcessInfo
Definition: StringExtractorGDBRemote.h:54
StringExtractorGDBRemote::eServerPacketType_k
@ eServerPacketType_k
Definition: StringExtractorGDBRemote.h:151
StringExtractorGDBRemote::eServerPacketType_vFile_open
@ eServerPacketType_vFile_open
Definition: StringExtractorGDBRemote.h:83
StringExtractorGDBRemote::eServerPacketType_QThreadSuffixSupported
@ eServerPacketType_QThreadSuffixSupported
Definition: StringExtractorGDBRemote.h:106
PACKET_MATCHES
#define PACKET_MATCHES(s)
StringExtractorGDBRemote::eServerPacketType_qStepPacketSupported
@ eServerPacketType_qStepPacketSupported
Definition: StringExtractorGDBRemote.h:120
StringExtractorGDBRemote::eServerPacketType_qGetPid
@ eServerPacketType_qGetPid
Definition: StringExtractorGDBRemote.h:111
StringExtractorGDBRemote::eServerPacketType_qRegisterInfo
@ eServerPacketType_qRegisterInfo
Definition: StringExtractorGDBRemote.h:118
StringExtractorGDBRemote::eServerPacketType_qVAttachOrWaitSupported
@ eServerPacketType_qVAttachOrWaitSupported
Definition: StringExtractorGDBRemote.h:125
UINT64_MAX
#define UINT64_MAX
Definition: lldb-defines.h:23
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
StringExtractorGDBRemote::eServerPacketType_vFile_close
@ eServerPacketType_vFile_close
Definition: StringExtractorGDBRemote.h:84
StringExtractorGDBRemote::IsNormalResponse
bool IsNormalResponse() const
Definition: StringExtractorGDBRemote.cpp:480