OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 #ifndef DEBUGGER_RSP_RSP_THREADS_PACKETS_H_ | |
5 #define DEBUGGER_RSP_RSP_THREADS_PACKETS_H_ | |
6 #include <deque> | |
7 #include <string> | |
8 #include "debugger/rsp/rsp_packets.h" | |
9 namespace rsp { | |
10 /// Set thread for subsequent operations | |
11 /// Example: | |
12 /// "Hg-1" - all threads | |
13 /// "Hc1234" - select thread with tid=4660 | |
14 class SetCurrentThreadCommand : public Packet { | |
15 public: | |
16 enum Subtype {FOR_READ, FOR_CONTINUE}; | |
17 | |
18 SetCurrentThreadCommand() : subtype_(FOR_CONTINUE) {} | |
19 explicit SetCurrentThreadCommand(Subtype subtype) : subtype_(subtype) {} | |
20 virtual Packet* Clone() const { | |
21 return new SetCurrentThreadCommand(subtype_); | |
22 } | |
23 virtual void AcceptVisitor(PacketVisitor* vis) { vis->Visit(this); } | |
24 virtual bool FromBlob(const std::string& type, debug::Blob* message); | |
25 virtual void ToBlob(debug::Blob* message) const; | |
26 | |
27 Subtype subtype() const { return subtype_; } | |
28 void set_subtype(Subtype s) { subtype_ = s; } | |
29 uint32_t thread_id() const { return thread_id_; } | |
30 void set_thread_id(uint32_t id) { thread_id_ = id; } | |
31 | |
32 protected: | |
33 Subtype subtype_; | |
34 uint32_t thread_id_; | |
35 }; | |
36 | |
37 /// Get current thread command. | |
38 /// Example: "qC" | |
39 class GetCurrentThreadCommand : public OneWordPacket { | |
40 public: | |
41 GetCurrentThreadCommand() : OneWordPacket("qC") {} | |
42 virtual Packet* Clone() const { return new GetCurrentThreadCommand; } | |
43 virtual void AcceptVisitor(PacketVisitor* vis) { vis->Visit(this); } | |
44 }; | |
45 | |
46 /// Reply to get current thread command. | |
47 /// Example: "QC1234" - current thread tid is 4660 | |
48 class GetCurrentThreadReply : public WordWithIntPacket { | |
49 public: | |
50 GetCurrentThreadReply() : WordWithIntPacket("QC") {} | |
51 virtual Packet* Clone() const { return new GetCurrentThreadReply; } | |
52 virtual void AcceptVisitor(PacketVisitor* vis) { vis->Visit(this); } | |
53 }; | |
54 | |
55 /// Find out if the thread is alive | |
56 /// Example: "T1234" | |
57 class IsThreadAliveCommand : public WordWithIntPacket { | |
58 public: | |
59 IsThreadAliveCommand() : WordWithIntPacket("T") {} | |
60 virtual Packet* Clone() const { return new IsThreadAliveCommand; } | |
61 virtual void AcceptVisitor(PacketVisitor* vis) { vis->Visit(this); } | |
62 }; | |
63 | |
64 /// Request to get list of threads | |
65 /// Example: "qsThreadInfo" | |
66 class GetThreadInfoCommand : public Packet { | |
67 public: | |
68 GetThreadInfoCommand() : get_more_(false) {} | |
69 virtual Packet* Clone() const { return new GetThreadInfoCommand; } | |
70 virtual void AcceptVisitor(PacketVisitor* vis) { vis->Visit(this); } | |
71 virtual bool FromBlob(const std::string& type, debug::Blob* message); | |
72 virtual void ToBlob(debug::Blob* message) const; | |
73 | |
74 bool get_more() const { return get_more_; } | |
75 void set_get_more(bool more) { get_more_ = more; } | |
76 | |
77 private: | |
78 bool get_more_; | |
79 }; | |
80 | |
81 /// Reply to GetThreadInfoCommand | |
82 /// Example: "l1234,a34" | |
83 class GetThreadInfoReply : public Packet { | |
84 public: | |
85 GetThreadInfoReply() : eom_(true) {} | |
86 virtual Packet* Clone() const { return new GetThreadInfoReply; } | |
87 virtual void AcceptVisitor(PacketVisitor* vis) { vis->Visit(this); } | |
88 virtual bool FromBlob(const std::string& type, debug::Blob* message); | |
89 virtual void ToBlob(debug::Blob* message) const; | |
90 | |
91 bool eom() const { return eom_; } | |
92 const std::deque<int>& threads_ids() const { return threads_ids_; } | |
93 | |
94 void set_eom(bool eom) { eom_ = eom; } | |
95 void set_threads_ids(const std::deque<int>& threads_ids) { | |
96 threads_ids_ = threads_ids; } | |
97 | |
98 private: | |
99 bool eom_; | |
100 std::deque<int> threads_ids_; | |
101 }; | |
102 } // namespace rsp | |
103 | |
104 #endif // DEBUGGER_RSP_RSP_THREADS_PACKETS_H_ | |
105 | |
OLD | NEW |