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

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

Issue 2361183002: Respect setLibraryDebuggable (Closed)
Patch Set: Respect setLibraryDebuggable Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "vm/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 } 2606 }
2607 } 2607 }
2608 } 2608 }
2609 2609
2610 2610
2611 // static 2611 // static
2612 bool Debugger::IsDebuggable(const Function& func) { 2612 bool Debugger::IsDebuggable(const Function& func) {
2613 if (!func.is_debuggable()) { 2613 if (!func.is_debuggable()) {
2614 return false; 2614 return false;
2615 } 2615 }
2616 if (ServiceIsolate::IsRunning()) {
2617 return true;
2618 }
2619 const Class& cls = Class::Handle(func.Owner()); 2616 const Class& cls = Class::Handle(func.Owner());
2620 const Library& lib = Library::Handle(cls.library()); 2617 const Library& lib = Library::Handle(cls.library());
2621 return lib.IsDebuggable(); 2618 return lib.IsDebuggable();
2622 } 2619 }
2623 2620
2624 2621
2625 void Debugger::SignalPausedEvent(ActivationFrame* top_frame, 2622 void Debugger::SignalPausedEvent(ActivationFrame* top_frame,
2626 Breakpoint* bpt) { 2623 Breakpoint* bpt) {
2627 resume_action_ = kContinue; 2624 resume_action_ = kContinue;
2628 stepping_fp_ = 0; 2625 stepping_fp_ = 0;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 // the user is interested in, we ignore the single step if we are 2674 // the user is interested in, we ignore the single step if we are
2678 // in a callee of that frame. Note that we assume that the stack 2675 // in a callee of that frame. Note that we assume that the stack
2679 // grows towards lower addresses. 2676 // grows towards lower addresses.
2680 ActivationFrame* frame = TopDartFrame(); 2677 ActivationFrame* frame = TopDartFrame();
2681 ASSERT(frame != NULL); 2678 ASSERT(frame != NULL);
2682 2679
2683 if (stepping_fp_ != 0) { 2680 if (stepping_fp_ != 0) {
2684 // There is an "interesting frame" set. Only pause at appropriate 2681 // There is an "interesting frame" set. Only pause at appropriate
2685 // locations in this frame. 2682 // locations in this frame.
2686 if (IsCalleeFrameOf(stepping_fp_, frame->fp())) { 2683 if (IsCalleeFrameOf(stepping_fp_, frame->fp())) {
2687 // We are i n a callee of the frame we're interested in. 2684 // We are in a callee of the frame we're interested in.
2688 // Ignore this stepping break. 2685 // Ignore this stepping break.
2689 return Error::null(); 2686 return Error::null();
2690 } else if (IsCalleeFrameOf(frame->fp(), stepping_fp_)) { 2687 } else if (IsCalleeFrameOf(frame->fp(), stepping_fp_)) {
2691 // We returned from the "interesting frame", there can be no more 2688 // We returned from the "interesting frame", there can be no more
2692 // stepping breaks for it. Pause at the next appropriate location 2689 // stepping breaks for it. Pause at the next appropriate location
2693 // and let the user set the "interesting" frame again. 2690 // and let the user set the "interesting" frame again.
2694 stepping_fp_ = 0; 2691 stepping_fp_ = 0;
2695 } 2692 }
2696 } 2693 }
2697 2694
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 2853
2857 2854
2858 void Debugger::PauseDeveloper(const String& msg) { 2855 void Debugger::PauseDeveloper(const String& msg) {
2859 // We ignore this breakpoint when the VM is executing code invoked 2856 // We ignore this breakpoint when the VM is executing code invoked
2860 // by the debugger to evaluate variables values, or when we see a nested 2857 // by the debugger to evaluate variables values, or when we see a nested
2861 // breakpoint or exception event. 2858 // breakpoint or exception event.
2862 if (ignore_breakpoints_ || IsPaused()) { 2859 if (ignore_breakpoints_ || IsPaused()) {
2863 return; 2860 return;
2864 } 2861 }
2865 2862
2866 if (!NeedsDebugEvents()) {
2867 OS::Print("Hit debugger!");
2868 }
2869
2870 DebuggerStackTrace* stack_trace = CollectStackTrace(); 2863 DebuggerStackTrace* stack_trace = CollectStackTrace();
2871 ASSERT(stack_trace->Length() > 0); 2864 ASSERT(stack_trace->Length() > 0);
2872 ASSERT(stack_trace_ == NULL); 2865 ASSERT(stack_trace_ == NULL);
2873 stack_trace_ = stack_trace; 2866 stack_trace_ = stack_trace;
2874 2867
2875 // TODO(johnmccutchan): Send |msg| to Observatory. 2868 // TODO(johnmccutchan): Send |msg| to Observatory.
2876 2869
2877 // We are in the native call to Developer_debugger. the developer 2870 // We are in the native call to Developer_debugger. the developer
2878 // gets a better experience by not seeing this call. To accomplish 2871 // gets a better experience by not seeing this call. To accomplish
2879 // this, we continue execution until the call exits (step out). 2872 // this, we continue execution until the call exits (step out).
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
3332 3325
3333 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 3326 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
3334 ASSERT(bpt->next() == NULL); 3327 ASSERT(bpt->next() == NULL);
3335 bpt->set_next(code_breakpoints_); 3328 bpt->set_next(code_breakpoints_);
3336 code_breakpoints_ = bpt; 3329 code_breakpoints_ = bpt;
3337 } 3330 }
3338 3331
3339 #endif // !PRODUCT 3332 #endif // !PRODUCT
3340 3333
3341 } // namespace dart 3334 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/set_library_debuggable_test.dart ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698