| 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(), |
| 146 StackFrameIterator::kNoCrossThreadIteration); |
| 145 StackFrame* frame = frames.NextFrame(); | 147 StackFrame* frame = frames.NextFrame(); |
| 146 ASSERT(frame != NULL); // We expect to find a dart invocation frame. | 148 ASSERT(frame != NULL); // We expect to find a dart invocation frame. |
| 147 Code& code = Code::Handle(); | 149 Code& code = Code::Handle(); |
| 148 Smi& offset = Smi::Handle(); | 150 Smi& offset = Smi::Handle(); |
| 149 while (frame != NULL) { | 151 while (frame != NULL) { |
| 150 if (frame->IsDartFrame()) { | 152 if (frame->IsDartFrame()) { |
| 151 if (skip_frames > 0) { | 153 if (skip_frames > 0) { |
| 152 skip_frames--; | 154 skip_frames--; |
| 153 } else { | 155 } else { |
| 154 code = frame->LookupDartCode(); | 156 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 | 188 // set in dart code and control is got inside 'gdb' without going through |
| 187 // the runtime or native transition stub. | 189 // the runtime or native transition stub. |
| 188 void _printCurrentStackTrace() { | 190 void _printCurrentStackTrace() { |
| 189 const StackTrace& stacktrace = GetCurrentStackTrace(0); | 191 const StackTrace& stacktrace = GetCurrentStackTrace(0); |
| 190 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString()); | 192 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString()); |
| 191 } | 193 } |
| 192 | 194 |
| 193 | 195 |
| 194 // Like _printCurrentStackTrace, but works in a NoSafepointScope. | 196 // Like _printCurrentStackTrace, but works in a NoSafepointScope. |
| 195 void _printCurrentStackTraceNoSafepoint() { | 197 void _printCurrentStackTraceNoSafepoint() { |
| 196 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); | 198 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames, |
| 199 Thread::Current(), |
| 200 StackFrameIterator::kNoCrossThreadIteration); |
| 197 StackFrame* frame = frames.NextFrame(); | 201 StackFrame* frame = frames.NextFrame(); |
| 198 while (frame != NULL) { | 202 while (frame != NULL) { |
| 199 OS::PrintErr("%s\n", frame->ToCString()); | 203 OS::PrintErr("%s\n", frame->ToCString()); |
| 200 frame = frames.NextFrame(); | 204 frame = frames.NextFrame(); |
| 201 } | 205 } |
| 202 } | 206 } |
| 203 | 207 |
| 204 } // namespace dart | 208 } // namespace dart |
| OLD | NEW |