blob: 28ad8043f2a466f2663b8830fbf8a53ac324e350 [file] [log] [blame]
Rafael Espindola18c79202011-12-08 05:01:39 +00001/*===---- unwind.h - Stack unwinding ----------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
25
Douglas Gregor38f39812012-01-24 15:12:50 +000026#if defined(__APPLE__) && __has_include_next(<unwind.h>)
27/* Darwin typically has its own unwind.h; use it. */
28# include_next <unwind.h>
Rafael Espindola18c79202011-12-08 05:01:39 +000029#else
30
31#include <stdint.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
Rafael Espindola7a284b22011-12-09 00:08:01 +000037/* It is a bit strange for a header to play with the visibility of the
38 symbols it declares, but this matches gcc's behavior and some programs
39 depend on it */
40#pragma GCC visibility push(default)
41
Rafael Espindola18c79202011-12-08 05:01:39 +000042struct _Unwind_Context;
43typedef enum {
44 _URC_NO_REASON = 0,
45 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
46
47 _URC_FATAL_PHASE2_ERROR = 2,
48 _URC_FATAL_PHASE1_ERROR = 3,
49 _URC_NORMAL_STOP = 4,
50
51 _URC_END_OF_STACK = 5,
52 _URC_HANDLER_FOUND = 6,
53 _URC_INSTALL_CONTEXT = 7,
54 _URC_CONTINUE_UNWIND = 8
55} _Unwind_Reason_Code;
56
Evgeniy Stepanov5dfe9f22012-01-19 11:39:05 +000057
58#ifdef __arm__
59
60typedef enum {
61 _UVRSC_CORE = 0, /* integer register */
62 _UVRSC_VFP = 1, /* vfp */
63 _UVRSC_WMMXD = 3, /* Intel WMMX data register */
64 _UVRSC_WMMXC = 4 /* Intel WMMX control register */
65} _Unwind_VRS_RegClass;
66
67typedef enum {
68 _UVRSD_UINT32 = 0,
69 _UVRSD_VFPX = 1,
70 _UVRSD_UINT64 = 3,
71 _UVRSD_FLOAT = 4,
72 _UVRSD_DOUBLE = 5
73} _Unwind_VRS_DataRepresentation;
74
75typedef enum {
76 _UVRSR_OK = 0,
77 _UVRSR_NOT_IMPLEMENTED = 1,
78 _UVRSR_FAILED = 2
79} _Unwind_VRS_Result;
80
81_Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *context,
82 _Unwind_VRS_RegClass regclass,
83 uint32_t regno,
84 _Unwind_VRS_DataRepresentation representation,
85 void *valuep);
86
87#else
88
Rafael Espindola18c79202011-12-08 05:01:39 +000089uintptr_t _Unwind_GetIP(struct _Unwind_Context* context);
Evgeniy Stepanov5dfe9f22012-01-19 11:39:05 +000090
91#endif
92
Rafael Espindola18c79202011-12-08 05:01:39 +000093typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context*, void*);
94_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void*);
95
Rafael Espindola7a284b22011-12-09 00:08:01 +000096#pragma GCC visibility pop
97
Rafael Espindola18c79202011-12-08 05:01:39 +000098#ifdef __cplusplus
99}
100#endif
101
102#endif