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

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

Issue 2682343002: Disable the profiler when a debugger is attached (Closed)
Patch Set: Created 3 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
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/thread_interrupter.h" 5 #include "vm/thread_interrupter.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/simulator.h" 10 #include "vm/simulator.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void ThreadInterrupter::InitOnce() { 63 void ThreadInterrupter::InitOnce() {
64 ASSERT(!initialized_); 64 ASSERT(!initialized_);
65 monitor_ = new Monitor(); 65 monitor_ = new Monitor();
66 ASSERT(monitor_ != NULL); 66 ASSERT(monitor_ != NULL);
67 initialized_ = true; 67 initialized_ = true;
68 } 68 }
69 69
70 70
71 void ThreadInterrupter::Startup() { 71 void ThreadInterrupter::Startup() {
72 ASSERT(initialized_); 72 ASSERT(initialized_);
73 if (IsDebuggerAttached()) {
74 MonitorLocker shutdown_ml(monitor_);
75 shutdown_ = true;
76 if (FLAG_trace_thread_interrupter) {
77 OS::Print("ThreadInterrupter disabled because a debugger is attached.\n");
Vyacheslav Egorov (Google) 2017/02/09 17:14:05 OS::PrintErr?
Cutch 2017/02/09 18:34:07 Done here and elsewhere
78 }
79 return;
80 }
73 if (FLAG_trace_thread_interrupter) { 81 if (FLAG_trace_thread_interrupter) {
74 OS::Print("ThreadInterrupter starting up.\n"); 82 OS::Print("ThreadInterrupter starting up.\n");
75 } 83 }
76 ASSERT(interrupter_thread_id_ == OSThread::kInvalidThreadJoinId); 84 ASSERT(interrupter_thread_id_ == OSThread::kInvalidThreadJoinId);
77 { 85 {
78 MonitorLocker startup_ml(monitor_); 86 MonitorLocker startup_ml(monitor_);
79 OSThread::Start("ThreadInterrupter", ThreadMain, 0); 87 OSThread::Start("ThreadInterrupter", ThreadMain, 0);
80 while (!thread_running_) { 88 while (!thread_running_) {
81 startup_ml.Wait(); 89 startup_ml.Wait();
82 } 90 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Signal to main thread we are exiting. 229 // Signal to main thread we are exiting.
222 MonitorLocker shutdown_ml(monitor_); 230 MonitorLocker shutdown_ml(monitor_);
223 thread_running_ = false; 231 thread_running_ = false;
224 shutdown_ml.Notify(); 232 shutdown_ml.Notify();
225 } 233 }
226 } 234 }
227 235
228 #endif // !PRODUCT 236 #endif // !PRODUCT
229 237
230 } // namespace dart 238 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698