Index: runtime/vm/exceptions.cc |
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc |
index 29f16848f17ccaeec0c97f737240493543103b59..369d099793d7deaf620a70ecc5109600d0625843 100644 |
--- a/runtime/vm/exceptions.cc |
+++ b/runtime/vm/exceptions.cc |
@@ -489,10 +489,12 @@ void Exceptions::Throw(Thread* thread, const Instance& exception) { |
// Do not notify debugger on stack overflow and out of memory exceptions. |
// The VM would crash when the debugger calls back into the VM to |
// get values of variables. |
- Isolate* isolate = thread->isolate(); |
- if (exception.raw() != isolate->object_store()->out_of_memory() && |
- exception.raw() != isolate->object_store()->stack_overflow()) { |
- isolate->debugger()->SignalExceptionThrown(exception); |
+ if (FLAG_support_debugger) { |
+ Isolate* isolate = thread->isolate(); |
+ if (exception.raw() != isolate->object_store()->out_of_memory() && |
+ exception.raw() != isolate->object_store()->stack_overflow()) { |
+ isolate->debugger()->SignalExceptionThrown(exception); |
+ } |
} |
// Null object is a valid exception object. |
ThrowExceptionHelper(thread, exception, |