22
22
module gcc.unwind.generic ;
23
23
24
24
private import gcc.builtins;
25
- private import core.stdc.stdlib ; // for abort
26
25
27
26
/* This is derived from the C++ ABI for IA-64. Where we diverge
28
27
for cross-architecture compatibility are noted with "@@@". */
29
28
30
- extern (C ):
29
+ extern (C ):
31
30
32
31
/* Level 1: Base ABI */
33
32
34
33
/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is
35
34
inefficient for 32-bit and smaller machines. */
36
35
alias _Unwind_Word = __builtin_unwind_uint;
37
36
alias _Unwind_Sword = __builtin_unwind_int;
38
- version (IA64 )
37
+ version (IA64 )
39
38
{
40
- version (HPUX)
39
+ version (HPUX)
41
40
alias _Unwind_Ptr = __builtin_machine_uint;
42
41
else
43
42
alias _Unwind_Ptr = __builtin_pointer_uint;
@@ -110,55 +109,55 @@ enum
110
109
struct _Unwind_Context ;
111
110
112
111
/* Raise an exception, passing along the given exception object. */
113
- _Unwind_Reason_Code _Unwind_RaiseException (_Unwind_Exception * );
112
+ _Unwind_Reason_Code _Unwind_RaiseException (_Unwind_Exception * );
114
113
115
114
/* Raise an exception for forced unwinding. */
116
115
117
116
extern (C ) alias _Unwind_Stop_Fn
118
- = _Unwind_Reason_Code function (int , _Unwind_Action,
119
- _Unwind_Exception_Class,
120
- _Unwind_Exception * ,
121
- _Unwind_Context * , void * );
117
+ = _Unwind_Reason_Code function (int , _Unwind_Action,
118
+ _Unwind_Exception_Class,
119
+ _Unwind_Exception * ,
120
+ _Unwind_Context * , void * );
122
121
123
- _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Exception * , _Unwind_Stop_Fn, void * );
122
+ _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Exception * , _Unwind_Stop_Fn, void * );
124
123
125
124
/* Helper to invoke the exception_cleanup routine. */
126
- void _Unwind_DeleteException (_Unwind_Exception * );
125
+ void _Unwind_DeleteException (_Unwind_Exception * );
127
126
128
127
/* Resume propagation of an existing exception. This is used after
129
128
e.g. executing cleanup code, and not to implement rethrowing. */
130
- void _Unwind_Resume (_Unwind_Exception * );
129
+ void _Unwind_Resume (_Unwind_Exception * );
131
130
132
131
/* @@@ Resume propagation of an FORCE_UNWIND exception, or to rethrow
133
132
a normal exception that was handled. */
134
- _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Exception * );
133
+ _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Exception * );
135
134
136
135
/* @@@ Use unwind data to perform a stack backtrace. The trace callback
137
136
is called for every stack frame in the call chain, but no cleanup
138
137
actions are performed. */
139
138
extern (C ) alias _Unwind_Trace_Fn
140
- = _Unwind_Reason_Code function (_Unwind_Context * , void * );
139
+ = _Unwind_Reason_Code function (_Unwind_Context * , void * );
141
140
142
- _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void * );
141
+ _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void * );
143
142
144
143
/* These functions are used for communicating information about the unwind
145
144
context (i.e. the unwind descriptors and the user register state) between
146
145
the unwind library and the personality routine and landing pad. Only
147
146
selected registers may be manipulated. */
148
147
149
- _Unwind_Word _Unwind_GetGR (_Unwind_Context * , int );
150
- void _Unwind_SetGR (_Unwind_Context * , int , _Unwind_Word);
148
+ _Unwind_Word _Unwind_GetGR (_Unwind_Context * , int );
149
+ void _Unwind_SetGR (_Unwind_Context * , int , _Unwind_Word);
151
150
152
- _Unwind_Ptr _Unwind_GetIP (_Unwind_Context * );
153
- _Unwind_Ptr _Unwind_GetIPInfo (_Unwind_Context * , int * );
154
- void _Unwind_SetIP (_Unwind_Context * , _Unwind_Ptr);
151
+ _Unwind_Ptr _Unwind_GetIP (_Unwind_Context * );
152
+ _Unwind_Ptr _Unwind_GetIPInfo (_Unwind_Context * , int * );
153
+ void _Unwind_SetIP (_Unwind_Context * , _Unwind_Ptr);
155
154
156
155
/* @@@ Retrieve the CFA of the given context. */
157
- _Unwind_Word _Unwind_GetCFA (_Unwind_Context * );
156
+ _Unwind_Word _Unwind_GetCFA (_Unwind_Context * );
158
157
159
- void * _Unwind_GetLanguageSpecificData (_Unwind_Context * );
158
+ void * _Unwind_GetLanguageSpecificData(_Unwind_Context * );
160
159
161
- _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context * );
160
+ _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context * );
162
161
163
162
164
163
/* The personality routine is the function in the C++ (or other language)
@@ -176,55 +175,55 @@ _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);
176
175
lack of code to handle the different data format. */
177
176
178
177
extern (C ) alias _Unwind_Personality_Fn
179
- = _Unwind_Reason_Code function (int , _Unwind_Action,
180
- _Unwind_Exception_Class,
181
- _Unwind_Exception * ,
182
- _Unwind_Context * );
178
+ = _Unwind_Reason_Code function (int , _Unwind_Action,
179
+ _Unwind_Exception_Class,
180
+ _Unwind_Exception * ,
181
+ _Unwind_Context * );
183
182
184
183
/* @@@ The following alternate entry points are for setjmp/longjmp
185
184
based unwinding. */
186
185
187
186
struct SjLj_Function_Context ;
188
- extern void _Unwind_SjLj_Register (SjLj_Function_Context * );
189
- extern void _Unwind_SjLj_Unregister (SjLj_Function_Context * );
187
+ extern void _Unwind_SjLj_Register(SjLj_Function_Context * );
188
+ extern void _Unwind_SjLj_Unregister(SjLj_Function_Context * );
190
189
191
- _Unwind_Reason_Code _Unwind_SjLj_RaiseException (_Unwind_Exception * );
192
- _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind (_Unwind_Exception * , _Unwind_Stop_Fn, void * );
193
- void _Unwind_SjLj_Resume (_Unwind_Exception * );
194
- _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (_Unwind_Exception * );
190
+ _Unwind_Reason_Code _Unwind_SjLj_RaiseException (_Unwind_Exception * );
191
+ _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind (_Unwind_Exception * , _Unwind_Stop_Fn, void * );
192
+ void _Unwind_SjLj_Resume (_Unwind_Exception * );
193
+ _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (_Unwind_Exception * );
195
194
196
195
/* @@@ The following provide access to the base addresses for text
197
196
and data-relative addressing in the LDSA. In order to stay link
198
197
compatible with the standard ABI for IA-64, we inline these. */
199
198
200
- version (IA64 )
199
+ version (IA64 )
201
200
{
202
201
_Unwind_Ptr
203
- _Unwind_GetDataRelBase (_Unwind_Context * _C)
202
+ _Unwind_GetDataRelBase(_Unwind_Context * _C)
204
203
{
205
204
/* The GP is stored in R1. */
206
- return _Unwind_GetGR (_C, 1 );
205
+ return _Unwind_GetGR (_C, 1 );
207
206
}
208
207
209
208
_Unwind_Ptr
210
- _Unwind_GetTextRelBase (_Unwind_Context * )
209
+ _Unwind_GetTextRelBase(_Unwind_Context * )
211
210
{
212
- abort ();
211
+ __builtin_trap ();
213
212
return 0 ;
214
213
}
215
214
216
215
/* @@@ Retrieve the Backing Store Pointer of the given context. */
217
- _Unwind_Word _Unwind_GetBSP (_Unwind_Context * );
216
+ _Unwind_Word _Unwind_GetBSP (_Unwind_Context * );
218
217
}
219
218
else
220
219
{
221
- _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context * );
222
- _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context * );
220
+ _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context * );
221
+ _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context * );
223
222
}
224
223
225
224
/* @@@ Given an address, return the entry point of the function that
226
225
contains it. */
227
- extern void * _Unwind_FindEnclosingFunction (void * pc);
226
+ extern void * _Unwind_FindEnclosingFunction(void * pc);
228
227
229
228
230
229
/* leb128 type numbers have a potentially unlimited size.
@@ -247,6 +246,6 @@ else static if (long.sizeof >= (void*).sizeof)
247
246
}
248
247
else
249
248
{
250
- static assert (0 , " What type shall we use for _sleb128_t?" );
249
+ static assert (0 , " What type shall we use for _sleb128_t?" );
251
250
}
252
251
0 commit comments