OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/debug/debug.h" | 5 #include "src/debug/debug.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 } | 1757 } |
1758 // Bail out if exception breaks are not active | 1758 // Bail out if exception breaks are not active |
1759 if (uncaught) { | 1759 if (uncaught) { |
1760 // Uncaught exceptions are reported by either flags. | 1760 // Uncaught exceptions are reported by either flags. |
1761 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; | 1761 if (!(break_on_uncaught_exception_ || break_on_exception_)) return; |
1762 } else { | 1762 } else { |
1763 // Caught exceptions are reported is activated. | 1763 // Caught exceptions are reported is activated. |
1764 if (!break_on_exception_) return; | 1764 if (!break_on_exception_) return; |
1765 } | 1765 } |
1766 | 1766 |
| 1767 bool empty_js_stack = false; |
1767 { | 1768 { |
1768 JavaScriptFrameIterator it(isolate_); | 1769 JavaScriptFrameIterator it(isolate_); |
1769 // Check whether the top frame is blackboxed or the break location is muted. | 1770 // Check whether the top frame is blackboxed or the break location is muted. |
1770 if (!it.done() && (IsMutedAtCurrentLocation(it.frame()) || | 1771 if (!it.done() && (IsMutedAtCurrentLocation(it.frame()) || |
1771 IsExceptionBlackboxed(uncaught))) { | 1772 IsExceptionBlackboxed(uncaught))) { |
1772 return; | 1773 return; |
1773 } | 1774 } |
| 1775 empty_js_stack = it.done(); |
1774 } | 1776 } |
1775 | 1777 |
1776 DebugScope debug_scope(this); | 1778 DebugScope debug_scope(this); |
1777 if (debug_scope.failed()) return; | 1779 if (debug_scope.failed()) return; |
1778 | 1780 |
1779 if (debug_delegate_) { | 1781 if (debug_delegate_ && !empty_js_stack) { |
1780 HandleScope scope(isolate_); | 1782 HandleScope scope(isolate_); |
1781 | 1783 |
1782 // Create the execution state. | 1784 // Create the execution state. |
1783 Handle<Object> exec_state; | 1785 Handle<Object> exec_state; |
1784 // Bail out and don't call debugger if exception. | 1786 // Bail out and don't call debugger if exception. |
1785 if (!MakeExecutionState().ToHandle(&exec_state)) return; | 1787 if (!MakeExecutionState().ToHandle(&exec_state)) return; |
1786 | 1788 |
1787 debug_delegate_->ExceptionThrown( | 1789 debug_delegate_->ExceptionThrown( |
1788 GetDebugEventContext(isolate_), | 1790 GetDebugEventContext(isolate_), |
1789 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)), | 1791 v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)), |
1790 v8::Utils::ToLocal(exception), promise->IsJSObject(), uncaught); | 1792 v8::Utils::ToLocal(exception), promise->IsJSObject(), uncaught); |
1791 if (!non_inspector_listener_exists()) return; | |
1792 } | 1793 } |
| 1794 if (debug_delegate_ && !non_inspector_listener_exists()) return; |
1793 | 1795 |
1794 // Create the event data object. | 1796 // Create the event data object. |
1795 Handle<Object> event_data; | 1797 Handle<Object> event_data; |
1796 // Bail out and don't call debugger if exception. | 1798 // Bail out and don't call debugger if exception. |
1797 if (!MakeExceptionEvent( | 1799 if (!MakeExceptionEvent( |
1798 exception, uncaught, promise).ToHandle(&event_data)) { | 1800 exception, uncaught, promise).ToHandle(&event_data)) { |
1799 return; | 1801 return; |
1800 } | 1802 } |
1801 | 1803 |
1802 // Process debug event. | 1804 // Process debug event. |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 return v8::Utils::ToLocal(callback_data_); | 2398 return v8::Utils::ToLocal(callback_data_); |
2397 } | 2399 } |
2398 | 2400 |
2399 | 2401 |
2400 v8::Isolate* EventDetailsImpl::GetIsolate() const { | 2402 v8::Isolate* EventDetailsImpl::GetIsolate() const { |
2401 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); | 2403 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); |
2402 } | 2404 } |
2403 | 2405 |
2404 } // namespace internal | 2406 } // namespace internal |
2405 } // namespace v8 | 2407 } // namespace v8 |
OLD | NEW |