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

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

Issue 9240014: Set breakpoint at url, line number (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 const String& url = String::Handle(frame->SourceUrl()); 100 const String& url = String::Handle(frame->SourceUrl());
101 *script_url = Api::NewLocalHandle(url); 101 *script_url = Api::NewLocalHandle(url);
102 } 102 }
103 if (line_number != NULL) { 103 if (line_number != NULL) {
104 *line_number = frame->LineNumber(); 104 *line_number = frame->LineNumber();
105 } 105 }
106 return Api::True(); 106 return Api::True();
107 } 107 }
108 108
109 109
110 DART_EXPORT Dart_Handle Dart_SetBreakpointAtLine(
111 Dart_Handle script_url_in,
112 Dart_Handle line_number_in,
113 Dart_Breakpoint* breakpoint) {
114 Isolate* isolate = Isolate::Current();
115 DARTSCOPE(isolate);
116
117 String& script_url = String::Handle();
118 Integer& line_number = Integer::Handle();
119 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
120 UNWRAP_AND_CHECK_PARAM(Integer, line_number, line_number_in);
121 CHECK_NOT_NULL(breakpoint);
122
123 if (!line_number.IsSmi()) {
124 return Api::NewError("%s: line number out of range", CURRENT_FUNC);
125 }
126 intptr_t line = line_number.AsInt64Value();
127
128 const char* msg = CheckIsolateState(isolate);
129 if (msg != NULL) {
130 return Api::NewError(msg);
131 }
132
133 LongJump* base = isolate->long_jump_base();
134 LongJump jump;
135 isolate->set_long_jump_base(&jump);
136 Dart_Handle result = Api::True();
137 *breakpoint = NULL;
138 Debugger* debugger = isolate->debugger();
siva 2012/01/18 01:32:03 ASSERT(debugger != NULL);
hausner 2012/01/18 23:26:38 Done.
139 if (setjmp(*jump.Set()) == 0) {
140 Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line);
141 if (bpt == NULL) {
142 result = Api::NewError("%s: could not set breakpoint at line %d of '%s'",
143 CURRENT_FUNC, line, script_url.ToCString());
144 } else {
145 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt);
146 }
147 } else {
148 SetupErrorResult(&result);
149 }
150 isolate->set_long_jump_base(base);
151 return result;
152 }
153
154
110 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( 155 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
111 Dart_Handle library_in, 156 Dart_Handle library_in,
112 Dart_Handle class_name_in, 157 Dart_Handle class_name_in,
113 Dart_Handle function_name_in, 158 Dart_Handle function_name_in,
114 Dart_Breakpoint* breakpoint) { 159 Dart_Breakpoint* breakpoint) {
115 Isolate* isolate = Isolate::Current(); 160 Isolate* isolate = Isolate::Current();
116 DARTSCOPE(isolate); 161 DARTSCOPE(isolate);
117 162
118 Library& library = Library::Handle(); 163 Library& library = Library::Handle();
119 String& class_name = String::Handle(); 164 String& class_name = String::Handle();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 202 }
158 } else { 203 } else {
159 SetupErrorResult(&result); 204 SetupErrorResult(&result);
160 } 205 }
161 isolate->set_long_jump_base(base); 206 isolate->set_long_jump_base(base);
162 return result; 207 return result;
163 } 208 }
164 209
165 210
166 } // namespace dart 211 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698