1 #ifndef ROSE_BinaryAnalysis_Debugger_GdbResponse_H
2 #define ROSE_BinaryAnalysis_Debugger_GdbResponse_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_DEBUGGER_GDB
6 #include <Rose/BinaryAnalysis/Debugger/Exception.h>
10 namespace BinaryAnalysis {
33 TokenType type_ = TOK_EOF;
39 Token(TokenType type,
size_t begin,
size_t end)
40 : type_(type), begin_(begin), end_(end) {
41 ASSERT_require(end >= begin);
44 TokenType type()
const {
48 size_t begin()
const {
65 std::vector<Token> tokens_;
69 : content_(sentence) {}
71 const Token& operator[](
size_t lookahead);
72 void consume(
size_t n = 1);
73 std::string lexeme(
size_t lookahead)
const;
74 const std::string& content()
const;
104 explicit operator bool()
const {
105 return rclass != ResultClass::UNSPECIFIED;
115 explicit operator bool()
const {
116 return aclass != AsyncClass::UNSPECIFIED;
134 static GdbResponse
parse(
const std::string &line);
137 void print(std::ostream&)
const;
141 static Exception syntaxError(std::string mesg, TokenStream&,
size_t);
144 static void parseResultRecord(TokenStream&, GdbResponse&);
145 static std::pair<AsyncClass, Yaml::Node> parseAsyncOutput(TokenStream&);
146 static void parseExecAsyncOutput(TokenStream&, GdbResponse&);
147 static void parseStatusAsyncOutput(TokenStream&, GdbResponse&);
148 static void parseNotifyAsyncOutput(TokenStream&, GdbResponse&);
149 static void parseConsoleStreamOutput(TokenStream&, GdbResponse&);
150 static void parseTargetStreamOutput(TokenStream&, GdbResponse&);
151 static void parseLogStreamOutput(TokenStream&, GdbResponse&);
152 static std::pair<std::string, Yaml::Node> parseResult(TokenStream&);
156 static std::string nodeToString(
const Yaml::Node&,
const std::string&);
160 std::ostream& operator<<(std::ostream&,
const GdbResponse&);
Sawyer::Language::Clexer::Token Token
A token parsed from the input file.
Stack parameter order is unknown or unspecified.
Error messages that indicate an abnormal situation from which the program was able to at least partia...
Main namespace for the ROSE library.
Sawyer::Language::Clexer::TokenStream TokenStream
A stream of tokens from the input file.
void print(const StackVariables &, const Partitioner2::PartitionerConstPtr &, std::ostream &out, const std::string &prefix="")
Print info about multiple local variables.
const char * AsyncClass(int64_t)
Convert Rose::BinaryAnalysis::Debugger::GdbResponse::AsyncClass enum constant to a string...
const char * ResultClass(int64_t)
Convert Rose::BinaryAnalysis::Debugger::Gdb::Response::ResultRecord::ResultClass enum constant to a s...
void notify(variables_map &)
Transfer map to C++ variables.
std::enable_if< std::is_integral< IntegralType >::value, Sawyer::Result< IntegralType, std::string > >::type parse(const std::string &s)
Safely convert a string to a number.