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

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

Issue 1406013004: Fixes shutdown crashes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 5 years, 1 month 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
« no previous file with comments | « no previous file | runtime/vm/service_isolate.cc » ('j') | 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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 ASSERT(!IsPaused()); 1270 ASSERT(!IsPaused());
1271 ASSERT(latent_locations_ == NULL); 1271 ASSERT(latent_locations_ == NULL);
1272 ASSERT(breakpoint_locations_ == NULL); 1272 ASSERT(breakpoint_locations_ == NULL);
1273 ASSERT(code_breakpoints_ == NULL); 1273 ASSERT(code_breakpoints_ == NULL);
1274 ASSERT(stack_trace_ == NULL); 1274 ASSERT(stack_trace_ == NULL);
1275 ASSERT(obj_cache_ == NULL); 1275 ASSERT(obj_cache_ == NULL);
1276 } 1276 }
1277 1277
1278 1278
1279 void Debugger::Shutdown() { 1279 void Debugger::Shutdown() {
1280 // TODO(johnmccutchan): Do not create a debugger for isolates that don't need
1281 // them. Then, assert here that isolate_ is not one of those isolates.
1282 if ((isolate_ == Dart::vm_isolate()) ||
1283 ServiceIsolate::IsServiceIsolateDescendant(isolate_)) {
1284 return;
1285 }
1280 while (breakpoint_locations_ != NULL) { 1286 while (breakpoint_locations_ != NULL) {
1281 BreakpointLocation* bpt = breakpoint_locations_; 1287 BreakpointLocation* bpt = breakpoint_locations_;
1282 breakpoint_locations_ = breakpoint_locations_->next(); 1288 breakpoint_locations_ = breakpoint_locations_->next();
1283 delete bpt; 1289 delete bpt;
1284 } 1290 }
1285 while (latent_locations_ != NULL) { 1291 while (latent_locations_ != NULL) {
1286 BreakpointLocation* bpt = latent_locations_; 1292 BreakpointLocation* bpt = latent_locations_;
1287 latent_locations_ = latent_locations_->next(); 1293 latent_locations_ = latent_locations_->next();
1288 delete bpt; 1294 delete bpt;
1289 } 1295 }
1290 while (code_breakpoints_ != NULL) { 1296 while (code_breakpoints_ != NULL) {
1291 CodeBreakpoint* bpt = code_breakpoints_; 1297 CodeBreakpoint* bpt = code_breakpoints_;
1292 code_breakpoints_ = code_breakpoints_->next(); 1298 code_breakpoints_ = code_breakpoints_->next();
1293 bpt->Disable(); 1299 bpt->Disable();
1294 delete bpt; 1300 delete bpt;
1295 } 1301 }
1296 // Signal isolate shutdown event. 1302 // Signal isolate shutdown event.
1297 if (!ServiceIsolate::IsServiceIsolateDescendant(isolate_)) { 1303 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown);
1298 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown);
1299 }
1300 } 1304 }
1301 1305
1302 1306
1303 static RawFunction* ResolveLibraryFunction( 1307 static RawFunction* ResolveLibraryFunction(
1304 const Library& library, 1308 const Library& library,
1305 const String& fname) { 1309 const String& fname) {
1306 ASSERT(!library.IsNull()); 1310 ASSERT(!library.IsNull());
1307 const Object& object = Object::Handle(library.ResolveName(fname)); 1311 const Object& object = Object::Handle(library.ResolveName(fname));
1308 if (!object.IsNull() && object.IsFunction()) { 1312 if (!object.IsNull() && object.IsFunction()) {
1309 return Function::Cast(object).raw(); 1313 return Function::Cast(object).raw();
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 } 3244 }
3241 3245
3242 3246
3243 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 3247 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
3244 ASSERT(bpt->next() == NULL); 3248 ASSERT(bpt->next() == NULL);
3245 bpt->set_next(code_breakpoints_); 3249 bpt->set_next(code_breakpoints_);
3246 code_breakpoints_ = bpt; 3250 code_breakpoints_ = bpt;
3247 } 3251 }
3248 3252
3249 } // namespace dart 3253 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/service_isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698