OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef VM_SERVICE_EVENT_H_ |
| 6 #define VM_SERVICE_EVENT_H_ |
| 7 |
| 8 #include "vm/debugger.h" |
| 9 |
| 10 class DebuggerEvent; |
| 11 |
| 12 namespace dart { |
| 13 |
| 14 class ServiceEvent { |
| 15 public: |
| 16 enum EventType { |
| 17 kIsolateStart, // New isolate has started |
| 18 kIsolateExit, // Isolate has exited |
| 19 |
| 20 kPauseStart, // --pause-isolates-on-start |
| 21 kPauseExit, // --pause-isolates-on-exit |
| 22 kPauseBreakpoint, |
| 23 kPauseInterrupted, |
| 24 kPauseException, |
| 25 kResume, |
| 26 |
| 27 kBreakpointAdded, |
| 28 kBreakpointResolved, |
| 29 kBreakpointRemoved, |
| 30 |
| 31 kIllegal, |
| 32 }; |
| 33 |
| 34 ServiceEvent(Isolate* isolate, EventType event_type) |
| 35 : isolate_(isolate), |
| 36 type_(event_type), |
| 37 breakpoint_(NULL), |
| 38 top_frame_(NULL), |
| 39 exception_(NULL) {} |
| 40 |
| 41 explicit ServiceEvent(const DebuggerEvent* debugger_event); |
| 42 |
| 43 Isolate* isolate() const { return isolate_; } |
| 44 |
| 45 EventType type() const { return type_; } |
| 46 |
| 47 SourceBreakpoint* breakpoint() const { |
| 48 return breakpoint_; |
| 49 } |
| 50 void set_breakpoint(SourceBreakpoint* bpt) { |
| 51 ASSERT(type() == kPauseBreakpoint || |
| 52 type() == kBreakpointAdded || |
| 53 type() == kBreakpointResolved || |
| 54 type() == kBreakpointRemoved); |
| 55 breakpoint_ = bpt; |
| 56 } |
| 57 |
| 58 ActivationFrame* top_frame() const { |
| 59 return top_frame_; |
| 60 } |
| 61 void set_top_frame(ActivationFrame* frame) { |
| 62 ASSERT(type() == kPauseBreakpoint || |
| 63 type() == kPauseInterrupted || |
| 64 type() == kPauseException || |
| 65 type() == kResume); |
| 66 top_frame_ = frame; |
| 67 } |
| 68 |
| 69 const Object* exception() const { |
| 70 return exception_; |
| 71 } |
| 72 void set_exception(const Object* exception) { |
| 73 ASSERT(type_ == kPauseException); |
| 74 exception_ = exception; |
| 75 } |
| 76 |
| 77 void PrintJSON(JSONStream* js) const; |
| 78 |
| 79 static const char* EventTypeToCString(EventType type); |
| 80 |
| 81 private: |
| 82 Isolate* isolate_; |
| 83 EventType type_; |
| 84 SourceBreakpoint* breakpoint_; |
| 85 ActivationFrame* top_frame_; |
| 86 const Object* exception_; |
| 87 }; |
| 88 |
| 89 } // namespace dart |
| 90 |
| 91 #endif // VM_SERVICE_EVENT_H_ |
OLD | NEW |