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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/debugger_api_impl.cc
===================================================================
--- runtime/vm/debugger_api_impl.cc (revision 3366)
+++ runtime/vm/debugger_api_impl.cc (working copy)
@@ -107,6 +107,51 @@
}
+DART_EXPORT Dart_Handle Dart_SetBreakpointAtLine(
+ Dart_Handle script_url_in,
+ Dart_Handle line_number_in,
+ Dart_Breakpoint* breakpoint) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+
+ String& script_url = String::Handle();
+ Integer& line_number = Integer::Handle();
+ UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
+ UNWRAP_AND_CHECK_PARAM(Integer, line_number, line_number_in);
+ CHECK_NOT_NULL(breakpoint);
+
+ if (!line_number.IsSmi()) {
+ return Api::NewError("%s: line number out of range", CURRENT_FUNC);
+ }
+ intptr_t line = line_number.AsInt64Value();
+
+ const char* msg = CheckIsolateState(isolate);
+ if (msg != NULL) {
+ return Api::NewError(msg);
+ }
+
+ LongJump* base = isolate->long_jump_base();
+ LongJump jump;
+ isolate->set_long_jump_base(&jump);
+ Dart_Handle result = Api::True();
+ *breakpoint = NULL;
+ Debugger* debugger = isolate->debugger();
siva 2012/01/18 01:32:03 ASSERT(debugger != NULL);
hausner 2012/01/18 23:26:38 Done.
+ if (setjmp(*jump.Set()) == 0) {
+ Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line);
+ if (bpt == NULL) {
+ result = Api::NewError("%s: could not set breakpoint at line %d of '%s'",
+ CURRENT_FUNC, line, script_url.ToCString());
+ } else {
+ *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt);
+ }
+ } else {
+ SetupErrorResult(&result);
+ }
+ isolate->set_long_jump_base(base);
+ return result;
+}
+
+
DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
Dart_Handle library_in,
Dart_Handle class_name_in,

Powered by Google App Engine
This is Rietveld 408576698