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

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

Issue 1127653003: Do not swallow compilation errors when setting breakpoint (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 } 1631 }
1632 1632
1633 1633
1634 RawFunction* Debugger::FindBestFit(const Script& script, 1634 RawFunction* Debugger::FindBestFit(const Script& script,
1635 intptr_t token_pos) { 1635 intptr_t token_pos) {
1636 Class& cls = Class::Handle(isolate_); 1636 Class& cls = Class::Handle(isolate_);
1637 Array& functions = Array::Handle(isolate_); 1637 Array& functions = Array::Handle(isolate_);
1638 GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_); 1638 GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_);
1639 Function& function = Function::Handle(isolate_); 1639 Function& function = Function::Handle(isolate_);
1640 Function& best_fit = Function::Handle(isolate_); 1640 Function& best_fit = Function::Handle(isolate_);
1641 Error& error = Error::Handle(isolate_);
1641 1642
1642 const ClassTable& class_table = *isolate_->class_table(); 1643 const ClassTable& class_table = *isolate_->class_table();
1643 const intptr_t num_classes = class_table.NumCids(); 1644 const intptr_t num_classes = class_table.NumCids();
1644 for (intptr_t i = 1; i < num_classes; i++) { 1645 for (intptr_t i = 1; i < num_classes; i++) {
1645 if (class_table.HasValidClassAt(i)) { 1646 if (class_table.HasValidClassAt(i)) {
1646 cls = class_table.At(i); 1647 cls = class_table.At(i);
1647 // Note: if this class has been parsed and finalized already, 1648 // Note: if this class has been parsed and finalized already,
1648 // we need to check the functions of this class even if 1649 // we need to check the functions of this class even if
1649 // it is defined in a differenct 'script'. There could 1650 // it is defined in a differenct 'script'. There could
1650 // be mixin functions from the given script in this class. 1651 // be mixin functions from the given script in this class.
1651 // However, if this class is not parsed yet (not finalized), 1652 // However, if this class is not parsed yet (not finalized),
1652 // we can ignore it and avoid the side effect of parsing it. 1653 // we can ignore it and avoid the side effect of parsing it.
1653 if ((cls.script() != script.raw()) && !cls.is_finalized()) { 1654 if ((cls.script() != script.raw()) && !cls.is_finalized()) {
1654 continue; 1655 continue;
1655 } 1656 }
1656 // Parse class definition if not done yet. 1657 // Parse class definition if not done yet.
1657 cls.EnsureIsFinalized(isolate_); 1658 error = cls.EnsureIsFinalized(isolate_);
1659 if (!error.IsNull()) {
1660 // Ignore functions in this class.
1661 // TODO(hausner): Should we propagate this error? How?
1662 // EnsureIsFinalized only returns an error object if there
1663 // is no longjump base on the stack.
1664 continue;
1665 }
1658 functions = cls.functions(); 1666 functions = cls.functions();
1659 if (!functions.IsNull()) { 1667 if (!functions.IsNull()) {
1660 const intptr_t num_functions = functions.Length(); 1668 const intptr_t num_functions = functions.Length();
1661 for (intptr_t pos = 0; pos < num_functions; pos++) { 1669 for (intptr_t pos = 0; pos < num_functions; pos++) {
1662 function ^= functions.At(pos); 1670 function ^= functions.At(pos);
1663 ASSERT(!function.IsNull()); 1671 ASSERT(!function.IsNull());
1664 if (FunctionContains(function, script, token_pos)) { 1672 if (FunctionContains(function, script, token_pos)) {
1665 SelectBestFit(&best_fit, &function); 1673 SelectBestFit(&best_fit, &function);
1666 } 1674 }
1667 } 1675 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 } else { 1782 } else {
1775 cbpt->Disable(); 1783 cbpt->Disable();
1776 } 1784 }
1777 } 1785 }
1778 cbpt = cbpt->next(); 1786 cbpt = cbpt->next();
1779 } 1787 }
1780 } 1788 }
1781 1789
1782 1790
1783 RawError* Debugger::OneTimeBreakAtEntry(const Function& target_function) { 1791 RawError* Debugger::OneTimeBreakAtEntry(const Function& target_function) {
1784 SourceBreakpoint* bpt = SetBreakpointAtEntry(target_function); 1792 LongJumpScope jump;
1785 if (bpt != NULL) { 1793 if (setjmp(*jump.Set()) == 0) {
1786 bpt->SetIsOneShot(); 1794 SourceBreakpoint* bpt = SetBreakpointAtEntry(target_function);
1795 if (bpt != NULL) {
1796 bpt->SetIsOneShot();
1797 }
1798 return Error::null();
1799 } else {
1800 return isolate_->object_store()->sticky_error();
1787 } 1801 }
1788 return Error::null();
1789 } 1802 }
1790 1803
1791 1804
1792 SourceBreakpoint* Debugger::SetBreakpointAtEntry( 1805 SourceBreakpoint* Debugger::SetBreakpointAtEntry(
1793 const Function& target_function) { 1806 const Function& target_function) {
1794 ASSERT(!target_function.IsNull()); 1807 ASSERT(!target_function.IsNull());
1795 if (!target_function.is_debuggable()) { 1808 if (!target_function.is_debuggable()) {
1796 return NULL; 1809 return NULL;
1797 } 1810 }
1798 const Script& script = Script::Handle(target_function.script()); 1811 const Script& script = Script::Handle(target_function.script());
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 } 2667 }
2655 2668
2656 2669
2657 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2670 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2658 ASSERT(bpt->next() == NULL); 2671 ASSERT(bpt->next() == NULL);
2659 bpt->set_next(code_breakpoints_); 2672 bpt->set_next(code_breakpoints_);
2660 code_breakpoints_ = bpt; 2673 code_breakpoints_ = bpt;
2661 } 2674 }
2662 2675
2663 } // namespace dart 2676 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698