xref: /freebsd/contrib/llvm-project/libunwind/src/libunwind_ext.h (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1 //===----------------------------------------------------------------------===//
2 //
3 // 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
6 //
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
23 extern "C" {
24 #endif
25 
26 extern int __unw_getcontext(unw_context_t *);
27 extern int __unw_init_local(unw_cursor_t *, unw_context_t *);
28 extern int __unw_step(unw_cursor_t *);
29 extern int __unw_get_reg(unw_cursor_t *, unw_regnum_t, unw_word_t *);
30 extern int __unw_get_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t *);
31 extern int __unw_set_reg(unw_cursor_t *, unw_regnum_t, unw_word_t);
32 extern int __unw_set_fpreg(unw_cursor_t *, unw_regnum_t, unw_fpreg_t);
33 extern int __unw_resume(unw_cursor_t *);
34 
35 #ifdef __arm__
36 /* Save VFP registers in FSTMX format (instead of FSTMD). */
37 extern void __unw_save_vfp_as_X(unw_cursor_t *);
38 #endif
39 
40 extern const char *__unw_regname(unw_cursor_t *, unw_regnum_t);
41 extern int __unw_get_proc_info(unw_cursor_t *, unw_proc_info_t *);
42 extern int __unw_is_fpreg(unw_cursor_t *, unw_regnum_t);
43 extern int __unw_is_signal_frame(unw_cursor_t *);
44 extern int __unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *);
45 
46 // SPI
47 extern void __unw_iterate_dwarf_unwind_cache(void (*func)(
48     unw_word_t ip_start, unw_word_t ip_end, unw_word_t fde, unw_word_t mh));
49 
50 // IPI
51 extern void __unw_add_dynamic_fde(unw_word_t fde);
52 extern void __unw_remove_dynamic_fde(unw_word_t fde);
53 
54 extern void __unw_add_dynamic_eh_frame_section(unw_word_t eh_frame_start);
55 extern void __unw_remove_dynamic_eh_frame_section(unw_word_t eh_frame_start);
56 
57 #if defined(_LIBUNWIND_ARM_EHABI)
58 extern const uint32_t* decode_eht_entry(const uint32_t*, size_t*, size_t*);
59 extern _Unwind_Reason_Code _Unwind_VRS_Interpret(_Unwind_Context *context,
60                                                  const uint32_t *data,
61                                                  size_t offset, size_t len);
62 #endif
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif // __LIBUNWIND_EXT__
69