blob: fdc533cb89622e5872f8d8a949180d9d33200597 [file] [log] [blame]
Louis Dionne7f068e52021-11-17 16:25:01 -05001//===----------------------------------------------------------------------===//
Saleem Abdulrasool17552662015-04-24 19:39:17 +00002//
Chandler Carruth61860a52019-01-19 10:56:40 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Saleem Abdulrasool17552662015-04-24 19:39:17 +00006//
7//
8// Extensions to libunwind API.
9//
10//===----------------------------------------------------------------------===//
11
12#ifndef __LIBUNWIND_EXT__
13#define __LIBUNWIND_EXT__
14
15#include "config.h"
16#include <libunwind.h>
17#include <unwind.h>
18
19#define UNW_STEP_SUCCESS 1
20#define UNW_STEP_END 0
21
22#ifdef __cplusplus
23extern "C" {
24#endif
Petr Hosek9bbfad52019-04-03 21:50:03 +000025
26extern int __unw_getcontext(unw_context_t *);
27extern int __unw_init_local(unw_cursor_t *, unw_context_t *);
28extern int __unw_step(unw_cursor_t *);
29extern int __unw_get_reg(unw_cursor_t *, unw_regnum_t, unw_word_t *);
30extern int __unw_get_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t *);
31extern int __unw_set_reg(unw_cursor_t *, unw_regnum_t, unw_word_t);
32extern int __unw_set_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t);
33extern int __unw_resume(unw_cursor_t *);
34
35#ifdef __arm__
36/* Save VFP registers in FSTMX format (instead of FSTMD). */
37extern void __unw_save_vfp_as_X(unw_cursor_t *);
38#endif
39
40extern const char *__unw_regname(unw_cursor_t *, unw_regnum_t);
41extern int __unw_get_proc_info(unw_cursor_t *, unw_proc_info_t *);
42extern int __unw_is_fpreg(unw_cursor_t *, unw_regnum_t);
43extern int __unw_is_signal_frame(unw_cursor_t *);
44extern int __unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *);
45
Xing Xuebbcbce92022-04-13 11:01:59 -040046#if defined(_AIX)
47extern uintptr_t __unw_get_data_rel_base(unw_cursor_t *);
48#endif
49
Saleem Abdulrasool17552662015-04-24 19:39:17 +000050// SPI
Petr Hosek9bbfad52019-04-03 21:50:03 +000051extern void __unw_iterate_dwarf_unwind_cache(void (*func)(
52 unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh));
Saleem Abdulrasool17552662015-04-24 19:39:17 +000053
54// IPI
Petr Hosek9bbfad52019-04-03 21:50:03 +000055extern void __unw_add_dynamic_fde(unw_word_t fde);
56extern void __unw_remove_dynamic_fde(unw_word_t fde);
Saleem Abdulrasool17552662015-04-24 19:39:17 +000057
Peter S. Housel038090f2021-10-14 13:31:05 -070058extern void __unw_add_dynamic_eh_frame_section(unw_word_t eh_frame_start);
59extern void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start);
60
Ranjeet Singh421231a2017-03-31 15:28:06 +000061#if defined(_LIBUNWIND_ARM_EHABI)
Saleem Abdulrasool17552662015-04-24 19:39:17 +000062extern const uint32_t* decode_eht_entry(const uint32_t*, size_t*, size_t*);
63extern _Unwind_Reason_Code _Unwind_VRS_Interpret(_Unwind_Context *context,
64 const uint32_t *data,
65 size_t offset, size_t len);
66#endif
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif // __LIBUNWIND_EXT__