OLD | NEW |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #ifndef DEBUGGER_RSP_RSP_PACKETS_H_ | 4 #ifndef DEBUGGER_RSP_RSP_PACKETS_H_ |
5 #define DEBUGGER_RSP_RSP_PACKETS_H_ | 5 #define DEBUGGER_RSP_RSP_PACKETS_H_ |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 class ErrorReply; | 32 class ErrorReply; |
33 class OkReply; | 33 class OkReply; |
34 class SetCurrentThreadCommand; | 34 class SetCurrentThreadCommand; |
35 class GetCurrentThreadCommand; | 35 class GetCurrentThreadCommand; |
36 class GetCurrentThreadReply; | 36 class GetCurrentThreadReply; |
37 class ContinueCommand; | 37 class ContinueCommand; |
38 class StepCommand; | 38 class StepCommand; |
39 class IsThreadAliveCommand; | 39 class IsThreadAliveCommand; |
40 class QXferFeaturesReadCommand; | 40 class QXferFeaturesReadCommand; |
41 class QXferReply; | 41 class QXferReply; |
| 42 class GetOffsetsCommand; |
| 43 class GetOffsetsReply; |
42 class GetThreadInfoCommand; | 44 class GetThreadInfoCommand; |
43 class GetThreadInfoReply; | 45 class GetThreadInfoReply; |
44 | 46 |
45 /// Root class for all RSP packets. | 47 /// Root class for all RSP packets. |
46 class Packet { | 48 class Packet { |
47 public: | 49 public: |
48 Packet() {} | 50 Packet() {} |
49 virtual ~Packet() {} | 51 virtual ~Packet() {} |
50 | 52 |
51 /// Creates a new object on the heap. | 53 /// Creates a new object on the heap. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 virtual void Visit(SetCurrentThreadCommand* packet) {} | 127 virtual void Visit(SetCurrentThreadCommand* packet) {} |
126 virtual void Visit(GetCurrentThreadCommand* packet) {} | 128 virtual void Visit(GetCurrentThreadCommand* packet) {} |
127 virtual void Visit(GetCurrentThreadReply* packet) {} | 129 virtual void Visit(GetCurrentThreadReply* packet) {} |
128 virtual void Visit(ContinueCommand* packet) {} | 130 virtual void Visit(ContinueCommand* packet) {} |
129 virtual void Visit(StepCommand* packet) {} | 131 virtual void Visit(StepCommand* packet) {} |
130 virtual void Visit(IsThreadAliveCommand* packet) {} | 132 virtual void Visit(IsThreadAliveCommand* packet) {} |
131 virtual void Visit(QXferFeaturesReadCommand* packet) {} | 133 virtual void Visit(QXferFeaturesReadCommand* packet) {} |
132 virtual void Visit(QXferReply* packet) {} | 134 virtual void Visit(QXferReply* packet) {} |
133 virtual void Visit(GetThreadInfoCommand* packet) {} | 135 virtual void Visit(GetThreadInfoCommand* packet) {} |
134 virtual void Visit(GetThreadInfoReply* packet) {} | 136 virtual void Visit(GetThreadInfoReply* packet) {} |
| 137 virtual void Visit(GetOffsetsCommand* packet) {} |
| 138 virtual void Visit(GetOffsetsReply* packet) {} |
135 }; | 139 }; |
136 | 140 |
137 /// This class is used in |packet_cast| casting template. | 141 /// This class is used in |packet_cast| casting template. |
138 class TypingPacketVisitor : public PacketVisitor { | 142 class TypingPacketVisitor : public PacketVisitor { |
139 public: | 143 public: |
140 TypingPacketVisitor() : type_(0) {} | 144 TypingPacketVisitor() : type_(0) {} |
141 | 145 |
142 virtual void Visit(EmptyPacket* packet) { type_ = 1;} | 146 virtual void Visit(EmptyPacket* packet) { type_ = 1;} |
143 virtual void Visit(QuerySupportedCommand* packet) { type_ = 2;} | 147 virtual void Visit(QuerySupportedCommand* packet) { type_ = 2;} |
144 virtual void Visit(QuerySupportedReply* packet) { type_ = 3;} | 148 virtual void Visit(QuerySupportedReply* packet) { type_ = 3;} |
145 virtual void Visit(GetStopReasonCommand* packet) { type_ = 4;} | 149 virtual void Visit(GetStopReasonCommand* packet) { type_ = 4;} |
146 virtual void Visit(StopReply* packet) { type_ = 5;} | 150 virtual void Visit(StopReply* packet) { type_ = 5;} |
147 virtual void Visit(ReadMemoryCommand* packet) { type_ = 6;} | 151 virtual void Visit(ReadMemoryCommand* packet) { type_ = 6;} |
148 virtual void Visit(WriteMemoryCommand* packet) { type_ = 7;} | 152 virtual void Visit(WriteMemoryCommand* packet) { type_ = 7;} |
149 virtual void Visit(BlobReply* packet) { type_ = 8;} | 153 virtual void Visit(BlobReply* packet) { type_ = 8;} |
150 virtual void Visit(ReadRegistersCommand* packet) { type_ = 9;} | 154 virtual void Visit(ReadRegistersCommand* packet) { type_ = 9;} |
151 virtual void Visit(WriteRegistersCommand* packet) { type_ = 10;} | 155 virtual void Visit(WriteRegistersCommand* packet) { type_ = 10;} |
152 virtual void Visit(ErrorReply* packet) { type_ = 11;} | 156 virtual void Visit(ErrorReply* packet) { type_ = 11;} |
153 virtual void Visit(OkReply* packet) { type_ = 12;} | 157 virtual void Visit(OkReply* packet) { type_ = 12;} |
154 virtual void Visit(SetCurrentThreadCommand* packet) { type_ = 13;} | 158 virtual void Visit(SetCurrentThreadCommand* packet) { type_ = 13;} |
155 virtual void Visit(GetCurrentThreadCommand* packet) { type_ = 14;} | 159 virtual void Visit(GetCurrentThreadCommand* packet) { type_ = 14;} |
156 virtual void Visit(GetCurrentThreadReply* packet) { type_ = 15;} | 160 virtual void Visit(GetCurrentThreadReply* packet) { type_ = 15;} |
157 virtual void Visit(ContinueCommand* packet) { type_ = 16;} | 161 virtual void Visit(ContinueCommand* packet) { type_ = 16;} |
158 virtual void Visit(StepCommand* packet) { type_ = 17;} | 162 virtual void Visit(StepCommand* packet) { type_ = 17;} |
159 virtual void Visit(IsThreadAliveCommand* packet) { type_ = 18;} | 163 virtual void Visit(IsThreadAliveCommand* packet) { type_ = 18;} |
160 virtual void Visit(QXferFeaturesReadCommand* packet) { type_ = 19;} | 164 virtual void Visit(QXferFeaturesReadCommand* packet) { type_ = 19;} |
161 virtual void Visit(QXferReply* packet) { type_ = 20;} | 165 virtual void Visit(QXferReply* packet) { type_ = 20;} |
162 virtual void Visit(GetThreadInfoCommand* packet) { type_ = 21;} | 166 virtual void Visit(GetThreadInfoCommand* packet) { type_ = 21;} |
163 virtual void Visit(GetThreadInfoReply* packet) { type_ = 22;} | 167 virtual void Visit(GetThreadInfoReply* packet) { type_ = 22;} |
| 168 virtual void Visit(GetOffsetsCommand* packet) { type_ = 23;} |
| 169 virtual void Visit(GetOffsetsReply* packet) { type_ = 24;} |
164 | 170 |
165 int type_; | 171 int type_; |
166 }; | 172 }; |
167 | 173 |
168 template <class T> | 174 template <class T> |
169 T* packet_cast(Packet* obj) { | 175 T* packet_cast(Packet* obj) { |
170 if (NULL == obj) | 176 if (NULL == obj) |
171 return NULL; | 177 return NULL; |
172 | 178 |
173 TypingPacketVisitor vis; | 179 TypingPacketVisitor vis; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 void set_value(uint32_t x) { value_ = x; } | 218 void set_value(uint32_t x) { value_ = x; } |
213 | 219 |
214 protected: | 220 protected: |
215 std::string word_; | 221 std::string word_; |
216 uint32_t value_; | 222 uint32_t value_; |
217 }; | 223 }; |
218 } // namespace rsp | 224 } // namespace rsp |
219 | 225 |
220 #endif // DEBUGGER_RSP_RSP_PACKETS_H_ | 226 #endif // DEBUGGER_RSP_RSP_PACKETS_H_ |
221 | 227 |
OLD | NEW |