| 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 "lib/stacktrace.h" | 5 #include "lib/stacktrace.h" |
| 6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
| 7 #include "vm/debugger.h" | 7 #include "vm/debugger.h" |
| 8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 // Creates a StackTrace object from the current stack. | 167 // Creates a StackTrace object from the current stack. |
| 168 // | 168 // |
| 169 // Skips the first skip_frames Dart frames. | 169 // Skips the first skip_frames Dart frames. |
| 170 const StackTrace& GetCurrentStackTrace(int skip_frames) { | 170 const StackTrace& GetCurrentStackTrace(int skip_frames) { |
| 171 const GrowableObjectArray& code_list = | 171 const GrowableObjectArray& code_list = |
| 172 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 172 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 173 const GrowableObjectArray& pc_offset_list = | 173 const GrowableObjectArray& pc_offset_list = |
| 174 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 174 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 175 AppendFrames(code_list, pc_offset_list, skip_frames); | 175 AppendFrames(code_list, pc_offset_list, skip_frames); |
| 176 const Array& code_array = Array::Handle(Array::MakeArray(code_list)); | 176 const Array& code_array = Array::Handle(Array::MakeFixedLength(code_list)); |
| 177 const Array& pc_offset_array = | 177 const Array& pc_offset_array = |
| 178 Array::Handle(Array::MakeArray(pc_offset_list)); | 178 Array::Handle(Array::MakeFixedLength(pc_offset_list)); |
| 179 const StackTrace& stacktrace = | 179 const StackTrace& stacktrace = |
| 180 StackTrace::Handle(StackTrace::New(code_array, pc_offset_array)); | 180 StackTrace::Handle(StackTrace::New(code_array, pc_offset_array)); |
| 181 return stacktrace; | 181 return stacktrace; |
| 182 } | 182 } |
| 183 | 183 |
| 184 | 184 |
| 185 // An utility method for convenient printing of dart stack traces when | 185 // An utility method for convenient printing of dart stack traces when |
| 186 // inside 'gdb'. Note: This function will only work when there is a | 186 // inside 'gdb'. Note: This function will only work when there is a |
| 187 // valid exit frame information. It will not work when a breakpoint is | 187 // valid exit frame information. It will not work when a breakpoint is |
| 188 // set in dart code and control is got inside 'gdb' without going through | 188 // set in dart code and control is got inside 'gdb' without going through |
| (...skipping 10 matching lines...) Expand all Loading... |
| 199 Thread::Current(), | 199 Thread::Current(), |
| 200 StackFrameIterator::kNoCrossThreadIteration); | 200 StackFrameIterator::kNoCrossThreadIteration); |
| 201 StackFrame* frame = frames.NextFrame(); | 201 StackFrame* frame = frames.NextFrame(); |
| 202 while (frame != NULL) { | 202 while (frame != NULL) { |
| 203 OS::PrintErr("%s\n", frame->ToCString()); | 203 OS::PrintErr("%s\n", frame->ToCString()); |
| 204 frame = frames.NextFrame(); | 204 frame = frames.NextFrame(); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace dart | 208 } // namespace dart |
| OLD | NEW |