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

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

Issue 537673002: Add --break-at-isolate-spawn to help with isolate debugging. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/service/object.dart ('k') | no next file » | 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 "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 25 matching lines...) Expand all
36 36
37 37
38 namespace dart { 38 namespace dart {
39 39
40 DEFINE_FLAG(bool, trace_isolates, false, 40 DEFINE_FLAG(bool, trace_isolates, false,
41 "Trace isolate creation and shut down."); 41 "Trace isolate creation and shut down.");
42 DEFINE_FLAG(bool, pause_isolates_on_start, false, 42 DEFINE_FLAG(bool, pause_isolates_on_start, false,
43 "Pause isolates before starting."); 43 "Pause isolates before starting.");
44 DEFINE_FLAG(bool, pause_isolates_on_exit, false, 44 DEFINE_FLAG(bool, pause_isolates_on_exit, false,
45 "Pause isolates exiting."); 45 "Pause isolates exiting.");
46 DEFINE_FLAG(bool, break_at_isolate_spawn, false,
47 "Insert a one-time breakpoint at the entrypoint for all spawned "
48 "isolates");
46 49
47 50
48 // Quick access to the locally defined isolate() method. 51 // Quick access to the locally defined isolate() method.
49 #define I (isolate()) 52 #define I (isolate())
50 53
51 54
52 void Isolate::RegisterClass(const Class& cls) { 55 void Isolate::RegisterClass(const Class& cls) {
53 class_table()->Register(cls); 56 class_table()->Register(cls);
54 } 57 }
55 58
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 bool is_spawn_uri = state->is_spawn_uri(); 832 bool is_spawn_uri = state->is_spawn_uri();
830 if (result.IsError()) { 833 if (result.IsError()) {
831 StoreError(isolate, result); 834 StoreError(isolate, result);
832 return false; 835 return false;
833 } 836 }
834 ASSERT(result.IsFunction()); 837 ASSERT(result.IsFunction());
835 Function& func = Function::Handle(isolate); 838 Function& func = Function::Handle(isolate);
836 func ^= result.raw(); 839 func ^= result.raw();
837 func = func.ImplicitClosureFunction(); 840 func = func.ImplicitClosureFunction();
838 841
842 // TODO(turnidge): Currently we need a way to force a one-time
843 // breakpoint for all spawned isolates to support isolate
844 // debugging. Remove this once the vmservice becomes the standard
845 // way to debug.
846 if (FLAG_break_at_isolate_spawn) {
847 isolate->debugger()->OneTimeBreakAtEntry(func);
848 }
849
839 const Array& capabilities = Array::Handle(Array::New(2)); 850 const Array& capabilities = Array::Handle(Array::New(2));
840 Capability& capability = Capability::Handle(); 851 Capability& capability = Capability::Handle();
841 capability = Capability::New(isolate->pause_capability()); 852 capability = Capability::New(isolate->pause_capability());
842 capabilities.SetAt(0, capability); 853 capabilities.SetAt(0, capability);
843 capability = Capability::New(isolate->terminate_capability()); 854 capability = Capability::New(isolate->terminate_capability());
844 capabilities.SetAt(1, capability); 855 capabilities.SetAt(1, capability);
845 856
846 // Instead of directly invoking the entry point we call '_startIsolate' with 857 // Instead of directly invoking the entry point we call '_startIsolate' with
847 // the entry point as argument. 858 // the entry point as argument.
848 // Since this function ("RunIsolate") is used for both Isolate.spawn and 859 // Since this function ("RunIsolate") is used for both Isolate.spawn and
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 serialized_message_, serialized_message_len_); 1553 serialized_message_, serialized_message_len_);
1543 } 1554 }
1544 1555
1545 1556
1546 void IsolateSpawnState::Cleanup() { 1557 void IsolateSpawnState::Cleanup() {
1547 SwitchIsolateScope switch_scope(I); 1558 SwitchIsolateScope switch_scope(I);
1548 Dart::ShutdownIsolate(); 1559 Dart::ShutdownIsolate();
1549 } 1560 }
1550 1561
1551 } // namespace dart 1562 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/service/object.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698