unwind.h revision f5f18bfde0e46c154cf0207c895f917d0b50d53f
1/*===---- 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
26#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
27    __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >=  1070
28/* Starting in OS X Lion the SDK includes a unwind.h. We should just use it. */
29#include_next <unwind.h>
30#else
31
32#include <stdint.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/* It is a bit strange for a header to play with the visibility of the
39   symbols it declares, but this matches gcc's behavior and some programs
40   depend on it */
41#pragma GCC visibility push(default)
42
43struct _Unwind_Context;
44typedef enum {
45  _URC_NO_REASON = 0,
46  _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
47
48  _URC_FATAL_PHASE2_ERROR = 2,
49  _URC_FATAL_PHASE1_ERROR = 3,
50  _URC_NORMAL_STOP = 4,
51
52  _URC_END_OF_STACK = 5,
53  _URC_HANDLER_FOUND = 6,
54  _URC_INSTALL_CONTEXT = 7,
55  _URC_CONTINUE_UNWIND = 8
56} _Unwind_Reason_Code;
57
58
59#ifdef __arm__
60
61typedef enum {
62  _UVRSC_CORE = 0,        /* integer register */
63  _UVRSC_VFP = 1,         /* vfp */
64  _UVRSC_WMMXD = 3,       /* Intel WMMX data register */
65  _UVRSC_WMMXC = 4        /* Intel WMMX control register */
66} _Unwind_VRS_RegClass;
67
68typedef enum {
69  _UVRSD_UINT32 = 0,
70  _UVRSD_VFPX = 1,
71  _UVRSD_UINT64 = 3,
72  _UVRSD_FLOAT = 4,
73  _UVRSD_DOUBLE = 5
74} _Unwind_VRS_DataRepresentation;
75
76typedef enum {
77  _UVRSR_OK = 0,
78  _UVRSR_NOT_IMPLEMENTED = 1,
79  _UVRSR_FAILED = 2
80} _Unwind_VRS_Result;
81
82_Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *context,
83  _Unwind_VRS_RegClass regclass,
84  uint32_t regno,
85  _Unwind_VRS_DataRepresentation representation,
86  void *valuep);
87
88#else
89
90uintptr_t _Unwind_GetIP(struct _Unwind_Context* context);
91
92#endif
93
94typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context*, void*);
95_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void*);
96
97#pragma GCC visibility pop
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif
104