LLDB  mainline
StringExtractorGDBRemote.h
Go to the documentation of this file.
1 //===-- StringExtractorGDBRemote.h ------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
10 #define LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
11 
12 #include "lldb/Utility/Status.h"
14 #include "llvm/ADT/StringRef.h"
15 
16 #include <string>
17 
18 #include <stddef.h>
19 #include <stdint.h>
20 
22 public:
23  typedef bool (*ResponseValidatorCallback)(
24  void *baton, const StringExtractorGDBRemote &response);
25 
27 
28  StringExtractorGDBRemote(llvm::StringRef str)
29  : StringExtractor(str), m_validator(nullptr) {}
30 
31  StringExtractorGDBRemote(const char *cstr)
32  : StringExtractor(cstr), m_validator(nullptr) {}
33 
34  bool ValidateResponse() const;
35 
37 
38  void SetResponseValidator(ResponseValidatorCallback callback, void *baton);
39 
41 
43 
45 
51  eServerPacketType_interrupt, // CTRL+c packet or "\x03"
52  eServerPacketType_A, // Program arguments packet
93  // debug server packages
105 
127 
130 
137 
139 
146  eServerPacketType_I, // stdin notification
159 
162  eServerPacketType_notify, // '%' notification
163 
169  };
170 
172 
174 
176 
177  bool IsOKResponse() const;
178 
179  bool IsUnsupportedResponse() const;
180 
181  bool IsNormalResponse() const;
182 
183  bool IsErrorResponse() const;
184 
185  // Returns zero if the packet isn't a EXX packet where XX are two hex digits.
186  // Otherwise the error encoded in XX is returned.
187  uint8_t GetError();
188 
190 
191  size_t GetEscapedBinaryData(std::string &str);
192 
193 protected:
196 };
197 
198 #endif // LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
void SetResponseValidator(ResponseValidatorCallback callback, void *baton)
StringExtractorGDBRemote(llvm::StringRef str)
ResponseValidatorCallback m_validator
StringExtractorGDBRemote(const char *cstr)
ServerPacketType GetServerPacketType() const
void CopyResponseValidator(const StringExtractorGDBRemote &rhs)
size_t GetEscapedBinaryData(std::string &str)
ResponseType GetResponseType() const
bool(* ResponseValidatorCallback)(void *baton, const StringExtractorGDBRemote &response)
An error handling class.
Definition: Status.h:44