| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 GET_NON_NULL_NATIVE_ARGUMENT(StackTrace, stack_trace, | 134 GET_NON_NULL_NATIVE_ARGUMENT(StackTrace, stack_trace, |
| 135 arguments->NativeArgAt(0)); | 135 arguments->NativeArgAt(0)); |
| 136 thread->set_async_stack_trace(stack_trace); | 136 thread->set_async_stack_trace(stack_trace); |
| 137 return Object::null(); | 137 return Object::null(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 static void AppendFrames(const GrowableObjectArray& code_list, | 141 static void AppendFrames(const GrowableObjectArray& code_list, |
| 142 const GrowableObjectArray& pc_offset_list, | 142 const GrowableObjectArray& pc_offset_list, |
| 143 int skip_frames) { | 143 int skip_frames) { |
| 144 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); | 144 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames, |
| 145 Thread::Current(), false); |
| 145 StackFrame* frame = frames.NextFrame(); | 146 StackFrame* frame = frames.NextFrame(); |
| 146 ASSERT(frame != NULL); // We expect to find a dart invocation frame. | 147 ASSERT(frame != NULL); // We expect to find a dart invocation frame. |
| 147 Code& code = Code::Handle(); | 148 Code& code = Code::Handle(); |
| 148 Smi& offset = Smi::Handle(); | 149 Smi& offset = Smi::Handle(); |
| 149 while (frame != NULL) { | 150 while (frame != NULL) { |
| 150 if (frame->IsDartFrame()) { | 151 if (frame->IsDartFrame()) { |
| 151 if (skip_frames > 0) { | 152 if (skip_frames > 0) { |
| 152 skip_frames--; | 153 skip_frames--; |
| 153 } else { | 154 } else { |
| 154 code = frame->LookupDartCode(); | 155 code = frame->LookupDartCode(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // set in dart code and control is got inside 'gdb' without going through | 187 // set in dart code and control is got inside 'gdb' without going through |
| 187 // the runtime or native transition stub. | 188 // the runtime or native transition stub. |
| 188 void _printCurrentStackTrace() { | 189 void _printCurrentStackTrace() { |
| 189 const StackTrace& stacktrace = GetCurrentStackTrace(0); | 190 const StackTrace& stacktrace = GetCurrentStackTrace(0); |
| 190 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString()); | 191 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString()); |
| 191 } | 192 } |
| 192 | 193 |
| 193 | 194 |
| 194 // Like _printCurrentStackTrace, but works in a NoSafepointScope. | 195 // Like _printCurrentStackTrace, but works in a NoSafepointScope. |
| 195 void _printCurrentStackTraceNoSafepoint() { | 196 void _printCurrentStackTraceNoSafepoint() { |
| 196 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); | 197 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames, |
| 198 Thread::Current(), false); |
| 197 StackFrame* frame = frames.NextFrame(); | 199 StackFrame* frame = frames.NextFrame(); |
| 198 while (frame != NULL) { | 200 while (frame != NULL) { |
| 199 OS::PrintErr("%s\n", frame->ToCString()); | 201 OS::PrintErr("%s\n", frame->ToCString()); |
| 200 frame = frames.NextFrame(); | 202 frame = frames.NextFrame(); |
| 201 } | 203 } |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace dart | 206 } // namespace dart |
| OLD | NEW |