OLD | NEW |
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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 JSONObject jsheap(&jsobj, "_heaps"); | 1923 JSONObject jsheap(&jsobj, "_heaps"); |
1924 heap()->PrintToJSONObject(Heap::kNew, &jsheap); | 1924 heap()->PrintToJSONObject(Heap::kNew, &jsheap); |
1925 heap()->PrintToJSONObject(Heap::kOld, &jsheap); | 1925 heap()->PrintToJSONObject(Heap::kOld, &jsheap); |
1926 } | 1926 } |
1927 | 1927 |
1928 jsobj.AddProperty("runnable", is_runnable()); | 1928 jsobj.AddProperty("runnable", is_runnable()); |
1929 jsobj.AddProperty("livePorts", message_handler()->live_ports()); | 1929 jsobj.AddProperty("livePorts", message_handler()->live_ports()); |
1930 jsobj.AddProperty("pauseOnExit", message_handler()->should_pause_on_exit()); | 1930 jsobj.AddProperty("pauseOnExit", message_handler()->should_pause_on_exit()); |
1931 jsobj.AddProperty("_isReloading", IsReloading()); | 1931 jsobj.AddProperty("_isReloading", IsReloading()); |
1932 | 1932 |
1933 if (debugger() != NULL) { | 1933 if (!is_runnable()) { |
1934 if (!is_runnable()) { | 1934 // Isolate is not yet runnable. |
1935 // Isolate is not yet runnable. | 1935 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); |
1936 ASSERT(debugger()->PauseEvent() == NULL); | 1936 ServiceEvent pause_event(this, ServiceEvent::kNone); |
1937 ServiceEvent pause_event(this, ServiceEvent::kNone); | 1937 jsobj.AddProperty("pauseEvent", &pause_event); |
1938 jsobj.AddProperty("pauseEvent", &pause_event); | 1938 } else if (message_handler()->is_paused_on_start() || |
1939 } else if (message_handler()->is_paused_on_start() || | 1939 message_handler()->should_pause_on_start()) { |
1940 message_handler()->should_pause_on_start()) { | 1940 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); |
1941 ASSERT(debugger()->PauseEvent() == NULL); | 1941 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); |
1942 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); | 1942 jsobj.AddProperty("pauseEvent", &pause_event); |
1943 jsobj.AddProperty("pauseEvent", &pause_event); | 1943 } else if (message_handler()->is_paused_on_exit()) { |
1944 } else if (message_handler()->is_paused_on_exit()) { | 1944 ASSERT((debugger() == NULL) || (debugger()->PauseEvent() == NULL)); |
1945 ASSERT(debugger()->PauseEvent() == NULL); | 1945 ServiceEvent pause_event(this, ServiceEvent::kPauseExit); |
1946 ServiceEvent pause_event(this, ServiceEvent::kPauseExit); | 1946 jsobj.AddProperty("pauseEvent", &pause_event); |
1947 jsobj.AddProperty("pauseEvent", &pause_event); | 1947 } else if ((debugger() != NULL) && |
1948 } else if (debugger()->PauseEvent() != NULL && !resume_request_) { | 1948 (debugger()->PauseEvent() != NULL) && |
1949 jsobj.AddProperty("pauseEvent", debugger()->PauseEvent()); | 1949 !resume_request_) { |
1950 } else { | 1950 jsobj.AddProperty("pauseEvent", debugger()->PauseEvent()); |
1951 ServiceEvent pause_event(this, ServiceEvent::kResume); | 1951 } else { |
| 1952 ServiceEvent pause_event(this, ServiceEvent::kResume); |
1952 | 1953 |
| 1954 if (debugger() != NULL) { |
1953 // TODO(turnidge): Don't compute a full stack trace. | 1955 // TODO(turnidge): Don't compute a full stack trace. |
1954 DebuggerStackTrace* stack = debugger()->StackTrace(); | 1956 DebuggerStackTrace* stack = debugger()->StackTrace(); |
1955 if (stack->Length() > 0) { | 1957 if (stack->Length() > 0) { |
1956 pause_event.set_top_frame(stack->FrameAt(0)); | 1958 pause_event.set_top_frame(stack->FrameAt(0)); |
1957 } | 1959 } |
1958 jsobj.AddProperty("pauseEvent", &pause_event); | |
1959 } | 1960 } |
1960 | 1961 jsobj.AddProperty("pauseEvent", &pause_event); |
1961 jsobj.AddProperty("exceptionPauseMode", | |
1962 ExceptionPauseInfoToServiceEnum(debugger()->GetExceptionPauseInfo())); | |
1963 } | 1962 } |
1964 | 1963 |
1965 const Library& lib = | 1964 const Library& lib = |
1966 Library::Handle(object_store()->root_library()); | 1965 Library::Handle(object_store()->root_library()); |
1967 if (!lib.IsNull()) { | 1966 if (!lib.IsNull()) { |
1968 jsobj.AddProperty("rootLib", lib); | 1967 jsobj.AddProperty("rootLib", lib); |
1969 } | 1968 } |
1970 | 1969 |
1971 { | 1970 { |
1972 JSONObject tagCounters(&jsobj, "_tagCounters"); | 1971 JSONObject tagCounters(&jsobj, "_tagCounters"); |
(...skipping 23 matching lines...) Expand all Loading... |
1996 } | 1995 } |
1997 } | 1996 } |
1998 | 1997 |
1999 { | 1998 { |
2000 JSONArray breakpoints(&jsobj, "breakpoints"); | 1999 JSONArray breakpoints(&jsobj, "breakpoints"); |
2001 if (debugger() != NULL) { | 2000 if (debugger() != NULL) { |
2002 debugger()->PrintBreakpointsToJSONArray(&breakpoints); | 2001 debugger()->PrintBreakpointsToJSONArray(&breakpoints); |
2003 } | 2002 } |
2004 } | 2003 } |
2005 | 2004 |
| 2005 Dart_ExceptionPauseInfo pause_info = (debugger() != NULL) |
| 2006 ? debugger()->GetExceptionPauseInfo() |
| 2007 : kNoPauseOnExceptions; |
| 2008 jsobj.AddProperty("exceptionPauseMode", |
| 2009 ExceptionPauseInfoToServiceEnum(pause_info)); |
| 2010 |
2006 if (debugger() != NULL) { | 2011 if (debugger() != NULL) { |
2007 JSONObject jssettings(&jsobj, "_debuggerSettings"); | 2012 JSONObject settings(&jsobj, "_debuggerSettings"); |
2008 debugger()->PrintSettingsToJSONObject(&jssettings); | 2013 debugger()->PrintSettingsToJSONObject(&settings); |
2009 } | 2014 } |
2010 | 2015 |
2011 { | 2016 { |
2012 GrowableObjectArray& handlers = | 2017 GrowableObjectArray& handlers = |
2013 GrowableObjectArray::Handle(registered_service_extension_handlers()); | 2018 GrowableObjectArray::Handle(registered_service_extension_handlers()); |
2014 if (!handlers.IsNull()) { | 2019 if (!handlers.IsNull()) { |
2015 JSONArray extensions(&jsobj, "extensionRPCs"); | 2020 JSONArray extensions(&jsobj, "extensionRPCs"); |
2016 String& handler_name = String::Handle(); | 2021 String& handler_name = String::Handle(); |
2017 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) { | 2022 for (intptr_t i = 0; i < handlers.Length(); i += kRegisteredEntrySize) { |
2018 handler_name ^= handlers.At(i + kRegisteredNameIndex); | 2023 handler_name ^= handlers.At(i + kRegisteredNameIndex); |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 void IsolateSpawnState::DecrementSpawnCount() { | 2881 void IsolateSpawnState::DecrementSpawnCount() { |
2877 ASSERT(spawn_count_monitor_ != NULL); | 2882 ASSERT(spawn_count_monitor_ != NULL); |
2878 ASSERT(spawn_count_ != NULL); | 2883 ASSERT(spawn_count_ != NULL); |
2879 MonitorLocker ml(spawn_count_monitor_); | 2884 MonitorLocker ml(spawn_count_monitor_); |
2880 ASSERT(*spawn_count_ > 0); | 2885 ASSERT(*spawn_count_ > 0); |
2881 *spawn_count_ = *spawn_count_ - 1; | 2886 *spawn_count_ = *spawn_count_ - 1; |
2882 ml.Notify(); | 2887 ml.Notify(); |
2883 } | 2888 } |
2884 | 2889 |
2885 } // namespace dart | 2890 } // namespace dart |
OLD | NEW |