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

Unified Diff: runtime/vm/isolate.cc

Issue 1168933002: Fixes crashes in VM isolate shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add asserts Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 2432df990bfa34e8945bc702086c827c4bef13c6..929f46064a822bc753e6f1a0f46789aedafcfb9c 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -518,6 +518,7 @@ bool IsolateMessageHandler::ProcessUnhandledException(const Error& result) {
if ((exception == I->object_store()->out_of_memory()) ||
(exception == I->object_store()->stack_overflow())) {
// We didn't notify the debugger when the stack was full. Do it now.
+ ASSERT(I->debugger() != NULL);
I->debugger()->SignalExceptionThrown(Instance::Handle(exception));
}
}
@@ -775,8 +776,10 @@ Isolate* Isolate::Init(const char* name_prefix,
result->set_terminate_capability(result->random()->NextUInt64());
result->BuildName(name_prefix);
- result->debugger_ = new Debugger();
- result->debugger_->Initialize(result);
+ if (!is_vm_isolate) {
+ result->debugger_ = new Debugger();
+ result->debugger_->Initialize(result);
+ }
if (FLAG_trace_isolates) {
if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) {
OS::Print("[+] Starting isolate:\n"
@@ -1221,6 +1224,7 @@ static bool RunIsolate(uword parameter) {
// of its implicit closure function because that latter is merely
// a dispatcher that is marked as undebuggable.
if (FLAG_break_at_isolate_spawn) {
+ ASSERT(isolate->debugger() != NULL);
isolate->debugger()->OneTimeBreakAtEntry(func);
}
@@ -1425,7 +1429,9 @@ void Isolate::Shutdown() {
}
// Clean up debugger resources.
- debugger()->Shutdown();
+ if (debugger() != NULL) {
+ debugger()->Shutdown();
+ }
// Close all the ports owned by this isolate.
PortMap::ClosePorts(message_handler());
@@ -1526,6 +1532,7 @@ void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
reinterpret_cast<RawObject**>(&deoptimized_code_array_));
// Visit objects in the debugger.
+ ASSERT(debugger() != NULL);
Ivan Posva 2015/06/16 16:31:15 if (debugger() != NULL) { ... } Since we are vi
debugger()->VisitObjectPointers(visitor);
// Visit objects that are being used for deoptimization.
@@ -1582,6 +1589,7 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) {
jsobj.AddProperty("livePorts", message_handler()->live_ports());
jsobj.AddProperty("pauseOnExit", message_handler()->pause_on_exit());
+ ASSERT(debugger() != NULL);
Ivan Posva 2015/06/16 16:31:15 We should allow printing of the VM isolate.
if (message_handler()->paused_on_start()) {
ASSERT(debugger()->PauseEvent() == NULL);
ServiceEvent pause_event(this, ServiceEvent::kPauseStart);

Powered by Google App Engine
This is Rietveld 408576698