Jackson Cooper-Driver | c024948 | 2024-07-09 10:34:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2024, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __BACKTRACE_H__ |
| 9 | #define __BACKTRACE_H__ |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | /** |
| 14 | * Function type to pass into tfm_dump_backtrace to |
| 15 | * log the backtrace output |
| 16 | */ |
| 17 | typedef void (*tfm_log_func)(const char *fmt, ...); |
| 18 | |
| 19 | /** |
| 20 | * Dump a backtrace of current location to the |
| 21 | * terminal |
| 22 | * - info: Information string to be printed with |
| 23 | * the backtrace |
| 24 | * - log_func: Function which will be called to log output |
| 25 | */ |
| 26 | void tfm_dump_backtrace(const char *info, tfm_log_func log_func); |
| 27 | |
| 28 | /** |
| 29 | * Collect a backtrace and store it in the buffer |
| 30 | * - buf: Buffer to store the backtrace data |
| 31 | * - buf_size: Size of the buffer in uint32_t dwords |
| 32 | * - num_frames: Receieves the numer of stack frames read into |
| 33 | * the buffer |
| 34 | */ |
| 35 | void tfm_get_backtrace(uint32_t *buf, uint8_t buf_size, uint8_t *num_frames); |
| 36 | |
| 37 | |
| 38 | #endif /* __BACKTRACE_H__ */ |