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

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

Issue 1649843002: Add --warn-on-pause-with-no-debugger flag. Add this to --observe behavior. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code review, etc. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/service.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/text_buffer.h" 10 #include "platform/text_buffer.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // TODO(iposva): Make these isolate specific flags inaccessible using the 77 // TODO(iposva): Make these isolate specific flags inaccessible using the
78 // regular FLAG_xyz pattern. 78 // regular FLAG_xyz pattern.
79 // These flags are per-isolate and only influence the defaults. 79 // These flags are per-isolate and only influence the defaults.
80 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); 80 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements.");
81 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); 81 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks.");
82 DEFINE_FLAG(bool, error_on_bad_override, false, 82 DEFINE_FLAG(bool, error_on_bad_override, false,
83 "Report error for bad overrides."); 83 "Report error for bad overrides.");
84 DEFINE_FLAG(bool, error_on_bad_type, false, 84 DEFINE_FLAG(bool, error_on_bad_type, false,
85 "Report error for malformed types."); 85 "Report error for malformed types.");
86 86
87 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger);
88
87 static void CheckedModeHandler(bool value) { 89 static void CheckedModeHandler(bool value) {
88 FLAG_enable_asserts = value; 90 FLAG_enable_asserts = value;
89 FLAG_enable_type_checks = value; 91 FLAG_enable_type_checks = value;
90 } 92 }
91 93
92 // --enable-checked-mode and --checked both enable checked mode which is 94 // --enable-checked-mode and --checked both enable checked mode which is
93 // equivalent to setting --enable-asserts and --enable-type-checks. 95 // equivalent to setting --enable-asserts and --enable-type-checks.
94 DEFINE_FLAG_HANDLER(CheckedModeHandler, 96 DEFINE_FLAG_HANDLER(CheckedModeHandler,
95 enable_checked_mode, 97 enable_checked_mode,
96 "Enable checked mode."); 98 "Enable checked mode.");
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 status = ProcessUnhandledException(Error::Cast(result)); 564 status = ProcessUnhandledException(Error::Cast(result));
563 } else { 565 } else {
564 ASSERT(result.IsNull()); 566 ASSERT(result.IsNull());
565 } 567 }
566 } 568 }
567 return status; 569 return status;
568 } 570 }
569 571
570 572
571 void IsolateMessageHandler::NotifyPauseOnStart() { 573 void IsolateMessageHandler::NotifyPauseOnStart() {
572 if (Service::debug_stream.enabled()) { 574 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) {
573 StartIsolateScope start_isolate(I); 575 StartIsolateScope start_isolate(I);
574 StackZone zone(T); 576 StackZone zone(T);
575 HandleScope handle_scope(T); 577 HandleScope handle_scope(T);
576 ServiceEvent pause_event(I, ServiceEvent::kPauseStart); 578 ServiceEvent pause_event(I, ServiceEvent::kPauseStart);
577 Service::HandleEvent(&pause_event); 579 Service::HandleEvent(&pause_event);
578 } else if (FLAG_trace_service) { 580 } else if (FLAG_trace_service) {
579 OS::Print("vm-service: Dropping event of type PauseStart (%s)\n", 581 OS::Print("vm-service: Dropping event of type PauseStart (%s)\n",
580 I->name()); 582 I->name());
581 } 583 }
582 } 584 }
583 585
584 586
585 void IsolateMessageHandler::NotifyPauseOnExit() { 587 void IsolateMessageHandler::NotifyPauseOnExit() {
586 if (Service::debug_stream.enabled()) { 588 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) {
587 StartIsolateScope start_isolate(I); 589 StartIsolateScope start_isolate(I);
588 StackZone zone(T); 590 StackZone zone(T);
589 HandleScope handle_scope(T); 591 HandleScope handle_scope(T);
590 ServiceEvent pause_event(I, ServiceEvent::kPauseExit); 592 ServiceEvent pause_event(I, ServiceEvent::kPauseExit);
591 Service::HandleEvent(&pause_event); 593 Service::HandleEvent(&pause_event);
592 } else if (FLAG_trace_service) { 594 } else if (FLAG_trace_service) {
593 OS::Print("vm-service: Dropping event of type PauseExit (%s)\n", 595 OS::Print("vm-service: Dropping event of type PauseExit (%s)\n",
594 I->name()); 596 I->name());
595 } 597 }
596 } 598 }
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 void IsolateSpawnState::DecrementSpawnCount() { 2561 void IsolateSpawnState::DecrementSpawnCount() {
2560 ASSERT(spawn_count_monitor_ != NULL); 2562 ASSERT(spawn_count_monitor_ != NULL);
2561 ASSERT(spawn_count_ != NULL); 2563 ASSERT(spawn_count_ != NULL);
2562 MonitorLocker ml(spawn_count_monitor_); 2564 MonitorLocker ml(spawn_count_monitor_);
2563 ASSERT(*spawn_count_ > 0); 2565 ASSERT(*spawn_count_ > 0);
2564 *spawn_count_ = *spawn_count_ - 1; 2566 *spawn_count_ = *spawn_count_ - 1;
2565 ml.Notify(); 2567 ml.Notify();
2566 } 2568 }
2567 2569
2568 } // namespace dart 2570 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698