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/exceptions.h" | 7 #include "vm/exceptions.h" |
8 #include "vm/object_store.h" | 8 #include "vm/object_store.h" |
9 #include "vm/runtime_entry.h" | 9 #include "vm/runtime_entry.h" |
10 #include "vm/stack_frame.h" | 10 #include "vm/stack_frame.h" |
11 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 static void IterateFrames(const GrowableObjectArray& code_list, | 14 static void IterateFrames(const GrowableObjectArray& code_list, |
15 const GrowableObjectArray& pc_offset_list, | 15 const GrowableObjectArray& pc_offset_list, |
16 int skip_frames) { | 16 int skip_frames) { |
17 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); | 17 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); |
18 StackFrame* frame = frames.NextFrame(); | 18 StackFrame* frame = frames.NextFrame(); |
19 ASSERT(frame != NULL); // We expect to find a dart invocation frame. | 19 ASSERT(frame != NULL); // We expect to find a dart invocation frame. |
20 Code& code = Code::Handle(); | 20 Code& code = Code::Handle(); |
21 Smi& offset = Smi::Handle(); | 21 Smi& offset = Smi::Handle(); |
22 while (frame != NULL) { | 22 while (frame != NULL) { |
23 if (frame->IsDartFrame()) { | 23 if (frame->IsDartFrame()) { |
24 if (skip_frames > 0) { | 24 if (skip_frames > 0) { |
25 skip_frames--; | 25 skip_frames--; |
26 } else { | 26 } else { |
27 code = frame->LookupDartCode(); | 27 code = frame->LookupDartCode(); |
28 offset = Smi::New(frame->pc() - code.EntryPoint()); | 28 offset = Smi::New(frame->pc() - code.PayloadStart()); |
29 code_list.Add(code); | 29 code_list.Add(code); |
30 pc_offset_list.Add(offset); | 30 pc_offset_list.Add(offset); |
31 } | 31 } |
32 } | 32 } |
33 frame = frames.NextFrame(); | 33 frame = frames.NextFrame(); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 // Creates a Stacktrace object from the current stack. | 37 // Creates a Stacktrace object from the current stack. |
38 // | 38 // |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 frame = frames.NextFrame(); | 70 frame = frames.NextFrame(); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 DEFINE_NATIVE_ENTRY(StackTrace_current, 0) { | 74 DEFINE_NATIVE_ENTRY(StackTrace_current, 0) { |
75 const Stacktrace& stacktrace = GetCurrentStacktrace(1); | 75 const Stacktrace& stacktrace = GetCurrentStacktrace(1); |
76 return stacktrace.raw(); | 76 return stacktrace.raw(); |
77 } | 77 } |
78 | 78 |
79 } // namespace dart | 79 } // namespace dart |
OLD | NEW |