1 //===-- StringExtractorGDBRemote.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 utility_StringExtractorGDBRemote_h_ 11 #define utility_StringExtractorGDBRemote_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <string> 16 // Other libraries and framework includes 17 // Project includes 18 #include "Utility/StringExtractor.h" 19 20 class StringExtractorGDBRemote : public StringExtractor 21 { 22 public: 23 24 StringExtractorGDBRemote() : 25 StringExtractor () 26 { 27 } 28 29 StringExtractorGDBRemote(const char *cstr) : 30 StringExtractor (cstr) 31 { 32 } 33 StringExtractorGDBRemote(const StringExtractorGDBRemote& rhs) : 34 StringExtractor (rhs) 35 { 36 } 37 38 virtual ~StringExtractorGDBRemote() 39 { 40 } 41 42 enum ServerPacketType 43 { 44 eServerPacketType_nack = 0, 45 eServerPacketType_ack, 46 eServerPacketType_invalid, 47 eServerPacketType_unimplemented, 48 eServerPacketType_interrupt, // CTRL+c packet or "\x03" 49 eServerPacketType_A, // Program arguments packet 50 eServerPacketType_qfProcessInfo, 51 eServerPacketType_qsProcessInfo, 52 eServerPacketType_qC, 53 eServerPacketType_qGroupName, 54 eServerPacketType_qHostInfo, 55 eServerPacketType_qLaunchGDBServer, 56 eServerPacketType_qLaunchSuccess, 57 eServerPacketType_qProcessInfoPID, 58 eServerPacketType_qSpeedTest, 59 eServerPacketType_qUserName, 60 eServerPacketType_QEnvironment, 61 eServerPacketType_QSetDisableASLR, 62 eServerPacketType_QSetSTDIN, 63 eServerPacketType_QSetSTDOUT, 64 eServerPacketType_QSetSTDERR, 65 eServerPacketType_QSetWorkingDir, 66 eServerPacketType_QStartNoAckMode 67 }; 68 69 ServerPacketType 70 GetServerPacketType () const; 71 72 enum ResponseType 73 { 74 eUnsupported = 0, 75 eAck, 76 eNack, 77 eError, 78 eOK, 79 eResponse 80 }; 81 82 ResponseType 83 GetResponseType () const; 84 85 bool 86 IsOKResponse() const; 87 88 bool 89 IsUnsupportedResponse() const; 90 91 bool 92 IsNormalResponse () const; 93 94 bool 95 IsErrorResponse() const; 96 97 // Returns zero if the packet isn't a EXX packet where XX are two hex 98 // digits. Otherwise the error encoded in XX is returned. 99 uint8_t 100 GetError(); 101 }; 102 103 #endif // utility_StringExtractorGDBRemote_h_ 104