| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 #ifndef RUNTIME_VM_STACK_TRACE_H_ | 5 #ifndef RUNTIME_VM_STACK_TRACE_H_ |
| 6 #define RUNTIME_VM_STACK_TRACE_H_ | 6 #define RUNTIME_VM_STACK_TRACE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/flag_list.h" | 9 #include "vm/flag_list.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 DECLARE_FLAG(bool, show_invisible_frames); | 14 DECLARE_FLAG(bool, show_invisible_frames); |
| 15 | 15 |
| 16 class StackTraceUtils : public AllStatic { | 16 class StackTraceUtils : public AllStatic { |
| 17 public: | 17 public: |
| 18 /// Counts the number of stack frames. | 18 /// Counts the number of stack frames. |
| 19 /// Skips over the first |skip_frames|. | 19 /// Skips over the first |skip_frames|. |
| 20 /// If |async_function| is not null, stops at the function that has | 20 /// If |async_function| is not null, stops at the function that has |
| 21 /// |async_function| as its parent. | 21 /// |async_function| as its parent. |
| 22 static intptr_t CountFrames( | 22 static intptr_t CountFrames(Thread* thread, |
| 23 Thread* thread, | 23 int skip_frames, |
| 24 int skip_frames, | 24 const Function& async_function); |
| 25 const Function& async_function, | |
| 26 bool count_invisible_frames = FLAG_show_invisible_frames); | |
| 27 | 25 |
| 28 /// Collects |count| frames into |code_array| and |pc_offset_array|. | 26 /// Collects |count| frames into |code_array| and |pc_offset_array|. |
| 29 /// Writing begins at |array_offset|. | 27 /// Writing begins at |array_offset|. |
| 30 /// Skips over the first |skip_frames|. | 28 /// Skips over the first |skip_frames|. |
| 31 /// Returns the number of frames collected. | 29 /// Returns the number of frames collected. |
| 32 static intptr_t CollectFrames( | 30 static intptr_t CollectFrames(Thread* thread, |
| 33 Thread* thread, | 31 const Array& code_array, |
| 34 const Array& code_array, | 32 const Array& pc_offset_array, |
| 35 const Array& pc_offset_array, | 33 intptr_t array_offset, |
| 36 intptr_t array_offset, | 34 intptr_t count, |
| 37 intptr_t count, | 35 int skip_frames); |
| 38 int skip_frames, | |
| 39 bool collect_invisible_frames = FLAG_show_invisible_frames); | |
| 40 | 36 |
| 41 /// If |thread| has no async_stack_trace, does nothing. | 37 /// If |thread| has no async_stack_trace, does nothing. |
| 42 /// Populates |async_function| with the top function of the async stack | 38 /// Populates |async_function| with the top function of the async stack |
| 43 /// trace. Populates |async_stack_trace|, |async_code_array|, and | 39 /// trace. Populates |async_stack_trace|, |async_code_array|, and |
| 44 /// |async_pc_offset_array| with the thread's async_stack_trace. | 40 /// |async_pc_offset_array| with the thread's async_stack_trace. |
| 45 /// Returns the length of the asynchronous stack trace. | 41 /// Returns the length of the asynchronous stack trace. |
| 46 static intptr_t ExtractAsyncStackTraceInfo(Thread* thread, | 42 static intptr_t ExtractAsyncStackTraceInfo(Thread* thread, |
| 47 Function* async_function, | 43 Function* async_function, |
| 48 StackTrace* async_stack_trace, | 44 StackTrace* async_stack_trace, |
| 49 Array* async_code_array, | 45 Array* async_code_array, |
| 50 Array* async_pc_offset_array); | 46 Array* async_pc_offset_array); |
| 51 }; | 47 }; |
| 52 | 48 |
| 53 } // namespace dart | 49 } // namespace dart |
| 54 | 50 |
| 55 #endif // RUNTIME_VM_STACK_TRACE_H_ | 51 #endif // RUNTIME_VM_STACK_TRACE_H_ |
| OLD | NEW |