| 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 "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/json.h" | 9 #include "platform/json.h" |
| 10 #include "lib/mirrors.h" | 10 #include "lib/mirrors.h" |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 buffer.Printf("\"line\": %"Pd", ", frame->LineNumber()); | 821 buffer.Printf("\"line\": %"Pd", ", frame->LineNumber()); |
| 822 buffer.Printf("\"function\": \"%s\", ", function.ToCString()); | 822 buffer.Printf("\"function\": \"%s\", ", function.ToCString()); |
| 823 | 823 |
| 824 const Code& code = frame->code(); | 824 const Code& code = frame->code(); |
| 825 buffer.Printf("\"code\": { "); | 825 buffer.Printf("\"code\": { "); |
| 826 buffer.Printf("\"alive\": %s, ", code.is_alive() ? "false" : "true"); | 826 buffer.Printf("\"alive\": %s, ", code.is_alive() ? "false" : "true"); |
| 827 buffer.Printf("\"optimized\": %s }}", | 827 buffer.Printf("\"optimized\": %s }}", |
| 828 code.is_optimized() ? "false" : "true"); | 828 code.is_optimized() ? "false" : "true"); |
| 829 } | 829 } |
| 830 buffer.Printf("]}"); | 830 buffer.Printf("]}"); |
| 831 isolate->stacktrace_ = strndup(buffer.buf(), buffer.length()); | 831 isolate->stacktrace_ = OS::StrNDup(buffer.buf(), buffer.length()); |
| 832 ml.Notify(); | 832 ml.Notify(); |
| 833 return true; | 833 return true; |
| 834 } | 834 } |
| 835 | 835 |
| 836 | 836 |
| 837 bool Isolate::FetchStackFrameDetails() { | 837 bool Isolate::FetchStackFrameDetails() { |
| 838 Isolate* isolate = Isolate::Current(); | 838 Isolate* isolate = Isolate::Current(); |
| 839 ASSERT(isolate->stack_frame_index_ >= 0); | 839 ASSERT(isolate->stack_frame_index_ >= 0); |
| 840 MonitorLocker ml(status_sync); | 840 MonitorLocker ml(status_sync); |
| 841 DebuggerStackTrace* stack = Debugger::CollectStackTrace(); | 841 DebuggerStackTrace* stack = Debugger::CollectStackTrace(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 865 buffer.Printf(", "); | 865 buffer.Printf(", "); |
| 866 } | 866 } |
| 867 intptr_t token_pos, end_pos; | 867 intptr_t token_pos, end_pos; |
| 868 frame->VariableAt(i, &var_name, &token_pos, &end_pos, &value); | 868 frame->VariableAt(i, &var_name, &token_pos, &end_pos, &value); |
| 869 buffer.Printf( | 869 buffer.Printf( |
| 870 "{ \"name\": \"%s\", \"pos\": %"Pd", \"end_pos\": %"Pd", " | 870 "{ \"name\": \"%s\", \"pos\": %"Pd", \"end_pos\": %"Pd", " |
| 871 "\"value\": \"%s\" }", | 871 "\"value\": \"%s\" }", |
| 872 var_name.ToCString(), token_pos, end_pos, value.ToCString()); | 872 var_name.ToCString(), token_pos, end_pos, value.ToCString()); |
| 873 } | 873 } |
| 874 buffer.Printf("]}"); | 874 buffer.Printf("]}"); |
| 875 isolate->stacktrace_ = strndup(buffer.buf(), buffer.length()); | 875 isolate->stacktrace_ = OS::StrNDup(buffer.buf(), buffer.length()); |
| 876 ml.Notify(); | 876 ml.Notify(); |
| 877 return true; | 877 return true; |
| 878 } | 878 } |
| 879 | 879 |
| 880 | 880 |
| 881 char* Isolate::DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb) { | 881 char* Isolate::DoStacktraceInterrupt(Dart_IsolateInterruptCallback cb) { |
| 882 ASSERT(stacktrace_ == NULL); | 882 ASSERT(stacktrace_ == NULL); |
| 883 SetVmStatsCallback(cb); | 883 SetVmStatsCallback(cb); |
| 884 if (status_sync == NULL) { | 884 if (status_sync == NULL) { |
| 885 status_sync = new Monitor(); | 885 status_sync = new Monitor(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 return func.raw(); | 1066 return func.raw(); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 | 1069 |
| 1070 void IsolateSpawnState::Cleanup() { | 1070 void IsolateSpawnState::Cleanup() { |
| 1071 SwitchIsolateScope switch_scope(isolate()); | 1071 SwitchIsolateScope switch_scope(isolate()); |
| 1072 Dart::ShutdownIsolate(); | 1072 Dart::ShutdownIsolate(); |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 } // namespace dart | 1075 } // namespace dart |
| OLD | NEW |