OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/exceptions.h" | 5 #include "vm/exceptions.h" |
6 | 6 |
7 #include "platform/address_sanitizer.h" | 7 #include "platform/address_sanitizer.h" |
8 | 8 |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // Throw TypeError or CastError instance. | 482 // Throw TypeError or CastError instance. |
483 Exceptions::ThrowByType(exception_type, args); | 483 Exceptions::ThrowByType(exception_type, args); |
484 UNREACHABLE(); | 484 UNREACHABLE(); |
485 } | 485 } |
486 | 486 |
487 | 487 |
488 void Exceptions::Throw(Thread* thread, const Instance& exception) { | 488 void Exceptions::Throw(Thread* thread, const Instance& exception) { |
489 // Do not notify debugger on stack overflow and out of memory exceptions. | 489 // Do not notify debugger on stack overflow and out of memory exceptions. |
490 // The VM would crash when the debugger calls back into the VM to | 490 // The VM would crash when the debugger calls back into the VM to |
491 // get values of variables. | 491 // get values of variables. |
492 Isolate* isolate = thread->isolate(); | 492 if (FLAG_support_debugger) { |
493 if (exception.raw() != isolate->object_store()->out_of_memory() && | 493 Isolate* isolate = thread->isolate(); |
494 exception.raw() != isolate->object_store()->stack_overflow()) { | 494 if (exception.raw() != isolate->object_store()->out_of_memory() && |
495 isolate->debugger()->SignalExceptionThrown(exception); | 495 exception.raw() != isolate->object_store()->stack_overflow()) { |
| 496 isolate->debugger()->SignalExceptionThrown(exception); |
| 497 } |
496 } | 498 } |
497 // Null object is a valid exception object. | 499 // Null object is a valid exception object. |
498 ThrowExceptionHelper(thread, exception, | 500 ThrowExceptionHelper(thread, exception, |
499 Stacktrace::Handle(thread->zone()), false); | 501 Stacktrace::Handle(thread->zone()), false); |
500 } | 502 } |
501 | 503 |
502 void Exceptions::ReThrow(Thread* thread, | 504 void Exceptions::ReThrow(Thread* thread, |
503 const Instance& exception, | 505 const Instance& exception, |
504 const Instance& stacktrace) { | 506 const Instance& stacktrace) { |
505 // Null object is a valid exception object. | 507 // Null object is a valid exception object. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 void Exceptions::PrintStackTraceAndAbort(const char* reason) { | 690 void Exceptions::PrintStackTraceAndAbort(const char* reason) { |
689 const Instance& stacktrace = Instance::Handle(CurrentStacktrace()); | 691 const Instance& stacktrace = Instance::Handle(CurrentStacktrace()); |
690 | 692 |
691 OS::PrintErr("\n\n\nAborting due to %s. Stacktrace:\n%s\n", | 693 OS::PrintErr("\n\n\nAborting due to %s. Stacktrace:\n%s\n", |
692 reason, | 694 reason, |
693 stacktrace.ToCString()); | 695 stacktrace.ToCString()); |
694 OS::Abort(); | 696 OS::Abort(); |
695 } | 697 } |
696 | 698 |
697 } // namespace dart | 699 } // namespace dart |
OLD | NEW |