OLD | NEW |
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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 407 } |
408 | 408 |
409 | 409 |
410 ActivationFrame* DebuggerStackTrace::GetHandlerFrame( | 410 ActivationFrame* DebuggerStackTrace::GetHandlerFrame( |
411 const Instance& exc_obj) const { | 411 const Instance& exc_obj) const { |
412 ExceptionHandlers& handlers = ExceptionHandlers::Handle(); | 412 ExceptionHandlers& handlers = ExceptionHandlers::Handle(); |
413 Array& handled_types = Array::Handle(); | 413 Array& handled_types = Array::Handle(); |
414 AbstractType& type = Type::Handle(); | 414 AbstractType& type = Type::Handle(); |
415 const TypeArguments& no_instantiator = TypeArguments::Handle(); | 415 const TypeArguments& no_instantiator = TypeArguments::Handle(); |
416 for (intptr_t frame_index = 0; | 416 for (intptr_t frame_index = 0; |
417 frame_index < UnfilteredLength(); | 417 frame_index < Length(); |
418 frame_index++) { | 418 frame_index++) { |
419 ActivationFrame* frame = UnfilteredFrameAt(frame_index); | 419 ActivationFrame* frame = FrameAt(frame_index); |
420 intptr_t try_index = frame->TryIndex(); | 420 intptr_t try_index = frame->TryIndex(); |
421 if (try_index < 0) continue; | 421 if (try_index < 0) continue; |
422 handlers = frame->code().exception_handlers(); | 422 handlers = frame->code().exception_handlers(); |
423 ASSERT(!handlers.IsNull()); | 423 ASSERT(!handlers.IsNull()); |
424 intptr_t num_handlers_checked = 0; | 424 intptr_t num_handlers_checked = 0; |
425 while (try_index >= 0) { | 425 while (try_index >= 0) { |
426 // Detect circles in the exception handler data. | 426 // Detect circles in the exception handler data. |
427 num_handlers_checked++; | 427 num_handlers_checked++; |
428 ASSERT(num_handlers_checked <= handlers.Length()); | 428 ASSERT(num_handlers_checked <= handlers.Length()); |
429 handled_types = handlers.GetHandledTypes(try_index); | 429 handled_types = handlers.GetHandledTypes(try_index); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 intptr_t len = | 655 intptr_t len = |
656 OS::SNPrint(NULL, 0, kFormat, func_name, url.ToCString(), line); | 656 OS::SNPrint(NULL, 0, kFormat, func_name, url.ToCString(), line); |
657 len++; // String terminator. | 657 len++; // String terminator. |
658 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 658 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
659 OS::SNPrint(chars, len, kFormat, func_name, url.ToCString(), line); | 659 OS::SNPrint(chars, len, kFormat, func_name, url.ToCString(), line); |
660 return chars; | 660 return chars; |
661 } | 661 } |
662 | 662 |
663 | 663 |
664 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) { | 664 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) { |
665 trace_.Add(frame); | 665 if (frame->function().is_visible()) { |
666 if (frame->IsDebuggable()) { | 666 trace_.Add(frame); |
667 user_trace_.Add(frame); | |
668 } | 667 } |
669 } | 668 } |
670 | 669 |
671 | 670 |
672 static bool IsSafePoint(PcDescriptors::Kind kind) { | 671 static bool IsSafePoint(PcDescriptors::Kind kind) { |
673 return ((kind == PcDescriptors::kIcCall) || | 672 return ((kind == PcDescriptors::kIcCall) || |
674 (kind == PcDescriptors::kOptStaticCall) || | 673 (kind == PcDescriptors::kOptStaticCall) || |
675 (kind == PcDescriptors::kUnoptStaticCall) || | 674 (kind == PcDescriptors::kUnoptStaticCall) || |
676 (kind == PcDescriptors::kClosureCall) || | 675 (kind == PcDescriptors::kClosureCall) || |
677 (kind == PcDescriptors::kReturn) || | 676 (kind == PcDescriptors::kReturn) || |
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 | 1880 |
1882 | 1881 |
1883 void Debugger::SignalBpReached() { | 1882 void Debugger::SignalBpReached() { |
1884 // We ignore this breakpoint when the VM is executing code invoked | 1883 // We ignore this breakpoint when the VM is executing code invoked |
1885 // by the debugger to evaluate variables values, or when we see a nested | 1884 // by the debugger to evaluate variables values, or when we see a nested |
1886 // breakpoint or exception event. | 1885 // breakpoint or exception event. |
1887 if (ignore_breakpoints_ || in_event_notification_) { | 1886 if (ignore_breakpoints_ || in_event_notification_) { |
1888 return; | 1887 return; |
1889 } | 1888 } |
1890 DebuggerStackTrace* stack_trace = CollectStackTrace(); | 1889 DebuggerStackTrace* stack_trace = CollectStackTrace(); |
1891 ASSERT(stack_trace->UnfilteredLength() > 0); | 1890 ASSERT(stack_trace->Length() > 0); |
1892 ActivationFrame* top_frame = stack_trace->UnfilteredFrameAt(0); | 1891 ActivationFrame* top_frame = stack_trace->FrameAt(0); |
1893 ASSERT(top_frame != NULL); | 1892 ASSERT(top_frame != NULL); |
1894 CodeBreakpoint* bpt = GetCodeBreakpoint(top_frame->pc()); | 1893 CodeBreakpoint* bpt = GetCodeBreakpoint(top_frame->pc()); |
1895 ASSERT(bpt != NULL); | 1894 ASSERT(bpt != NULL); |
1896 | 1895 |
1897 bool report_bp = true; | 1896 bool report_bp = true; |
1898 if (bpt->IsInternal() && !IsDebuggable(top_frame->function())) { | 1897 if (bpt->IsInternal() && !IsDebuggable(top_frame->function())) { |
1899 report_bp = false; | 1898 report_bp = false; |
1900 } | 1899 } |
1901 if (FLAG_verbose_debug) { | 1900 if (FLAG_verbose_debug) { |
1902 OS::Print(">>> %s %s breakpoint at %s:%" Pd " " | 1901 OS::Print(">>> %s %s breakpoint at %s:%" Pd " " |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 } | 2161 } |
2163 | 2162 |
2164 | 2163 |
2165 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2164 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
2166 ASSERT(bpt->next() == NULL); | 2165 ASSERT(bpt->next() == NULL); |
2167 bpt->set_next(code_breakpoints_); | 2166 bpt->set_next(code_breakpoints_); |
2168 code_breakpoints_ = bpt; | 2167 code_breakpoints_ = bpt; |
2169 } | 2168 } |
2170 | 2169 |
2171 } // namespace dart | 2170 } // namespace dart |
OLD | NEW |