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

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
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.h » ('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) 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();
139 ASSERT(debugger != NULL);
140 if (setjmp(*jump.Set()) == 0) {
141 Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line);
142 if (bpt == NULL) {
143 result = Api::NewError("%s: could not set breakpoint at line %d of '%s'",
144 CURRENT_FUNC, line, script_url.ToCString());
145 } else {
146 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt);
147 }
148 } else {
149 SetupErrorResult(&result);
150 }
151 isolate->set_long_jump_base(base);
152 return result;
153 }
154
155
110 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( 156 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
111 Dart_Handle library_in, 157 Dart_Handle library_in,
112 Dart_Handle class_name_in, 158 Dart_Handle class_name_in,
113 Dart_Handle function_name_in, 159 Dart_Handle function_name_in,
114 Dart_Breakpoint* breakpoint) { 160 Dart_Breakpoint* breakpoint) {
115 Isolate* isolate = Isolate::Current(); 161 Isolate* isolate = Isolate::Current();
116 DARTSCOPE(isolate); 162 DARTSCOPE(isolate);
117 163
118 Library& library = Library::Handle(); 164 Library& library = Library::Handle();
119 String& class_name = String::Handle(); 165 String& class_name = String::Handle();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 203 }
158 } else { 204 } else {
159 SetupErrorResult(&result); 205 SetupErrorResult(&result);
160 } 206 }
161 isolate->set_long_jump_base(base); 207 isolate->set_long_jump_base(base);
162 return result; 208 return result;
163 } 209 }
164 210
165 211
166 } // namespace dart 212 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698