OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
6 | 6 |
7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 | 166 |
167 DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { | 167 DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) { |
168 Isolate* isolate = Isolate::Current(); | 168 Isolate* isolate = Isolate::Current(); |
169 DARTSCOPE(isolate); | 169 DARTSCOPE(isolate); |
170 CHECK_NOT_NULL(trace); | 170 CHECK_NOT_NULL(trace); |
171 *trace = reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); | 171 *trace = reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); |
172 return Api::True(isolate); | 172 return Api::True(isolate); |
173 } | 173 } |
174 | 174 |
| 175 DART_EXPORT Dart_Handle Dart_GetStackTrace2() { |
| 176 Isolate* isolate = Isolate::Current(); |
| 177 DARTSCOPE(isolate); |
| 178 const GrowableObjectArray& scriptUrls = |
| 179 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); |
| 180 DebuggerStackTrace* stackTrace = isolate->debugger()->CollectStackTrace(); |
| 181 for (intptr_t i = 0; i < stackTrace->Length(); ++i) { |
| 182 String& scriptUrl = String::Handle(); |
| 183 scriptUrl ^= stackTrace->ActivationFrameAt(i)->SourceUrl(); |
| 184 scriptUrls.Add(scriptUrl); |
| 185 } |
| 186 return Api::NewHandle(isolate, Array::MakeArray(scriptUrls)); |
| 187 } |
| 188 |
175 | 189 |
176 DART_EXPORT Dart_Handle Dart_ActivationFrameInfo( | 190 DART_EXPORT Dart_Handle Dart_ActivationFrameInfo( |
177 Dart_ActivationFrame activation_frame, | 191 Dart_ActivationFrame activation_frame, |
178 Dart_Handle* function_name, | 192 Dart_Handle* function_name, |
179 Dart_Handle* script_url, | 193 Dart_Handle* script_url, |
180 intptr_t* line_number, | 194 intptr_t* line_number, |
181 intptr_t* library_id) { | 195 intptr_t* library_id) { |
182 Isolate* isolate = Isolate::Current(); | 196 Isolate* isolate = Isolate::Current(); |
183 DARTSCOPE(isolate); | 197 DARTSCOPE(isolate); |
184 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); | 198 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 for (int i = 0; i < num_libs; i++) { | 664 for (int i = 0; i < num_libs; i++) { |
651 lib ^= libs.At(i); | 665 lib ^= libs.At(i); |
652 ASSERT(!lib.IsNull()); | 666 ASSERT(!lib.IsNull()); |
653 lib_url = lib.url(); | 667 lib_url = lib.url(); |
654 library_url_list.SetAt(i, lib_url); | 668 library_url_list.SetAt(i, lib_url); |
655 } | 669 } |
656 return Api::NewHandle(isolate, library_url_list.raw()); | 670 return Api::NewHandle(isolate, library_url_list.raw()); |
657 } | 671 } |
658 | 672 |
659 } // namespace dart | 673 } // namespace dart |
OLD | NEW |