blob: d29c22c2148e13485e16b8e12061dd7c906e5708 [file] [log] [blame]
Dangyi Liu8b39ccb2023-03-22 21:01:05 +00001// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Dangyi Liu6ca0a602023-04-10 21:26:11 +00005#ifndef SRC_LIB_UNWINDER_SCS_UNWINDER_H_
6#define SRC_LIB_UNWINDER_SCS_UNWINDER_H_
Dangyi Liu8b39ccb2023-03-22 21:01:05 +00007
Dangyi Liu6ca0a602023-04-10 21:26:11 +00008#include "src/lib/unwinder/memory.h"
9#include "src/lib/unwinder/registers.h"
Dangyi Liu8b39ccb2023-03-22 21:01:05 +000010
11namespace unwinder {
12
13// Unwind from Shadow Call Stacks, only available on arm64.
14//
15// It's inherently unreliable to unwind from a shadow call stack, because
Dangyi Liu1ab77442023-03-29 23:00:04 +000016// 1) The shadow call stack provides nothing other than return addresses, so it's not possible to
17// unwind the following frames with other unwinders.
18// 2) A function can choose not to implement shadow call stack, e.g. a library compiled without
19// SCS, and the unwinder has no way to detect; those frames will be dropped silently.
Dangyi Liu8b39ccb2023-03-22 21:01:05 +000020class ShadowCallStackUnwinder {
21 public:
Dangyi Liu1ab77442023-03-29 23:00:04 +000022 Error Step(Memory* scs, const Registers& current, Registers& next);
Dangyi Liu8b39ccb2023-03-22 21:01:05 +000023};
24
25} // namespace unwinder
26
Dangyi Liu6ca0a602023-04-10 21:26:11 +000027#endif // SRC_LIB_UNWINDER_SCS_UNWINDER_H_