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

Unified Diff: runtime/vm/debugger.cc

Issue 175533003: Handle stepping requests after isolate interrupt event (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
===================================================================
--- runtime/vm/debugger.cc (revision 32907)
+++ runtime/vm/debugger.cc (working copy)
@@ -187,20 +187,18 @@
void Debugger::SignalIsolateEvent(EventType type) {
if (event_handler_ != NULL) {
- Debugger* debugger = Isolate::Current()->debugger();
- ASSERT(debugger != NULL);
DebuggerEvent event(type);
- event.isolate_id = debugger->GetIsolateId();
+ event.isolate_id = isolate_id_;
ASSERT(event.isolate_id != ILLEGAL_ISOLATE_ID);
if (type == kIsolateInterrupted) {
- DebuggerStackTrace* stack_trace = debugger->CollectStackTrace();
- ASSERT(stack_trace->Length() > 0);
- ASSERT(debugger->stack_trace_ == NULL);
- debugger->stack_trace_ = stack_trace;
- debugger->Pause(&event);
- debugger->stack_trace_ = NULL;
- // TODO(asiva): Need some work here to be able to single step after
- // an interrupt.
+ DebuggerStackTrace* trace = CollectStackTrace();
+ ASSERT(trace->Length() > 0);
+ ASSERT(stack_trace_ == NULL);
+ stack_trace_ = trace;
+ resume_action_ = kContinue;
+ Pause(&event);
+ HandleSteppingRequest(trace);
+ stack_trace_ = NULL;
} else {
(*event_handler_)(&event);
}
@@ -208,6 +206,15 @@
}
+void Debugger::SignalIsolateInterrupted() {
+ if (event_handler_ != NULL) {
+ Debugger* debugger = Isolate::Current()->debugger();
+ ASSERT(debugger != NULL);
+ debugger->SignalIsolateEvent(kIsolateInterrupted);
+ }
+}
+
+
const char* Debugger::QualifiedFunctionName(const Function& func) {
const String& func_name = String::Handle(func.name());
Class& func_class = Class::Handle(func.Owner());
@@ -1926,6 +1933,28 @@
}
+void Debugger::HandleSteppingRequest(DebuggerStackTrace* stack_trace) {
+ stepping_fp_ = 0;
+ if (resume_action_ == kSingleStep) {
+ isolate_->set_single_step(true);
+ } else if (resume_action_ == kStepOver) {
+ isolate_->set_single_step(true);
+ ASSERT(stack_trace->Length() > 0);
+ stepping_fp_ = stack_trace->FrameAt(0)->fp();
+ } else if (resume_action_ == kStepOut) {
+ isolate_->set_single_step(true);
+ // Find topmost caller that is debuggable.
+ for (intptr_t i = 1; i < stack_trace->Length(); i++) {
+ ActivationFrame* frame = stack_trace->FrameAt(i);
+ if (frame->IsDebuggable()) {
+ stepping_fp_ = frame->fp();
+ break;
+ }
+ }
+ }
+}
+
+
bool Debugger::IsDebuggable(const Function& func) {
if (!IsDebuggableFunctionKind(func)) {
return false;
@@ -1950,17 +1979,6 @@
}
-static uword DebuggableCallerFP(DebuggerStackTrace* stack_trace) {
- for (intptr_t i = 1; i < stack_trace->Length(); i++) {
- ActivationFrame* frame = stack_trace->FrameAt(i);
- if (frame->IsDebuggable()) {
- return frame->fp();
- }
- }
- return 0;
-}
-
-
void Debugger::DebuggerStepCallback() {
ASSERT(isolate_->single_step());
// We can't get here unless the debugger event handler enabled
@@ -2008,17 +2026,7 @@
ASSERT(stack_trace_ == NULL);
stack_trace_ = CollectStackTrace();
SignalPausedEvent(frame, NULL);
-
- if (resume_action_ == kSingleStep) {
- isolate_->set_single_step(true);
- stepping_fp_ = 0;
- } else if (resume_action_ == kStepOver) {
- isolate_->set_single_step(true);
- stepping_fp_ = frame->fp();
- } else if (resume_action_ == kStepOut) {
- isolate_->set_single_step(true);
- stepping_fp_ = DebuggableCallerFP(stack_trace_);
- }
+ HandleSteppingRequest(stack_trace_);
stack_trace_ = NULL;
}
@@ -2050,18 +2058,8 @@
ASSERT(stack_trace_ == NULL);
stack_trace_ = stack_trace;
SignalPausedEvent(top_frame, bpt->src_bpt_);
+ HandleSteppingRequest(stack_trace_);
stack_trace_ = NULL;
-
- if (resume_action_ == kSingleStep) {
- isolate_->set_single_step(true);
- stepping_fp_ = 0;
- } else if (resume_action_ == kStepOver) {
- isolate_->set_single_step(true);
- stepping_fp_ = top_frame->fp();
- } else if (resume_action_ == kStepOut) {
- isolate_->set_single_step(true);
- stepping_fp_ = DebuggableCallerFP(stack_trace);
- }
if (bpt->IsInternal()) {
RemoveInternalBreakpoints();
}
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698