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

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

Issue 10537065: Debugger break on TypeError, AssertionError (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 Isolate* isolate = Isolate::Current(); 99 Isolate* isolate = Isolate::Current();
100 DARTSCOPE(isolate); 100 DARTSCOPE(isolate);
101 BreakpointHandler* handler = 101 BreakpointHandler* handler =
102 reinterpret_cast<BreakpointHandler*>(bp_handler); 102 reinterpret_cast<BreakpointHandler*>(bp_handler);
103 103
104 isolate->debugger()->SetBreakpointHandler(handler); 104 isolate->debugger()->SetBreakpointHandler(handler);
105 } 105 }
106 106
107 107
108 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL; 108 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL;
109 static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL;
109 110
110 static void DebuggerEventHandler(Debugger::DebuggerEvent* event) { 111 static void DebuggerEventHandler(Debugger::DebuggerEvent* event) {
111 Isolate* isolate = Isolate::Current(); 112 Isolate* isolate = Isolate::Current();
112 ASSERT(isolate != NULL); 113 ASSERT(isolate != NULL);
113 if (event->type == Debugger::kBreakpointResolved) { 114 if (event->type == Debugger::kBreakpointResolved) {
114 if (bp_resolved_handler == NULL) { 115 if (bp_resolved_handler == NULL) {
115 return; 116 return;
116 } 117 }
117 SourceBreakpoint* bpt = event->breakpoint; 118 SourceBreakpoint* bpt = event->breakpoint;
118 ASSERT(bpt != NULL); 119 ASSERT(bpt != NULL);
119 Dart_Handle url = Api::NewHandle(isolate, bpt->SourceUrl()); 120 Dart_Handle url = Api::NewHandle(isolate, bpt->SourceUrl());
120 (*bp_resolved_handler)(bpt->id(), url, bpt->LineNumber()); 121 (*bp_resolved_handler)(bpt->id(), url, bpt->LineNumber());
122 } else if (event->type == Debugger::kExceptionThrown) {
123 if (exc_thrown_handler == NULL) {
124 return;
125 }
126 Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw());
127 Dart_StackTrace trace =
128 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace());
129 (*exc_thrown_handler)(exception, trace);
121 } else { 130 } else {
122 UNIMPLEMENTED(); 131 UNIMPLEMENTED();
123 } 132 }
124 } 133 }
125 134
126 135
127 DART_EXPORT void Dart_SetBreakpointResolvedHandler( 136 DART_EXPORT void Dart_SetBreakpointResolvedHandler(
128 Dart_BreakpointResolvedHandler handler) { 137 Dart_BreakpointResolvedHandler handler) {
129 bp_resolved_handler = handler; 138 bp_resolved_handler = handler;
130 Isolate* isolate = Isolate::Current(); 139 Isolate* isolate = Isolate::Current();
131 DARTSCOPE(isolate); 140 DARTSCOPE(isolate);
132 isolate->debugger()->SetEventHandler(DebuggerEventHandler); 141 isolate->debugger()->SetEventHandler(DebuggerEventHandler);
133 } 142 }
134 143
135 144
145 DART_EXPORT void Dart_SetExceptionThrownHandler(
146 Dart_ExceptionThrownHandler handler) {
147 exc_thrown_handler = handler;
148 Isolate* isolate = Isolate::Current();
149 DARTSCOPE(isolate);
150 isolate->debugger()->SetEventHandler(DebuggerEventHandler);
151 }
152
153
136 DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { 154 DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) {
137 Isolate* isolate = Isolate::Current(); 155 Isolate* isolate = Isolate::Current();
138 DARTSCOPE(isolate); 156 DARTSCOPE(isolate);
139 CHECK_NOT_NULL(trace); 157 CHECK_NOT_NULL(trace);
140 *trace = reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); 158 *trace = reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace());
141 return Api::True(isolate); 159 return Api::True(isolate);
142 } 160 }
143 161
144 162
145 DART_EXPORT Dart_Handle Dart_ActivationFrameInfo( 163 DART_EXPORT Dart_Handle Dart_ActivationFrameInfo(
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 for (int i = 0; i < num_libs; i++) { 628 for (int i = 0; i < num_libs; i++) {
611 lib ^= libs.At(i); 629 lib ^= libs.At(i);
612 ASSERT(!lib.IsNull()); 630 ASSERT(!lib.IsNull());
613 lib_url = lib.url(); 631 lib_url = lib.url();
614 library_url_list.SetAt(i, lib_url); 632 library_url_list.SetAt(i, lib_url);
615 } 633 }
616 return Api::NewHandle(isolate, library_url_list.raw()); 634 return Api::NewHandle(isolate, library_url_list.raw());
617 } 635 }
618 636
619 } // namespace dart 637 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698