Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
dart-lang
sdk
runtime
vm
stack_trace.h
Go to the documentation of this 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
3
// BSD-style license that can be found in the LICENSE file.
4
5
#ifndef RUNTIME_VM_STACK_TRACE_H_
6
#define RUNTIME_VM_STACK_TRACE_H_
7
8
#include <functional>
9
10
#include "
vm/allocation.h
"
11
#include "
vm/flag_list.h
"
12
#include "
vm/object.h
"
13
#include "
vm/symbols.h
"
14
15
namespace
dart
{
16
17
class
StackTraceUtils
:
public
AllStatic
{
18
public
:
19
static
constexpr
uword
kFutureListenerPcOffset
= 1;
20
21
struct
Frame
{
22
// Corresponding on stack frame or |nullptr| if this is an awaiter frame
23
// or a gap.
24
StackFrame
*
frame
;
25
26
// Code object corresponding to this frame.
27
const
Code
&
code
;
28
29
// Offset into the code object corresponding to this frame.
30
//
31
// Will be set to |kFutureListenerPcOffset| if this frame corresponds to
32
// future listener that is not yet executing.
33
uword
pc_offset
;
34
35
// Closure corresponding to the awaiter frame or |null| if this is
36
// a synchronous frame or a gap.
37
const
Closure
&
closure
;
38
};
39
40
// Returns |true| if this function is needed to correctly unwind through
41
// awaiter chains. This means AOT compiler should retain |Function| object,
42
// its signature and the corresponding |Code| object (so that we could
43
// perform the reverse lookup).
44
static
bool
IsNeededForAsyncAwareUnwinding
(
const
Function
&
function
);
45
46
// Returns |true| if the given class might serve as an awaiter-link when
47
// unwinding an awaiter chain.
48
//
49
// This is used to eagerly mark tear-offs of methods on this class
50
// as having an awaiter-link.
51
static
bool
IsPossibleAwaiterLink
(
const
Class
& cls);
52
53
/// Collects all frames on the current stack until an async/async* frame is
54
/// hit which has yielded before (i.e. is not in sync-async case).
55
///
56
/// From there on finds the closure of the async/async* frame and starts
57
/// traversing the listeners.
58
static
void
CollectFrames
(
59
Thread
* thread,
60
int
skip_frames,
61
const
std::function<
void
(
const
Frame
&)>& handle_frame,
62
bool
* has_async_catch_error =
nullptr
);
63
64
// If |closure| has an awaiter-link pointing to the |SuspendState|
65
// the return that object.
66
static
bool
GetSuspendState
(
const
Closure
& closure,
Object
* suspend_state);
67
};
68
69
}
// namespace dart
70
71
#endif
// RUNTIME_VM_STACK_TRACE_H_
dart::AllStatic
Definition
allocation.h:33
dart::Class
Definition
object.h:1135
dart::Closure
Definition
object.h:12282
dart::Code
Definition
object.h:6734
dart::Function
Definition
object.h:2970
dart::Object
Definition
object.h:315
dart::StackFrame
Definition
stack_frame.h:36
dart::StackTraceUtils
Definition
stack_trace.h:17
dart::StackTraceUtils::IsNeededForAsyncAwareUnwinding
static bool IsNeededForAsyncAwareUnwinding(const Function &function)
Definition
stack_trace.cc:730
dart::StackTraceUtils::GetSuspendState
static bool GetSuspendState(const Closure &closure, Object *suspend_state)
Definition
stack_trace.cc:754
dart::StackTraceUtils::CollectFrames
static void CollectFrames(Thread *thread, int skip_frames, const std::function< void(const Frame &)> &handle_frame, bool *has_async_catch_error=nullptr)
Definition
stack_trace.cc:745
dart::StackTraceUtils::IsPossibleAwaiterLink
static bool IsPossibleAwaiterLink(const Class &cls)
Definition
stack_trace.cc:711
dart::StackTraceUtils::kFutureListenerPcOffset
static constexpr uword kFutureListenerPcOffset
Definition
stack_trace.h:19
dart::Thread
Definition
thread.h:342
flag_list.h
function
Dart_NativeFunction function
Definition
fuchsia.cc:51
dart
Definition
dart_vm.cc:33
dart::uword
uintptr_t uword
Definition
globals.h:501
object.h
dart::StackTraceUtils::Frame
Definition
stack_trace.h:21
dart::StackTraceUtils::Frame::pc_offset
uword pc_offset
Definition
stack_trace.h:33
dart::StackTraceUtils::Frame::closure
const Closure & closure
Definition
stack_trace.h:37
dart::StackTraceUtils::Frame::frame
StackFrame * frame
Definition
stack_trace.h:24
dart::StackTraceUtils::Frame::code
const Code & code
Definition
stack_trace.h:27
symbols.h
allocation.h
Generated on Fri Apr 26 2024 06:15:19 for Flutter Engine by
1.9.8