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

Unified Diff: runtime/vm/debugger.cc

Issue 11028040: - Add support to interrupt a running isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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.cc
===================================================================
--- runtime/vm/debugger.cc (revision 13208)
+++ runtime/vm/debugger.cc (working copy)
@@ -28,7 +28,8 @@
DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages");
-static void DefaultBreakpointHandler(SourceBreakpoint* bpt,
+static void DefaultBreakpointHandler(Dart_Port isolate_id,
+ SourceBreakpoint* bpt,
DebuggerStackTrace* stack) {
String& var_name = String::Handle();
Instance& value = Instance::Handle();
@@ -168,7 +169,21 @@
event.type = type;
event.isolate_id = debugger->GetIsolateId();
ASSERT(event.isolate_id != ILLEGAL_ISOLATE_ID);
- (*event_handler_)(&event);
+ if (type == kIsolateInterrupted) {
+ DebuggerStackTrace* stack_trace = debugger->CollectStackTrace();
+ ASSERT(stack_trace->Length() > 0);
+ ASSERT(debugger->stack_trace_ == NULL);
+ ASSERT(debugger->obj_cache_ == NULL);
+ debugger->obj_cache_ = new RemoteObjectCache(64);
+ debugger->stack_trace_ = stack_trace;
+ (*event_handler_)(&event);
+ debugger->stack_trace_ = NULL;
+ debugger->obj_cache_ = NULL; // Remote object cache is zone allocated.
+ // TODO(asiva): Need some work here to be able to single step after
+ // an interrupt.
+ } else {
+ (*event_handler_)(&event);
+ }
}
}
@@ -1337,12 +1352,15 @@
if (notify_frontend) {
resume_action_ = kContinue;
if (bp_handler_ != NULL) {
+ Isolate* isolate = Isolate::Current();
hausner 2012/10/05 18:06:34 Why do you need to get the debugger object through
siva 2012/10/05 22:35:06 Good point, this is not a static function so just
+ ASSERT(isolate != NULL);
+ ASSERT(isolate->debugger() != NULL);
SourceBreakpoint* src_bpt = bpt->src_bpt();
ASSERT(stack_trace_ == NULL);
ASSERT(obj_cache_ == NULL);
obj_cache_ = new RemoteObjectCache(64);
stack_trace_ = stack_trace;
- (*bp_handler_)(src_bpt, stack_trace);
+ (*bp_handler_)(isolate->debugger()->GetIsolateId(), src_bpt, stack_trace);
stack_trace_ = NULL;
obj_cache_ = NULL; // Remote object cache is zone allocated.
last_bpt_line_ = bpt->LineNumber();

Powered by Google App Engine
This is Rietveld 408576698