Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: runtime/vm/service_event.cc

Issue 1132153002: Add Debugger.inspect. 1976 here we come! (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/service_event.h ('k') | sdk/lib/_internal/compiler/js_lib/developer_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/service_event.h" 5 #include "vm/service_event.h"
6 6
7 namespace dart { 7 namespace dart {
8 8
9 // Translate from the legacy DebugEvent to a ServiceEvent. 9 // Translate from the legacy DebugEvent to a ServiceEvent.
10 static ServiceEvent::EventType TranslateEventType( 10 static ServiceEvent::EventType TranslateEventType(
(...skipping 19 matching lines...) Expand all
30 return ServiceEvent::kIllegal; 30 return ServiceEvent::kIllegal;
31 } 31 }
32 } 32 }
33 33
34 ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event) 34 ServiceEvent::ServiceEvent(const DebuggerEvent* debugger_event)
35 : isolate_(debugger_event->isolate()), 35 : isolate_(debugger_event->isolate()),
36 type_(TranslateEventType(debugger_event->type())), 36 type_(TranslateEventType(debugger_event->type())),
37 breakpoint_(NULL), 37 breakpoint_(NULL),
38 top_frame_(NULL), 38 top_frame_(NULL),
39 exception_(NULL), 39 exception_(NULL),
40 inspectee_(NULL),
40 gc_stats_(NULL) { 41 gc_stats_(NULL) {
41 DebuggerEvent::EventType type = debugger_event->type(); 42 DebuggerEvent::EventType type = debugger_event->type();
42 if (type == DebuggerEvent::kBreakpointReached) { 43 if (type == DebuggerEvent::kBreakpointReached) {
43 set_breakpoint(debugger_event->breakpoint()); 44 set_breakpoint(debugger_event->breakpoint());
44 } 45 }
45 if (type == DebuggerEvent::kExceptionThrown) { 46 if (type == DebuggerEvent::kExceptionThrown) {
46 set_exception(debugger_event->exception()); 47 set_exception(debugger_event->exception());
47 } 48 }
48 if (type == DebuggerEvent::kBreakpointReached || 49 if (type == DebuggerEvent::kBreakpointReached ||
49 type == DebuggerEvent::kIsolateInterrupted || 50 type == DebuggerEvent::kIsolateInterrupted ||
(...skipping 24 matching lines...) Expand all
74 case kResume: 75 case kResume:
75 return "Resume"; 76 return "Resume";
76 case kBreakpointAdded: 77 case kBreakpointAdded:
77 return "BreakpointAdded"; 78 return "BreakpointAdded";
78 case kBreakpointResolved: 79 case kBreakpointResolved:
79 return "BreakpointResolved"; 80 return "BreakpointResolved";
80 case kBreakpointRemoved: 81 case kBreakpointRemoved:
81 return "BreakpointRemoved"; 82 return "BreakpointRemoved";
82 case kGC: 83 case kGC:
83 return "GC"; // TODO(koda): Change to GarbageCollected. 84 return "GC"; // TODO(koda): Change to GarbageCollected.
85 case kInspect:
86 return "Inspect";
84 default: 87 default:
85 UNREACHABLE(); 88 UNREACHABLE();
86 return "Unknown"; 89 return "Unknown";
87 } 90 }
88 } 91 }
89 92
90 93
91 void ServiceEvent::PrintJSON(JSONStream* js) const { 94 void ServiceEvent::PrintJSON(JSONStream* js) const {
92 JSONObject jsobj(js); 95 JSONObject jsobj(js);
93 jsobj.AddProperty("type", "ServiceEvent"); 96 jsobj.AddProperty("type", "ServiceEvent");
94 jsobj.AddProperty("eventType", EventTypeToCString(type())); 97 jsobj.AddProperty("eventType", EventTypeToCString(type()));
95 jsobj.AddProperty("isolate", isolate()); 98 jsobj.AddProperty("isolate", isolate());
96 if (breakpoint() != NULL) { 99 if (breakpoint() != NULL) {
97 jsobj.AddProperty("breakpoint", breakpoint()); 100 jsobj.AddProperty("breakpoint", breakpoint());
98 } 101 }
99 if (top_frame() != NULL) { 102 if (top_frame() != NULL) {
100 JSONObject jsFrame(&jsobj, "topFrame"); 103 JSONObject jsFrame(&jsobj, "topFrame");
101 top_frame()->PrintToJSONObject(&jsFrame); 104 top_frame()->PrintToJSONObject(&jsFrame);
102 } 105 }
103 if (exception() != NULL) { 106 if (exception() != NULL) {
104 jsobj.AddProperty("exception", *(exception())); 107 jsobj.AddProperty("exception", *(exception()));
105 } 108 }
109 if (inspectee() != NULL) {
110 jsobj.AddProperty("inspectee", *(inspectee()));
111 }
106 if (gc_stats() != NULL) { 112 if (gc_stats() != NULL) {
107 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_)); 113 jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_));
108 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj); 114 isolate()->heap()->PrintToJSONObject(Heap::kNew, &jsobj);
109 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj); 115 isolate()->heap()->PrintToJSONObject(Heap::kOld, &jsobj);
110 } 116 }
111 } 117 }
112 118
113 } // namespace dart 119 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/service_event.h ('k') | sdk/lib/_internal/compiler/js_lib/developer_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698