annotate libgcc/unwind-dw2.c @ 155:da32f4b04d38

fix __code name conflict
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 17:51:46 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* DWARF2 exception handling and frame unwind runtime interface routines.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 1997-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it
kono
parents:
diff changeset
7 under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
8 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
9 any later version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT
kono
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
kono
parents:
diff changeset
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
kono
parents:
diff changeset
14 License for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
17 permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
18 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
21 a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
23 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 #include "tconfig.h"
kono
parents:
diff changeset
26 #include "tsystem.h"
kono
parents:
diff changeset
27 #include "coretypes.h"
kono
parents:
diff changeset
28 #include "tm.h"
kono
parents:
diff changeset
29 #include "libgcc_tm.h"
kono
parents:
diff changeset
30 #include "dwarf2.h"
kono
parents:
diff changeset
31 #include "unwind.h"
kono
parents:
diff changeset
32 #ifdef __USING_SJLJ_EXCEPTIONS__
kono
parents:
diff changeset
33 # define NO_SIZE_OF_ENCODED_VALUE
kono
parents:
diff changeset
34 #endif
kono
parents:
diff changeset
35 #include "unwind-pe.h"
kono
parents:
diff changeset
36 #include "unwind-dw2-fde.h"
kono
parents:
diff changeset
37 #include "gthr.h"
kono
parents:
diff changeset
38 #include "unwind-dw2.h"
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 #ifdef HAVE_SYS_SDT_H
kono
parents:
diff changeset
41 #include <sys/sdt.h>
kono
parents:
diff changeset
42 #endif
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 #ifndef __USING_SJLJ_EXCEPTIONS__
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 #ifndef __LIBGCC_STACK_GROWS_DOWNWARD__
kono
parents:
diff changeset
47 #define __LIBGCC_STACK_GROWS_DOWNWARD__ 0
kono
parents:
diff changeset
48 #else
kono
parents:
diff changeset
49 #undef __LIBGCC_STACK_GROWS_DOWNWARD__
kono
parents:
diff changeset
50 #define __LIBGCC_STACK_GROWS_DOWNWARD__ 1
kono
parents:
diff changeset
51 #endif
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 /* Dwarf frame registers used for pre gcc 3.0 compiled glibc. */
kono
parents:
diff changeset
54 #ifndef PRE_GCC3_DWARF_FRAME_REGISTERS
kono
parents:
diff changeset
55 #define PRE_GCC3_DWARF_FRAME_REGISTERS __LIBGCC_DWARF_FRAME_REGISTERS__
kono
parents:
diff changeset
56 #endif
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 /* ??? For the public function interfaces, we tend to gcc_assert that the
kono
parents:
diff changeset
59 column numbers are in range. For the dwarf2 unwind info this does happen,
kono
parents:
diff changeset
60 although so far in a case that doesn't actually matter.
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 See PR49146, in which a call from x86_64 ms abi to x86_64 unix abi stores
kono
parents:
diff changeset
63 the call-saved xmm registers and annotates them. We havn't bothered
kono
parents:
diff changeset
64 providing support for the xmm registers for the x86_64 port primarily
kono
parents:
diff changeset
65 because the 64-bit windows targets don't use dwarf2 unwind, using sjlj or
kono
parents:
diff changeset
66 SEH instead. Adding the support for unix targets would generally be a
kono
parents:
diff changeset
67 waste. However, some runtime libraries supplied with ICC do contain such
kono
parents:
diff changeset
68 an unorthodox transition, as well as the unwind info to match. This loss
kono
parents:
diff changeset
69 of register restoration doesn't matter in practice, because the exception
kono
parents:
diff changeset
70 is caught in the native unix abi, where all of the xmm registers are
kono
parents:
diff changeset
71 call clobbered.
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 Ideally, we'd record some bit to notice when we're failing to restore some
kono
parents:
diff changeset
74 register recorded in the unwind info, but to do that we need annotation on
kono
parents:
diff changeset
75 the unix->ms abi edge, so that we know when the register data may be
kono
parents:
diff changeset
76 discarded. And since this edge is also within the ICC library, we're
kono
parents:
diff changeset
77 unlikely to be able to get the new annotation.
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 Barring a magic solution to restore the ms abi defined 128-bit xmm registers
kono
parents:
diff changeset
80 (as distictly opposed to the full runtime width) without causing extra
kono
parents:
diff changeset
81 overhead for normal unix abis, the best solution seems to be to simply
kono
parents:
diff changeset
82 ignore unwind data for unknown columns. */
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 #define UNWIND_COLUMN_IN_RANGE(x) \
kono
parents:
diff changeset
85 __builtin_expect((x) <= __LIBGCC_DWARF_FRAME_REGISTERS__, 1)
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 #ifdef REG_VALUE_IN_UNWIND_CONTEXT
kono
parents:
diff changeset
88 typedef _Unwind_Word _Unwind_Context_Reg_Val;
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 #ifndef ASSUME_EXTENDED_UNWIND_CONTEXT
kono
parents:
diff changeset
91 #define ASSUME_EXTENDED_UNWIND_CONTEXT 1
kono
parents:
diff changeset
92 #endif
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 static inline _Unwind_Word
kono
parents:
diff changeset
95 _Unwind_Get_Unwind_Word (_Unwind_Context_Reg_Val val)
kono
parents:
diff changeset
96 {
kono
parents:
diff changeset
97 return val;
kono
parents:
diff changeset
98 }
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 static inline _Unwind_Context_Reg_Val
kono
parents:
diff changeset
101 _Unwind_Get_Unwind_Context_Reg_Val (_Unwind_Word val)
kono
parents:
diff changeset
102 {
kono
parents:
diff changeset
103 return val;
kono
parents:
diff changeset
104 }
kono
parents:
diff changeset
105 #else
kono
parents:
diff changeset
106 typedef void *_Unwind_Context_Reg_Val;
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 static inline _Unwind_Word
kono
parents:
diff changeset
109 _Unwind_Get_Unwind_Word (_Unwind_Context_Reg_Val val)
kono
parents:
diff changeset
110 {
kono
parents:
diff changeset
111 return (_Unwind_Word) (_Unwind_Internal_Ptr) val;
kono
parents:
diff changeset
112 }
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 static inline _Unwind_Context_Reg_Val
kono
parents:
diff changeset
115 _Unwind_Get_Unwind_Context_Reg_Val (_Unwind_Word val)
kono
parents:
diff changeset
116 {
kono
parents:
diff changeset
117 return (_Unwind_Context_Reg_Val) (_Unwind_Internal_Ptr) val;
kono
parents:
diff changeset
118 }
kono
parents:
diff changeset
119 #endif
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 #ifndef ASSUME_EXTENDED_UNWIND_CONTEXT
kono
parents:
diff changeset
122 #define ASSUME_EXTENDED_UNWIND_CONTEXT 0
kono
parents:
diff changeset
123 #endif
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 /* This is the register and unwind state for a particular frame. This
kono
parents:
diff changeset
126 provides the information necessary to unwind up past a frame and return
kono
parents:
diff changeset
127 to its caller. */
kono
parents:
diff changeset
128 struct _Unwind_Context
kono
parents:
diff changeset
129 {
kono
parents:
diff changeset
130 _Unwind_Context_Reg_Val reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
kono
parents:
diff changeset
131 void *cfa;
kono
parents:
diff changeset
132 void *ra;
kono
parents:
diff changeset
133 void *lsda;
kono
parents:
diff changeset
134 struct dwarf_eh_bases bases;
kono
parents:
diff changeset
135 /* Signal frame context. */
kono
parents:
diff changeset
136 #define SIGNAL_FRAME_BIT ((~(_Unwind_Word) 0 >> 1) + 1)
kono
parents:
diff changeset
137 /* Context which has version/args_size/by_value fields. */
kono
parents:
diff changeset
138 #define EXTENDED_CONTEXT_BIT ((~(_Unwind_Word) 0 >> 2) + 1)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
139 /* Bit reserved on AArch64, return address has been signed with A or B
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
140 key. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
141 #define RA_SIGNED_BIT ((~(_Unwind_Word) 0 >> 3) + 1)
111
kono
parents:
diff changeset
142 _Unwind_Word flags;
kono
parents:
diff changeset
143 /* 0 for now, can be increased when further fields are added to
kono
parents:
diff changeset
144 struct _Unwind_Context. */
kono
parents:
diff changeset
145 _Unwind_Word version;
kono
parents:
diff changeset
146 _Unwind_Word args_size;
kono
parents:
diff changeset
147 char by_value[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
kono
parents:
diff changeset
148 };
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 /* Byte size of every register managed by these routines. */
kono
parents:
diff changeset
151 static unsigned char dwarf_reg_size_table[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 /* Read unaligned data from the instruction buffer. */
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 union unaligned
kono
parents:
diff changeset
157 {
kono
parents:
diff changeset
158 void *p;
kono
parents:
diff changeset
159 unsigned u2 __attribute__ ((mode (HI)));
kono
parents:
diff changeset
160 unsigned u4 __attribute__ ((mode (SI)));
kono
parents:
diff changeset
161 unsigned u8 __attribute__ ((mode (DI)));
kono
parents:
diff changeset
162 signed s2 __attribute__ ((mode (HI)));
kono
parents:
diff changeset
163 signed s4 __attribute__ ((mode (SI)));
kono
parents:
diff changeset
164 signed s8 __attribute__ ((mode (DI)));
kono
parents:
diff changeset
165 } __attribute__ ((packed));
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 static void uw_update_context (struct _Unwind_Context *, _Unwind_FrameState *);
kono
parents:
diff changeset
168 static _Unwind_Reason_Code uw_frame_state_for (struct _Unwind_Context *,
kono
parents:
diff changeset
169 _Unwind_FrameState *);
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 static inline void *
kono
parents:
diff changeset
172 read_pointer (const void *p) { const union unaligned *up = p; return up->p; }
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 static inline int
kono
parents:
diff changeset
175 read_1u (const void *p) { return *(const unsigned char *) p; }
kono
parents:
diff changeset
176
kono
parents:
diff changeset
177 static inline int
kono
parents:
diff changeset
178 read_1s (const void *p) { return *(const signed char *) p; }
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 static inline int
kono
parents:
diff changeset
181 read_2u (const void *p) { const union unaligned *up = p; return up->u2; }
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 static inline int
kono
parents:
diff changeset
184 read_2s (const void *p) { const union unaligned *up = p; return up->s2; }
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 static inline unsigned int
kono
parents:
diff changeset
187 read_4u (const void *p) { const union unaligned *up = p; return up->u4; }
kono
parents:
diff changeset
188
kono
parents:
diff changeset
189 static inline int
kono
parents:
diff changeset
190 read_4s (const void *p) { const union unaligned *up = p; return up->s4; }
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 static inline unsigned long
kono
parents:
diff changeset
193 read_8u (const void *p) { const union unaligned *up = p; return up->u8; }
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 static inline unsigned long
kono
parents:
diff changeset
196 read_8s (const void *p) { const union unaligned *up = p; return up->s8; }
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 static inline _Unwind_Word
kono
parents:
diff changeset
199 _Unwind_IsSignalFrame (struct _Unwind_Context *context)
kono
parents:
diff changeset
200 {
kono
parents:
diff changeset
201 return (context->flags & SIGNAL_FRAME_BIT) ? 1 : 0;
kono
parents:
diff changeset
202 }
kono
parents:
diff changeset
203
kono
parents:
diff changeset
204 static inline void
kono
parents:
diff changeset
205 _Unwind_SetSignalFrame (struct _Unwind_Context *context, int val)
kono
parents:
diff changeset
206 {
kono
parents:
diff changeset
207 if (val)
kono
parents:
diff changeset
208 context->flags |= SIGNAL_FRAME_BIT;
kono
parents:
diff changeset
209 else
kono
parents:
diff changeset
210 context->flags &= ~SIGNAL_FRAME_BIT;
kono
parents:
diff changeset
211 }
kono
parents:
diff changeset
212
kono
parents:
diff changeset
213 static inline _Unwind_Word
kono
parents:
diff changeset
214 _Unwind_IsExtendedContext (struct _Unwind_Context *context)
kono
parents:
diff changeset
215 {
kono
parents:
diff changeset
216 return (ASSUME_EXTENDED_UNWIND_CONTEXT
kono
parents:
diff changeset
217 || (context->flags & EXTENDED_CONTEXT_BIT));
kono
parents:
diff changeset
218 }
kono
parents:
diff changeset
219
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
220 /* Get the value of register REGNO as saved in CONTEXT. */
111
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 inline _Unwind_Word
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
223 _Unwind_GetGR (struct _Unwind_Context *context, int regno)
111
kono
parents:
diff changeset
224 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
225 int size, index;
111
kono
parents:
diff changeset
226 _Unwind_Context_Reg_Val val;
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 #ifdef DWARF_ZERO_REG
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
229 if (regno == DWARF_ZERO_REG)
111
kono
parents:
diff changeset
230 return 0;
kono
parents:
diff changeset
231 #endif
kono
parents:
diff changeset
232
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
233 index = DWARF_REG_TO_UNWIND_COLUMN (regno);
111
kono
parents:
diff changeset
234 gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
kono
parents:
diff changeset
235 size = dwarf_reg_size_table[index];
kono
parents:
diff changeset
236 val = context->reg[index];
kono
parents:
diff changeset
237
kono
parents:
diff changeset
238 if (_Unwind_IsExtendedContext (context) && context->by_value[index])
kono
parents:
diff changeset
239 return _Unwind_Get_Unwind_Word (val);
kono
parents:
diff changeset
240
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
241 #ifdef DWARF_LAZY_REGISTER_VALUE
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
242 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
243 _Unwind_Word value;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
244 if (DWARF_LAZY_REGISTER_VALUE (regno, &value))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
245 return value;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
246 }
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
247 #endif
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
248
111
kono
parents:
diff changeset
249 /* This will segfault if the register hasn't been saved. */
kono
parents:
diff changeset
250 if (size == sizeof(_Unwind_Ptr))
kono
parents:
diff changeset
251 return * (_Unwind_Ptr *) (_Unwind_Internal_Ptr) val;
kono
parents:
diff changeset
252 else
kono
parents:
diff changeset
253 {
kono
parents:
diff changeset
254 gcc_assert (size == sizeof(_Unwind_Word));
kono
parents:
diff changeset
255 return * (_Unwind_Word *) (_Unwind_Internal_Ptr) val;
kono
parents:
diff changeset
256 }
kono
parents:
diff changeset
257 }
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 static inline void *
kono
parents:
diff changeset
260 _Unwind_GetPtr (struct _Unwind_Context *context, int index)
kono
parents:
diff changeset
261 {
kono
parents:
diff changeset
262 return (void *)(_Unwind_Ptr) _Unwind_GetGR (context, index);
kono
parents:
diff changeset
263 }
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 /* Get the value of the CFA as saved in CONTEXT. */
kono
parents:
diff changeset
266
kono
parents:
diff changeset
267 _Unwind_Word
kono
parents:
diff changeset
268 _Unwind_GetCFA (struct _Unwind_Context *context)
kono
parents:
diff changeset
269 {
kono
parents:
diff changeset
270 return (_Unwind_Ptr) context->cfa;
kono
parents:
diff changeset
271 }
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */
kono
parents:
diff changeset
274
kono
parents:
diff changeset
275 inline void
kono
parents:
diff changeset
276 _Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
kono
parents:
diff changeset
277 {
kono
parents:
diff changeset
278 int size;
kono
parents:
diff changeset
279 void *ptr;
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 index = DWARF_REG_TO_UNWIND_COLUMN (index);
kono
parents:
diff changeset
282 gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
kono
parents:
diff changeset
283 size = dwarf_reg_size_table[index];
kono
parents:
diff changeset
284
kono
parents:
diff changeset
285 if (_Unwind_IsExtendedContext (context) && context->by_value[index])
kono
parents:
diff changeset
286 {
kono
parents:
diff changeset
287 context->reg[index] = _Unwind_Get_Unwind_Context_Reg_Val (val);
kono
parents:
diff changeset
288 return;
kono
parents:
diff changeset
289 }
kono
parents:
diff changeset
290
kono
parents:
diff changeset
291 ptr = (void *) (_Unwind_Internal_Ptr) context->reg[index];
kono
parents:
diff changeset
292
kono
parents:
diff changeset
293 if (size == sizeof(_Unwind_Ptr))
kono
parents:
diff changeset
294 * (_Unwind_Ptr *) ptr = val;
kono
parents:
diff changeset
295 else
kono
parents:
diff changeset
296 {
kono
parents:
diff changeset
297 gcc_assert (size == sizeof(_Unwind_Word));
kono
parents:
diff changeset
298 * (_Unwind_Word *) ptr = val;
kono
parents:
diff changeset
299 }
kono
parents:
diff changeset
300 }
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302 /* Get the pointer to a register INDEX as saved in CONTEXT. */
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 static inline void *
kono
parents:
diff changeset
305 _Unwind_GetGRPtr (struct _Unwind_Context *context, int index)
kono
parents:
diff changeset
306 {
kono
parents:
diff changeset
307 index = DWARF_REG_TO_UNWIND_COLUMN (index);
kono
parents:
diff changeset
308 if (_Unwind_IsExtendedContext (context) && context->by_value[index])
kono
parents:
diff changeset
309 return &context->reg[index];
kono
parents:
diff changeset
310 return (void *) (_Unwind_Internal_Ptr) context->reg[index];
kono
parents:
diff changeset
311 }
kono
parents:
diff changeset
312
kono
parents:
diff changeset
313 /* Set the pointer to a register INDEX as saved in CONTEXT. */
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 static inline void
kono
parents:
diff changeset
316 _Unwind_SetGRPtr (struct _Unwind_Context *context, int index, void *p)
kono
parents:
diff changeset
317 {
kono
parents:
diff changeset
318 index = DWARF_REG_TO_UNWIND_COLUMN (index);
kono
parents:
diff changeset
319 if (_Unwind_IsExtendedContext (context))
kono
parents:
diff changeset
320 context->by_value[index] = 0;
kono
parents:
diff changeset
321 context->reg[index] = (_Unwind_Context_Reg_Val) (_Unwind_Internal_Ptr) p;
kono
parents:
diff changeset
322 }
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 /* Overwrite the saved value for register INDEX in CONTEXT with VAL. */
kono
parents:
diff changeset
325
kono
parents:
diff changeset
326 static inline void
kono
parents:
diff changeset
327 _Unwind_SetGRValue (struct _Unwind_Context *context, int index,
kono
parents:
diff changeset
328 _Unwind_Word val)
kono
parents:
diff changeset
329 {
kono
parents:
diff changeset
330 index = DWARF_REG_TO_UNWIND_COLUMN (index);
kono
parents:
diff changeset
331 gcc_assert (index < (int) sizeof(dwarf_reg_size_table));
kono
parents:
diff changeset
332 /* Return column size may be smaller than _Unwind_Context_Reg_Val. */
kono
parents:
diff changeset
333 gcc_assert (dwarf_reg_size_table[index] <= sizeof (_Unwind_Context_Reg_Val));
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 context->by_value[index] = 1;
kono
parents:
diff changeset
336 context->reg[index] = _Unwind_Get_Unwind_Context_Reg_Val (val);
kono
parents:
diff changeset
337 }
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 /* Return nonzero if register INDEX is stored by value rather than
kono
parents:
diff changeset
340 by reference. */
kono
parents:
diff changeset
341
kono
parents:
diff changeset
342 static inline int
kono
parents:
diff changeset
343 _Unwind_GRByValue (struct _Unwind_Context *context, int index)
kono
parents:
diff changeset
344 {
kono
parents:
diff changeset
345 index = DWARF_REG_TO_UNWIND_COLUMN (index);
kono
parents:
diff changeset
346 return context->by_value[index];
kono
parents:
diff changeset
347 }
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 /* Retrieve the return address for CONTEXT. */
kono
parents:
diff changeset
350
kono
parents:
diff changeset
351 inline _Unwind_Ptr
kono
parents:
diff changeset
352 _Unwind_GetIP (struct _Unwind_Context *context)
kono
parents:
diff changeset
353 {
kono
parents:
diff changeset
354 return (_Unwind_Ptr) context->ra;
kono
parents:
diff changeset
355 }
kono
parents:
diff changeset
356
kono
parents:
diff changeset
357 /* Retrieve the return address and flag whether that IP is before
kono
parents:
diff changeset
358 or after first not yet fully executed instruction. */
kono
parents:
diff changeset
359
kono
parents:
diff changeset
360 inline _Unwind_Ptr
kono
parents:
diff changeset
361 _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
kono
parents:
diff changeset
362 {
kono
parents:
diff changeset
363 *ip_before_insn = _Unwind_IsSignalFrame (context);
kono
parents:
diff changeset
364 return (_Unwind_Ptr) context->ra;
kono
parents:
diff changeset
365 }
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 /* Overwrite the return address for CONTEXT with VAL. */
kono
parents:
diff changeset
368
kono
parents:
diff changeset
369 inline void
kono
parents:
diff changeset
370 _Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
kono
parents:
diff changeset
371 {
kono
parents:
diff changeset
372 context->ra = (void *) val;
kono
parents:
diff changeset
373 }
kono
parents:
diff changeset
374
kono
parents:
diff changeset
375 void *
kono
parents:
diff changeset
376 _Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
kono
parents:
diff changeset
377 {
kono
parents:
diff changeset
378 return context->lsda;
kono
parents:
diff changeset
379 }
kono
parents:
diff changeset
380
kono
parents:
diff changeset
381 _Unwind_Ptr
kono
parents:
diff changeset
382 _Unwind_GetRegionStart (struct _Unwind_Context *context)
kono
parents:
diff changeset
383 {
kono
parents:
diff changeset
384 return (_Unwind_Ptr) context->bases.func;
kono
parents:
diff changeset
385 }
kono
parents:
diff changeset
386
kono
parents:
diff changeset
387 void *
kono
parents:
diff changeset
388 _Unwind_FindEnclosingFunction (void *pc)
kono
parents:
diff changeset
389 {
kono
parents:
diff changeset
390 struct dwarf_eh_bases bases;
kono
parents:
diff changeset
391 const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases);
kono
parents:
diff changeset
392 if (fde)
kono
parents:
diff changeset
393 return bases.func;
kono
parents:
diff changeset
394 else
kono
parents:
diff changeset
395 return NULL;
kono
parents:
diff changeset
396 }
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 #ifndef __ia64__
kono
parents:
diff changeset
399 _Unwind_Ptr
kono
parents:
diff changeset
400 _Unwind_GetDataRelBase (struct _Unwind_Context *context)
kono
parents:
diff changeset
401 {
kono
parents:
diff changeset
402 return (_Unwind_Ptr) context->bases.dbase;
kono
parents:
diff changeset
403 }
kono
parents:
diff changeset
404
kono
parents:
diff changeset
405 _Unwind_Ptr
kono
parents:
diff changeset
406 _Unwind_GetTextRelBase (struct _Unwind_Context *context)
kono
parents:
diff changeset
407 {
kono
parents:
diff changeset
408 return (_Unwind_Ptr) context->bases.tbase;
kono
parents:
diff changeset
409 }
kono
parents:
diff changeset
410 #endif
kono
parents:
diff changeset
411
kono
parents:
diff changeset
412 #include "md-unwind-support.h"
kono
parents:
diff changeset
413
kono
parents:
diff changeset
414 /* Extract any interesting information from the CIE for the translation
kono
parents:
diff changeset
415 unit F belongs to. Return a pointer to the byte after the augmentation,
kono
parents:
diff changeset
416 or NULL if we encountered an undecipherable augmentation. */
kono
parents:
diff changeset
417
kono
parents:
diff changeset
418 static const unsigned char *
kono
parents:
diff changeset
419 extract_cie_info (const struct dwarf_cie *cie, struct _Unwind_Context *context,
kono
parents:
diff changeset
420 _Unwind_FrameState *fs)
kono
parents:
diff changeset
421 {
kono
parents:
diff changeset
422 const unsigned char *aug = cie->augmentation;
kono
parents:
diff changeset
423 const unsigned char *p = aug + strlen ((const char *)aug) + 1;
kono
parents:
diff changeset
424 const unsigned char *ret = NULL;
kono
parents:
diff changeset
425 _uleb128_t utmp;
kono
parents:
diff changeset
426 _sleb128_t stmp;
kono
parents:
diff changeset
427
kono
parents:
diff changeset
428 /* g++ v2 "eh" has pointer immediately following augmentation string,
kono
parents:
diff changeset
429 so it must be handled first. */
kono
parents:
diff changeset
430 if (aug[0] == 'e' && aug[1] == 'h')
kono
parents:
diff changeset
431 {
kono
parents:
diff changeset
432 fs->eh_ptr = read_pointer (p);
kono
parents:
diff changeset
433 p += sizeof (void *);
kono
parents:
diff changeset
434 aug += 2;
kono
parents:
diff changeset
435 }
kono
parents:
diff changeset
436
kono
parents:
diff changeset
437 /* After the augmentation resp. pointer for "eh" augmentation
kono
parents:
diff changeset
438 follows for CIE version >= 4 address size byte and
kono
parents:
diff changeset
439 segment size byte. */
kono
parents:
diff changeset
440 if (__builtin_expect (cie->version >= 4, 0))
kono
parents:
diff changeset
441 {
kono
parents:
diff changeset
442 if (p[0] != sizeof (void *) || p[1] != 0)
kono
parents:
diff changeset
443 return NULL;
kono
parents:
diff changeset
444 p += 2;
kono
parents:
diff changeset
445 }
kono
parents:
diff changeset
446 /* Immediately following this are the code and
kono
parents:
diff changeset
447 data alignment and return address column. */
kono
parents:
diff changeset
448 p = read_uleb128 (p, &utmp);
kono
parents:
diff changeset
449 fs->code_align = (_Unwind_Word)utmp;
kono
parents:
diff changeset
450 p = read_sleb128 (p, &stmp);
kono
parents:
diff changeset
451 fs->data_align = (_Unwind_Sword)stmp;
kono
parents:
diff changeset
452 if (cie->version == 1)
kono
parents:
diff changeset
453 fs->retaddr_column = *p++;
kono
parents:
diff changeset
454 else
kono
parents:
diff changeset
455 {
kono
parents:
diff changeset
456 p = read_uleb128 (p, &utmp);
kono
parents:
diff changeset
457 fs->retaddr_column = (_Unwind_Word)utmp;
kono
parents:
diff changeset
458 }
kono
parents:
diff changeset
459 fs->lsda_encoding = DW_EH_PE_omit;
kono
parents:
diff changeset
460
kono
parents:
diff changeset
461 /* If the augmentation starts with 'z', then a uleb128 immediately
kono
parents:
diff changeset
462 follows containing the length of the augmentation field following
kono
parents:
diff changeset
463 the size. */
kono
parents:
diff changeset
464 if (*aug == 'z')
kono
parents:
diff changeset
465 {
kono
parents:
diff changeset
466 p = read_uleb128 (p, &utmp);
kono
parents:
diff changeset
467 ret = p + utmp;
kono
parents:
diff changeset
468
kono
parents:
diff changeset
469 fs->saw_z = 1;
kono
parents:
diff changeset
470 ++aug;
kono
parents:
diff changeset
471 }
kono
parents:
diff changeset
472
kono
parents:
diff changeset
473 /* Iterate over recognized augmentation subsequences. */
kono
parents:
diff changeset
474 while (*aug != '\0')
kono
parents:
diff changeset
475 {
kono
parents:
diff changeset
476 /* "L" indicates a byte showing how the LSDA pointer is encoded. */
kono
parents:
diff changeset
477 if (aug[0] == 'L')
kono
parents:
diff changeset
478 {
kono
parents:
diff changeset
479 fs->lsda_encoding = *p++;
kono
parents:
diff changeset
480 aug += 1;
kono
parents:
diff changeset
481 }
kono
parents:
diff changeset
482
kono
parents:
diff changeset
483 /* "R" indicates a byte indicating how FDE addresses are encoded. */
kono
parents:
diff changeset
484 else if (aug[0] == 'R')
kono
parents:
diff changeset
485 {
kono
parents:
diff changeset
486 fs->fde_encoding = *p++;
kono
parents:
diff changeset
487 aug += 1;
kono
parents:
diff changeset
488 }
kono
parents:
diff changeset
489
kono
parents:
diff changeset
490 /* "P" indicates a personality routine in the CIE augmentation. */
kono
parents:
diff changeset
491 else if (aug[0] == 'P')
kono
parents:
diff changeset
492 {
kono
parents:
diff changeset
493 _Unwind_Ptr personality;
kono
parents:
diff changeset
494
kono
parents:
diff changeset
495 p = read_encoded_value (context, *p, p + 1, &personality);
kono
parents:
diff changeset
496 fs->personality = (_Unwind_Personality_Fn) personality;
kono
parents:
diff changeset
497 aug += 1;
kono
parents:
diff changeset
498 }
kono
parents:
diff changeset
499
kono
parents:
diff changeset
500 /* "S" indicates a signal frame. */
kono
parents:
diff changeset
501 else if (aug[0] == 'S')
kono
parents:
diff changeset
502 {
kono
parents:
diff changeset
503 fs->signal_frame = 1;
kono
parents:
diff changeset
504 aug += 1;
kono
parents:
diff changeset
505 }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
506 /* aarch64 B-key pointer authentication. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
507 else if (aug[0] == 'B')
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
508 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
509 aug += 1;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
510 }
111
kono
parents:
diff changeset
511
kono
parents:
diff changeset
512 /* Otherwise we have an unknown augmentation string.
kono
parents:
diff changeset
513 Bail unless we saw a 'z' prefix. */
kono
parents:
diff changeset
514 else
kono
parents:
diff changeset
515 return ret;
kono
parents:
diff changeset
516 }
kono
parents:
diff changeset
517
kono
parents:
diff changeset
518 return ret ? ret : p;
kono
parents:
diff changeset
519 }
kono
parents:
diff changeset
520
kono
parents:
diff changeset
521
kono
parents:
diff changeset
522 /* Decode a DW_OP stack program. Return the top of stack. Push INITIAL
kono
parents:
diff changeset
523 onto the stack to start. */
kono
parents:
diff changeset
524
kono
parents:
diff changeset
525 static _Unwind_Word
kono
parents:
diff changeset
526 execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
kono
parents:
diff changeset
527 struct _Unwind_Context *context, _Unwind_Word initial)
kono
parents:
diff changeset
528 {
kono
parents:
diff changeset
529 _Unwind_Word stack[64]; /* ??? Assume this is enough. */
kono
parents:
diff changeset
530 int stack_elt;
kono
parents:
diff changeset
531
kono
parents:
diff changeset
532 stack[0] = initial;
kono
parents:
diff changeset
533 stack_elt = 1;
kono
parents:
diff changeset
534
kono
parents:
diff changeset
535 while (op_ptr < op_end)
kono
parents:
diff changeset
536 {
kono
parents:
diff changeset
537 enum dwarf_location_atom op = *op_ptr++;
kono
parents:
diff changeset
538 _Unwind_Word result;
kono
parents:
diff changeset
539 _uleb128_t reg, utmp;
kono
parents:
diff changeset
540 _sleb128_t offset, stmp;
kono
parents:
diff changeset
541
kono
parents:
diff changeset
542 switch (op)
kono
parents:
diff changeset
543 {
kono
parents:
diff changeset
544 case DW_OP_lit0:
kono
parents:
diff changeset
545 case DW_OP_lit1:
kono
parents:
diff changeset
546 case DW_OP_lit2:
kono
parents:
diff changeset
547 case DW_OP_lit3:
kono
parents:
diff changeset
548 case DW_OP_lit4:
kono
parents:
diff changeset
549 case DW_OP_lit5:
kono
parents:
diff changeset
550 case DW_OP_lit6:
kono
parents:
diff changeset
551 case DW_OP_lit7:
kono
parents:
diff changeset
552 case DW_OP_lit8:
kono
parents:
diff changeset
553 case DW_OP_lit9:
kono
parents:
diff changeset
554 case DW_OP_lit10:
kono
parents:
diff changeset
555 case DW_OP_lit11:
kono
parents:
diff changeset
556 case DW_OP_lit12:
kono
parents:
diff changeset
557 case DW_OP_lit13:
kono
parents:
diff changeset
558 case DW_OP_lit14:
kono
parents:
diff changeset
559 case DW_OP_lit15:
kono
parents:
diff changeset
560 case DW_OP_lit16:
kono
parents:
diff changeset
561 case DW_OP_lit17:
kono
parents:
diff changeset
562 case DW_OP_lit18:
kono
parents:
diff changeset
563 case DW_OP_lit19:
kono
parents:
diff changeset
564 case DW_OP_lit20:
kono
parents:
diff changeset
565 case DW_OP_lit21:
kono
parents:
diff changeset
566 case DW_OP_lit22:
kono
parents:
diff changeset
567 case DW_OP_lit23:
kono
parents:
diff changeset
568 case DW_OP_lit24:
kono
parents:
diff changeset
569 case DW_OP_lit25:
kono
parents:
diff changeset
570 case DW_OP_lit26:
kono
parents:
diff changeset
571 case DW_OP_lit27:
kono
parents:
diff changeset
572 case DW_OP_lit28:
kono
parents:
diff changeset
573 case DW_OP_lit29:
kono
parents:
diff changeset
574 case DW_OP_lit30:
kono
parents:
diff changeset
575 case DW_OP_lit31:
kono
parents:
diff changeset
576 result = op - DW_OP_lit0;
kono
parents:
diff changeset
577 break;
kono
parents:
diff changeset
578
kono
parents:
diff changeset
579 case DW_OP_addr:
kono
parents:
diff changeset
580 result = (_Unwind_Word) (_Unwind_Ptr) read_pointer (op_ptr);
kono
parents:
diff changeset
581 op_ptr += sizeof (void *);
kono
parents:
diff changeset
582 break;
kono
parents:
diff changeset
583
kono
parents:
diff changeset
584 case DW_OP_GNU_encoded_addr:
kono
parents:
diff changeset
585 {
kono
parents:
diff changeset
586 _Unwind_Ptr presult;
kono
parents:
diff changeset
587 op_ptr = read_encoded_value (context, *op_ptr, op_ptr+1, &presult);
kono
parents:
diff changeset
588 result = presult;
kono
parents:
diff changeset
589 }
kono
parents:
diff changeset
590 break;
kono
parents:
diff changeset
591
kono
parents:
diff changeset
592 case DW_OP_const1u:
kono
parents:
diff changeset
593 result = read_1u (op_ptr);
kono
parents:
diff changeset
594 op_ptr += 1;
kono
parents:
diff changeset
595 break;
kono
parents:
diff changeset
596 case DW_OP_const1s:
kono
parents:
diff changeset
597 result = read_1s (op_ptr);
kono
parents:
diff changeset
598 op_ptr += 1;
kono
parents:
diff changeset
599 break;
kono
parents:
diff changeset
600 case DW_OP_const2u:
kono
parents:
diff changeset
601 result = read_2u (op_ptr);
kono
parents:
diff changeset
602 op_ptr += 2;
kono
parents:
diff changeset
603 break;
kono
parents:
diff changeset
604 case DW_OP_const2s:
kono
parents:
diff changeset
605 result = read_2s (op_ptr);
kono
parents:
diff changeset
606 op_ptr += 2;
kono
parents:
diff changeset
607 break;
kono
parents:
diff changeset
608 case DW_OP_const4u:
kono
parents:
diff changeset
609 result = read_4u (op_ptr);
kono
parents:
diff changeset
610 op_ptr += 4;
kono
parents:
diff changeset
611 break;
kono
parents:
diff changeset
612 case DW_OP_const4s:
kono
parents:
diff changeset
613 result = read_4s (op_ptr);
kono
parents:
diff changeset
614 op_ptr += 4;
kono
parents:
diff changeset
615 break;
kono
parents:
diff changeset
616 case DW_OP_const8u:
kono
parents:
diff changeset
617 result = read_8u (op_ptr);
kono
parents:
diff changeset
618 op_ptr += 8;
kono
parents:
diff changeset
619 break;
kono
parents:
diff changeset
620 case DW_OP_const8s:
kono
parents:
diff changeset
621 result = read_8s (op_ptr);
kono
parents:
diff changeset
622 op_ptr += 8;
kono
parents:
diff changeset
623 break;
kono
parents:
diff changeset
624 case DW_OP_constu:
kono
parents:
diff changeset
625 op_ptr = read_uleb128 (op_ptr, &utmp);
kono
parents:
diff changeset
626 result = (_Unwind_Word)utmp;
kono
parents:
diff changeset
627 break;
kono
parents:
diff changeset
628 case DW_OP_consts:
kono
parents:
diff changeset
629 op_ptr = read_sleb128 (op_ptr, &stmp);
kono
parents:
diff changeset
630 result = (_Unwind_Sword)stmp;
kono
parents:
diff changeset
631 break;
kono
parents:
diff changeset
632
kono
parents:
diff changeset
633 case DW_OP_reg0:
kono
parents:
diff changeset
634 case DW_OP_reg1:
kono
parents:
diff changeset
635 case DW_OP_reg2:
kono
parents:
diff changeset
636 case DW_OP_reg3:
kono
parents:
diff changeset
637 case DW_OP_reg4:
kono
parents:
diff changeset
638 case DW_OP_reg5:
kono
parents:
diff changeset
639 case DW_OP_reg6:
kono
parents:
diff changeset
640 case DW_OP_reg7:
kono
parents:
diff changeset
641 case DW_OP_reg8:
kono
parents:
diff changeset
642 case DW_OP_reg9:
kono
parents:
diff changeset
643 case DW_OP_reg10:
kono
parents:
diff changeset
644 case DW_OP_reg11:
kono
parents:
diff changeset
645 case DW_OP_reg12:
kono
parents:
diff changeset
646 case DW_OP_reg13:
kono
parents:
diff changeset
647 case DW_OP_reg14:
kono
parents:
diff changeset
648 case DW_OP_reg15:
kono
parents:
diff changeset
649 case DW_OP_reg16:
kono
parents:
diff changeset
650 case DW_OP_reg17:
kono
parents:
diff changeset
651 case DW_OP_reg18:
kono
parents:
diff changeset
652 case DW_OP_reg19:
kono
parents:
diff changeset
653 case DW_OP_reg20:
kono
parents:
diff changeset
654 case DW_OP_reg21:
kono
parents:
diff changeset
655 case DW_OP_reg22:
kono
parents:
diff changeset
656 case DW_OP_reg23:
kono
parents:
diff changeset
657 case DW_OP_reg24:
kono
parents:
diff changeset
658 case DW_OP_reg25:
kono
parents:
diff changeset
659 case DW_OP_reg26:
kono
parents:
diff changeset
660 case DW_OP_reg27:
kono
parents:
diff changeset
661 case DW_OP_reg28:
kono
parents:
diff changeset
662 case DW_OP_reg29:
kono
parents:
diff changeset
663 case DW_OP_reg30:
kono
parents:
diff changeset
664 case DW_OP_reg31:
kono
parents:
diff changeset
665 result = _Unwind_GetGR (context, op - DW_OP_reg0);
kono
parents:
diff changeset
666 break;
kono
parents:
diff changeset
667 case DW_OP_regx:
kono
parents:
diff changeset
668 op_ptr = read_uleb128 (op_ptr, &reg);
kono
parents:
diff changeset
669 result = _Unwind_GetGR (context, reg);
kono
parents:
diff changeset
670 break;
kono
parents:
diff changeset
671
kono
parents:
diff changeset
672 case DW_OP_breg0:
kono
parents:
diff changeset
673 case DW_OP_breg1:
kono
parents:
diff changeset
674 case DW_OP_breg2:
kono
parents:
diff changeset
675 case DW_OP_breg3:
kono
parents:
diff changeset
676 case DW_OP_breg4:
kono
parents:
diff changeset
677 case DW_OP_breg5:
kono
parents:
diff changeset
678 case DW_OP_breg6:
kono
parents:
diff changeset
679 case DW_OP_breg7:
kono
parents:
diff changeset
680 case DW_OP_breg8:
kono
parents:
diff changeset
681 case DW_OP_breg9:
kono
parents:
diff changeset
682 case DW_OP_breg10:
kono
parents:
diff changeset
683 case DW_OP_breg11:
kono
parents:
diff changeset
684 case DW_OP_breg12:
kono
parents:
diff changeset
685 case DW_OP_breg13:
kono
parents:
diff changeset
686 case DW_OP_breg14:
kono
parents:
diff changeset
687 case DW_OP_breg15:
kono
parents:
diff changeset
688 case DW_OP_breg16:
kono
parents:
diff changeset
689 case DW_OP_breg17:
kono
parents:
diff changeset
690 case DW_OP_breg18:
kono
parents:
diff changeset
691 case DW_OP_breg19:
kono
parents:
diff changeset
692 case DW_OP_breg20:
kono
parents:
diff changeset
693 case DW_OP_breg21:
kono
parents:
diff changeset
694 case DW_OP_breg22:
kono
parents:
diff changeset
695 case DW_OP_breg23:
kono
parents:
diff changeset
696 case DW_OP_breg24:
kono
parents:
diff changeset
697 case DW_OP_breg25:
kono
parents:
diff changeset
698 case DW_OP_breg26:
kono
parents:
diff changeset
699 case DW_OP_breg27:
kono
parents:
diff changeset
700 case DW_OP_breg28:
kono
parents:
diff changeset
701 case DW_OP_breg29:
kono
parents:
diff changeset
702 case DW_OP_breg30:
kono
parents:
diff changeset
703 case DW_OP_breg31:
kono
parents:
diff changeset
704 op_ptr = read_sleb128 (op_ptr, &offset);
kono
parents:
diff changeset
705 result = _Unwind_GetGR (context, op - DW_OP_breg0) + offset;
kono
parents:
diff changeset
706 break;
kono
parents:
diff changeset
707 case DW_OP_bregx:
kono
parents:
diff changeset
708 op_ptr = read_uleb128 (op_ptr, &reg);
kono
parents:
diff changeset
709 op_ptr = read_sleb128 (op_ptr, &offset);
kono
parents:
diff changeset
710 result = _Unwind_GetGR (context, reg) + (_Unwind_Word)offset;
kono
parents:
diff changeset
711 break;
kono
parents:
diff changeset
712
kono
parents:
diff changeset
713 case DW_OP_dup:
kono
parents:
diff changeset
714 gcc_assert (stack_elt);
kono
parents:
diff changeset
715 result = stack[stack_elt - 1];
kono
parents:
diff changeset
716 break;
kono
parents:
diff changeset
717
kono
parents:
diff changeset
718 case DW_OP_drop:
kono
parents:
diff changeset
719 gcc_assert (stack_elt);
kono
parents:
diff changeset
720 stack_elt -= 1;
kono
parents:
diff changeset
721 goto no_push;
kono
parents:
diff changeset
722
kono
parents:
diff changeset
723 case DW_OP_pick:
kono
parents:
diff changeset
724 offset = *op_ptr++;
kono
parents:
diff changeset
725 gcc_assert (offset < stack_elt - 1);
kono
parents:
diff changeset
726 result = stack[stack_elt - 1 - offset];
kono
parents:
diff changeset
727 break;
kono
parents:
diff changeset
728
kono
parents:
diff changeset
729 case DW_OP_over:
kono
parents:
diff changeset
730 gcc_assert (stack_elt >= 2);
kono
parents:
diff changeset
731 result = stack[stack_elt - 2];
kono
parents:
diff changeset
732 break;
kono
parents:
diff changeset
733
kono
parents:
diff changeset
734 case DW_OP_swap:
kono
parents:
diff changeset
735 {
kono
parents:
diff changeset
736 _Unwind_Word t;
kono
parents:
diff changeset
737 gcc_assert (stack_elt >= 2);
kono
parents:
diff changeset
738 t = stack[stack_elt - 1];
kono
parents:
diff changeset
739 stack[stack_elt - 1] = stack[stack_elt - 2];
kono
parents:
diff changeset
740 stack[stack_elt - 2] = t;
kono
parents:
diff changeset
741 goto no_push;
kono
parents:
diff changeset
742 }
kono
parents:
diff changeset
743
kono
parents:
diff changeset
744 case DW_OP_rot:
kono
parents:
diff changeset
745 {
kono
parents:
diff changeset
746 _Unwind_Word t1, t2, t3;
kono
parents:
diff changeset
747
kono
parents:
diff changeset
748 gcc_assert (stack_elt >= 3);
kono
parents:
diff changeset
749 t1 = stack[stack_elt - 1];
kono
parents:
diff changeset
750 t2 = stack[stack_elt - 2];
kono
parents:
diff changeset
751 t3 = stack[stack_elt - 3];
kono
parents:
diff changeset
752 stack[stack_elt - 1] = t2;
kono
parents:
diff changeset
753 stack[stack_elt - 2] = t3;
kono
parents:
diff changeset
754 stack[stack_elt - 3] = t1;
kono
parents:
diff changeset
755 goto no_push;
kono
parents:
diff changeset
756 }
kono
parents:
diff changeset
757
kono
parents:
diff changeset
758 case DW_OP_deref:
kono
parents:
diff changeset
759 case DW_OP_deref_size:
kono
parents:
diff changeset
760 case DW_OP_abs:
kono
parents:
diff changeset
761 case DW_OP_neg:
kono
parents:
diff changeset
762 case DW_OP_not:
kono
parents:
diff changeset
763 case DW_OP_plus_uconst:
kono
parents:
diff changeset
764 /* Unary operations. */
kono
parents:
diff changeset
765 gcc_assert (stack_elt);
kono
parents:
diff changeset
766 stack_elt -= 1;
kono
parents:
diff changeset
767
kono
parents:
diff changeset
768 result = stack[stack_elt];
kono
parents:
diff changeset
769
kono
parents:
diff changeset
770 switch (op)
kono
parents:
diff changeset
771 {
kono
parents:
diff changeset
772 case DW_OP_deref:
kono
parents:
diff changeset
773 {
kono
parents:
diff changeset
774 void *ptr = (void *) (_Unwind_Ptr) result;
kono
parents:
diff changeset
775 result = (_Unwind_Ptr) read_pointer (ptr);
kono
parents:
diff changeset
776 }
kono
parents:
diff changeset
777 break;
kono
parents:
diff changeset
778
kono
parents:
diff changeset
779 case DW_OP_deref_size:
kono
parents:
diff changeset
780 {
kono
parents:
diff changeset
781 void *ptr = (void *) (_Unwind_Ptr) result;
kono
parents:
diff changeset
782 switch (*op_ptr++)
kono
parents:
diff changeset
783 {
kono
parents:
diff changeset
784 case 1:
kono
parents:
diff changeset
785 result = read_1u (ptr);
kono
parents:
diff changeset
786 break;
kono
parents:
diff changeset
787 case 2:
kono
parents:
diff changeset
788 result = read_2u (ptr);
kono
parents:
diff changeset
789 break;
kono
parents:
diff changeset
790 case 4:
kono
parents:
diff changeset
791 result = read_4u (ptr);
kono
parents:
diff changeset
792 break;
kono
parents:
diff changeset
793 case 8:
kono
parents:
diff changeset
794 result = read_8u (ptr);
kono
parents:
diff changeset
795 break;
kono
parents:
diff changeset
796 default:
kono
parents:
diff changeset
797 gcc_unreachable ();
kono
parents:
diff changeset
798 }
kono
parents:
diff changeset
799 }
kono
parents:
diff changeset
800 break;
kono
parents:
diff changeset
801
kono
parents:
diff changeset
802 case DW_OP_abs:
kono
parents:
diff changeset
803 if ((_Unwind_Sword) result < 0)
kono
parents:
diff changeset
804 result = -result;
kono
parents:
diff changeset
805 break;
kono
parents:
diff changeset
806 case DW_OP_neg:
kono
parents:
diff changeset
807 result = -result;
kono
parents:
diff changeset
808 break;
kono
parents:
diff changeset
809 case DW_OP_not:
kono
parents:
diff changeset
810 result = ~result;
kono
parents:
diff changeset
811 break;
kono
parents:
diff changeset
812 case DW_OP_plus_uconst:
kono
parents:
diff changeset
813 op_ptr = read_uleb128 (op_ptr, &utmp);
kono
parents:
diff changeset
814 result += (_Unwind_Word)utmp;
kono
parents:
diff changeset
815 break;
kono
parents:
diff changeset
816
kono
parents:
diff changeset
817 default:
kono
parents:
diff changeset
818 gcc_unreachable ();
kono
parents:
diff changeset
819 }
kono
parents:
diff changeset
820 break;
kono
parents:
diff changeset
821
kono
parents:
diff changeset
822 case DW_OP_and:
kono
parents:
diff changeset
823 case DW_OP_div:
kono
parents:
diff changeset
824 case DW_OP_minus:
kono
parents:
diff changeset
825 case DW_OP_mod:
kono
parents:
diff changeset
826 case DW_OP_mul:
kono
parents:
diff changeset
827 case DW_OP_or:
kono
parents:
diff changeset
828 case DW_OP_plus:
kono
parents:
diff changeset
829 case DW_OP_shl:
kono
parents:
diff changeset
830 case DW_OP_shr:
kono
parents:
diff changeset
831 case DW_OP_shra:
kono
parents:
diff changeset
832 case DW_OP_xor:
kono
parents:
diff changeset
833 case DW_OP_le:
kono
parents:
diff changeset
834 case DW_OP_ge:
kono
parents:
diff changeset
835 case DW_OP_eq:
kono
parents:
diff changeset
836 case DW_OP_lt:
kono
parents:
diff changeset
837 case DW_OP_gt:
kono
parents:
diff changeset
838 case DW_OP_ne:
kono
parents:
diff changeset
839 {
kono
parents:
diff changeset
840 /* Binary operations. */
kono
parents:
diff changeset
841 _Unwind_Word first, second;
kono
parents:
diff changeset
842 gcc_assert (stack_elt >= 2);
kono
parents:
diff changeset
843 stack_elt -= 2;
kono
parents:
diff changeset
844
kono
parents:
diff changeset
845 second = stack[stack_elt];
kono
parents:
diff changeset
846 first = stack[stack_elt + 1];
kono
parents:
diff changeset
847
kono
parents:
diff changeset
848 switch (op)
kono
parents:
diff changeset
849 {
kono
parents:
diff changeset
850 case DW_OP_and:
kono
parents:
diff changeset
851 result = second & first;
kono
parents:
diff changeset
852 break;
kono
parents:
diff changeset
853 case DW_OP_div:
kono
parents:
diff changeset
854 result = (_Unwind_Sword) second / (_Unwind_Sword) first;
kono
parents:
diff changeset
855 break;
kono
parents:
diff changeset
856 case DW_OP_minus:
kono
parents:
diff changeset
857 result = second - first;
kono
parents:
diff changeset
858 break;
kono
parents:
diff changeset
859 case DW_OP_mod:
kono
parents:
diff changeset
860 result = second % first;
kono
parents:
diff changeset
861 break;
kono
parents:
diff changeset
862 case DW_OP_mul:
kono
parents:
diff changeset
863 result = second * first;
kono
parents:
diff changeset
864 break;
kono
parents:
diff changeset
865 case DW_OP_or:
kono
parents:
diff changeset
866 result = second | first;
kono
parents:
diff changeset
867 break;
kono
parents:
diff changeset
868 case DW_OP_plus:
kono
parents:
diff changeset
869 result = second + first;
kono
parents:
diff changeset
870 break;
kono
parents:
diff changeset
871 case DW_OP_shl:
kono
parents:
diff changeset
872 result = second << first;
kono
parents:
diff changeset
873 break;
kono
parents:
diff changeset
874 case DW_OP_shr:
kono
parents:
diff changeset
875 result = second >> first;
kono
parents:
diff changeset
876 break;
kono
parents:
diff changeset
877 case DW_OP_shra:
kono
parents:
diff changeset
878 result = (_Unwind_Sword) second >> first;
kono
parents:
diff changeset
879 break;
kono
parents:
diff changeset
880 case DW_OP_xor:
kono
parents:
diff changeset
881 result = second ^ first;
kono
parents:
diff changeset
882 break;
kono
parents:
diff changeset
883 case DW_OP_le:
kono
parents:
diff changeset
884 result = (_Unwind_Sword) second <= (_Unwind_Sword) first;
kono
parents:
diff changeset
885 break;
kono
parents:
diff changeset
886 case DW_OP_ge:
kono
parents:
diff changeset
887 result = (_Unwind_Sword) second >= (_Unwind_Sword) first;
kono
parents:
diff changeset
888 break;
kono
parents:
diff changeset
889 case DW_OP_eq:
kono
parents:
diff changeset
890 result = (_Unwind_Sword) second == (_Unwind_Sword) first;
kono
parents:
diff changeset
891 break;
kono
parents:
diff changeset
892 case DW_OP_lt:
kono
parents:
diff changeset
893 result = (_Unwind_Sword) second < (_Unwind_Sword) first;
kono
parents:
diff changeset
894 break;
kono
parents:
diff changeset
895 case DW_OP_gt:
kono
parents:
diff changeset
896 result = (_Unwind_Sword) second > (_Unwind_Sword) first;
kono
parents:
diff changeset
897 break;
kono
parents:
diff changeset
898 case DW_OP_ne:
kono
parents:
diff changeset
899 result = (_Unwind_Sword) second != (_Unwind_Sword) first;
kono
parents:
diff changeset
900 break;
kono
parents:
diff changeset
901
kono
parents:
diff changeset
902 default:
kono
parents:
diff changeset
903 gcc_unreachable ();
kono
parents:
diff changeset
904 }
kono
parents:
diff changeset
905 }
kono
parents:
diff changeset
906 break;
kono
parents:
diff changeset
907
kono
parents:
diff changeset
908 case DW_OP_skip:
kono
parents:
diff changeset
909 offset = read_2s (op_ptr);
kono
parents:
diff changeset
910 op_ptr += 2;
kono
parents:
diff changeset
911 op_ptr += offset;
kono
parents:
diff changeset
912 goto no_push;
kono
parents:
diff changeset
913
kono
parents:
diff changeset
914 case DW_OP_bra:
kono
parents:
diff changeset
915 gcc_assert (stack_elt);
kono
parents:
diff changeset
916 stack_elt -= 1;
kono
parents:
diff changeset
917
kono
parents:
diff changeset
918 offset = read_2s (op_ptr);
kono
parents:
diff changeset
919 op_ptr += 2;
kono
parents:
diff changeset
920 if (stack[stack_elt] != 0)
kono
parents:
diff changeset
921 op_ptr += offset;
kono
parents:
diff changeset
922 goto no_push;
kono
parents:
diff changeset
923
kono
parents:
diff changeset
924 case DW_OP_nop:
kono
parents:
diff changeset
925 goto no_push;
kono
parents:
diff changeset
926
kono
parents:
diff changeset
927 default:
kono
parents:
diff changeset
928 gcc_unreachable ();
kono
parents:
diff changeset
929 }
kono
parents:
diff changeset
930
kono
parents:
diff changeset
931 /* Most things push a result value. */
kono
parents:
diff changeset
932 gcc_assert ((size_t) stack_elt < sizeof(stack)/sizeof(*stack));
kono
parents:
diff changeset
933 stack[stack_elt++] = result;
kono
parents:
diff changeset
934 no_push:;
kono
parents:
diff changeset
935 }
kono
parents:
diff changeset
936
kono
parents:
diff changeset
937 /* We were executing this program to get a value. It should be
kono
parents:
diff changeset
938 at top of stack. */
kono
parents:
diff changeset
939 gcc_assert (stack_elt);
kono
parents:
diff changeset
940 stack_elt -= 1;
kono
parents:
diff changeset
941 return stack[stack_elt];
kono
parents:
diff changeset
942 }
kono
parents:
diff changeset
943
kono
parents:
diff changeset
944
kono
parents:
diff changeset
945 /* Decode DWARF 2 call frame information. Takes pointers the
kono
parents:
diff changeset
946 instruction sequence to decode, current register information and
kono
parents:
diff changeset
947 CIE info, and the PC range to evaluate. */
kono
parents:
diff changeset
948
kono
parents:
diff changeset
949 static void
kono
parents:
diff changeset
950 execute_cfa_program (const unsigned char *insn_ptr,
kono
parents:
diff changeset
951 const unsigned char *insn_end,
kono
parents:
diff changeset
952 struct _Unwind_Context *context,
kono
parents:
diff changeset
953 _Unwind_FrameState *fs)
kono
parents:
diff changeset
954 {
kono
parents:
diff changeset
955 struct frame_state_reg_info *unused_rs = NULL;
kono
parents:
diff changeset
956
kono
parents:
diff changeset
957 /* Don't allow remember/restore between CIE and FDE programs. */
kono
parents:
diff changeset
958 fs->regs.prev = NULL;
kono
parents:
diff changeset
959
kono
parents:
diff changeset
960 /* The comparison with the return address uses < rather than <= because
kono
parents:
diff changeset
961 we are only interested in the effects of code before the call; for a
kono
parents:
diff changeset
962 noreturn function, the return address may point to unrelated code with
kono
parents:
diff changeset
963 a different stack configuration that we are not interested in. We
kono
parents:
diff changeset
964 assume that the call itself is unwind info-neutral; if not, or if
kono
parents:
diff changeset
965 there are delay instructions that adjust the stack, these must be
kono
parents:
diff changeset
966 reflected at the point immediately before the call insn.
kono
parents:
diff changeset
967 In signal frames, return address is after last completed instruction,
kono
parents:
diff changeset
968 so we add 1 to return address to make the comparison <=. */
kono
parents:
diff changeset
969 while (insn_ptr < insn_end
kono
parents:
diff changeset
970 && fs->pc < context->ra + _Unwind_IsSignalFrame (context))
kono
parents:
diff changeset
971 {
kono
parents:
diff changeset
972 unsigned char insn = *insn_ptr++;
kono
parents:
diff changeset
973 _uleb128_t reg, utmp;
kono
parents:
diff changeset
974 _sleb128_t offset, stmp;
kono
parents:
diff changeset
975
kono
parents:
diff changeset
976 if ((insn & 0xc0) == DW_CFA_advance_loc)
kono
parents:
diff changeset
977 fs->pc += (insn & 0x3f) * fs->code_align;
kono
parents:
diff changeset
978 else if ((insn & 0xc0) == DW_CFA_offset)
kono
parents:
diff changeset
979 {
kono
parents:
diff changeset
980 reg = insn & 0x3f;
kono
parents:
diff changeset
981 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
982 offset = (_Unwind_Sword) utmp * fs->data_align;
kono
parents:
diff changeset
983 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
984 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
985 {
kono
parents:
diff changeset
986 fs->regs.reg[reg].how = REG_SAVED_OFFSET;
kono
parents:
diff changeset
987 fs->regs.reg[reg].loc.offset = offset;
kono
parents:
diff changeset
988 }
kono
parents:
diff changeset
989 }
kono
parents:
diff changeset
990 else if ((insn & 0xc0) == DW_CFA_restore)
kono
parents:
diff changeset
991 {
kono
parents:
diff changeset
992 reg = insn & 0x3f;
kono
parents:
diff changeset
993 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
994 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
995 fs->regs.reg[reg].how = REG_UNSAVED;
kono
parents:
diff changeset
996 }
kono
parents:
diff changeset
997 else switch (insn)
kono
parents:
diff changeset
998 {
kono
parents:
diff changeset
999 case DW_CFA_set_loc:
kono
parents:
diff changeset
1000 {
kono
parents:
diff changeset
1001 _Unwind_Ptr pc;
kono
parents:
diff changeset
1002
kono
parents:
diff changeset
1003 insn_ptr = read_encoded_value (context, fs->fde_encoding,
kono
parents:
diff changeset
1004 insn_ptr, &pc);
kono
parents:
diff changeset
1005 fs->pc = (void *) pc;
kono
parents:
diff changeset
1006 }
kono
parents:
diff changeset
1007 break;
kono
parents:
diff changeset
1008
kono
parents:
diff changeset
1009 case DW_CFA_advance_loc1:
kono
parents:
diff changeset
1010 fs->pc += read_1u (insn_ptr) * fs->code_align;
kono
parents:
diff changeset
1011 insn_ptr += 1;
kono
parents:
diff changeset
1012 break;
kono
parents:
diff changeset
1013 case DW_CFA_advance_loc2:
kono
parents:
diff changeset
1014 fs->pc += read_2u (insn_ptr) * fs->code_align;
kono
parents:
diff changeset
1015 insn_ptr += 2;
kono
parents:
diff changeset
1016 break;
kono
parents:
diff changeset
1017 case DW_CFA_advance_loc4:
kono
parents:
diff changeset
1018 fs->pc += read_4u (insn_ptr) * fs->code_align;
kono
parents:
diff changeset
1019 insn_ptr += 4;
kono
parents:
diff changeset
1020 break;
kono
parents:
diff changeset
1021
kono
parents:
diff changeset
1022 case DW_CFA_offset_extended:
kono
parents:
diff changeset
1023 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1024 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1025 offset = (_Unwind_Sword) utmp * fs->data_align;
kono
parents:
diff changeset
1026 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1027 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1028 {
kono
parents:
diff changeset
1029 fs->regs.reg[reg].how = REG_SAVED_OFFSET;
kono
parents:
diff changeset
1030 fs->regs.reg[reg].loc.offset = offset;
kono
parents:
diff changeset
1031 }
kono
parents:
diff changeset
1032 break;
kono
parents:
diff changeset
1033
kono
parents:
diff changeset
1034 case DW_CFA_restore_extended:
kono
parents:
diff changeset
1035 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1036 /* FIXME, this is wrong; the CIE might have said that the
kono
parents:
diff changeset
1037 register was saved somewhere. */
kono
parents:
diff changeset
1038 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1039 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1040 fs->regs.reg[reg].how = REG_UNSAVED;
kono
parents:
diff changeset
1041 break;
kono
parents:
diff changeset
1042
kono
parents:
diff changeset
1043 case DW_CFA_same_value:
kono
parents:
diff changeset
1044 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1045 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1046 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1047 fs->regs.reg[reg].how = REG_UNSAVED;
kono
parents:
diff changeset
1048 break;
kono
parents:
diff changeset
1049
kono
parents:
diff changeset
1050 case DW_CFA_undefined:
kono
parents:
diff changeset
1051 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1052 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1053 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1054 fs->regs.reg[reg].how = REG_UNDEFINED;
kono
parents:
diff changeset
1055 break;
kono
parents:
diff changeset
1056
kono
parents:
diff changeset
1057 case DW_CFA_nop:
kono
parents:
diff changeset
1058 break;
kono
parents:
diff changeset
1059
kono
parents:
diff changeset
1060 case DW_CFA_register:
kono
parents:
diff changeset
1061 {
kono
parents:
diff changeset
1062 _uleb128_t reg2;
kono
parents:
diff changeset
1063 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1064 insn_ptr = read_uleb128 (insn_ptr, &reg2);
kono
parents:
diff changeset
1065 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1066 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1067 {
kono
parents:
diff changeset
1068 fs->regs.reg[reg].how = REG_SAVED_REG;
kono
parents:
diff changeset
1069 fs->regs.reg[reg].loc.reg = (_Unwind_Word)reg2;
kono
parents:
diff changeset
1070 }
kono
parents:
diff changeset
1071 }
kono
parents:
diff changeset
1072 break;
kono
parents:
diff changeset
1073
kono
parents:
diff changeset
1074 case DW_CFA_remember_state:
kono
parents:
diff changeset
1075 {
kono
parents:
diff changeset
1076 struct frame_state_reg_info *new_rs;
kono
parents:
diff changeset
1077 if (unused_rs)
kono
parents:
diff changeset
1078 {
kono
parents:
diff changeset
1079 new_rs = unused_rs;
kono
parents:
diff changeset
1080 unused_rs = unused_rs->prev;
kono
parents:
diff changeset
1081 }
kono
parents:
diff changeset
1082 else
kono
parents:
diff changeset
1083 new_rs = alloca (sizeof (struct frame_state_reg_info));
kono
parents:
diff changeset
1084
kono
parents:
diff changeset
1085 *new_rs = fs->regs;
kono
parents:
diff changeset
1086 fs->regs.prev = new_rs;
kono
parents:
diff changeset
1087 }
kono
parents:
diff changeset
1088 break;
kono
parents:
diff changeset
1089
kono
parents:
diff changeset
1090 case DW_CFA_restore_state:
kono
parents:
diff changeset
1091 {
kono
parents:
diff changeset
1092 struct frame_state_reg_info *old_rs = fs->regs.prev;
kono
parents:
diff changeset
1093 fs->regs = *old_rs;
kono
parents:
diff changeset
1094 old_rs->prev = unused_rs;
kono
parents:
diff changeset
1095 unused_rs = old_rs;
kono
parents:
diff changeset
1096 }
kono
parents:
diff changeset
1097 break;
kono
parents:
diff changeset
1098
kono
parents:
diff changeset
1099 case DW_CFA_def_cfa:
kono
parents:
diff changeset
1100 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1101 fs->regs.cfa_reg = (_Unwind_Word)utmp;
kono
parents:
diff changeset
1102 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1103 fs->regs.cfa_offset = (_Unwind_Word)utmp;
kono
parents:
diff changeset
1104 fs->regs.cfa_how = CFA_REG_OFFSET;
kono
parents:
diff changeset
1105 break;
kono
parents:
diff changeset
1106
kono
parents:
diff changeset
1107 case DW_CFA_def_cfa_register:
kono
parents:
diff changeset
1108 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1109 fs->regs.cfa_reg = (_Unwind_Word)utmp;
kono
parents:
diff changeset
1110 fs->regs.cfa_how = CFA_REG_OFFSET;
kono
parents:
diff changeset
1111 break;
kono
parents:
diff changeset
1112
kono
parents:
diff changeset
1113 case DW_CFA_def_cfa_offset:
kono
parents:
diff changeset
1114 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1115 fs->regs.cfa_offset = utmp;
kono
parents:
diff changeset
1116 /* cfa_how deliberately not set. */
kono
parents:
diff changeset
1117 break;
kono
parents:
diff changeset
1118
kono
parents:
diff changeset
1119 case DW_CFA_def_cfa_expression:
kono
parents:
diff changeset
1120 fs->regs.cfa_exp = insn_ptr;
kono
parents:
diff changeset
1121 fs->regs.cfa_how = CFA_EXP;
kono
parents:
diff changeset
1122 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1123 insn_ptr += utmp;
kono
parents:
diff changeset
1124 break;
kono
parents:
diff changeset
1125
kono
parents:
diff changeset
1126 case DW_CFA_expression:
kono
parents:
diff changeset
1127 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1128 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1129 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1130 {
kono
parents:
diff changeset
1131 fs->regs.reg[reg].how = REG_SAVED_EXP;
kono
parents:
diff changeset
1132 fs->regs.reg[reg].loc.exp = insn_ptr;
kono
parents:
diff changeset
1133 }
kono
parents:
diff changeset
1134 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1135 insn_ptr += utmp;
kono
parents:
diff changeset
1136 break;
kono
parents:
diff changeset
1137
kono
parents:
diff changeset
1138 /* Dwarf3. */
kono
parents:
diff changeset
1139 case DW_CFA_offset_extended_sf:
kono
parents:
diff changeset
1140 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1141 insn_ptr = read_sleb128 (insn_ptr, &stmp);
kono
parents:
diff changeset
1142 offset = stmp * fs->data_align;
kono
parents:
diff changeset
1143 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1144 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1145 {
kono
parents:
diff changeset
1146 fs->regs.reg[reg].how = REG_SAVED_OFFSET;
kono
parents:
diff changeset
1147 fs->regs.reg[reg].loc.offset = offset;
kono
parents:
diff changeset
1148 }
kono
parents:
diff changeset
1149 break;
kono
parents:
diff changeset
1150
kono
parents:
diff changeset
1151 case DW_CFA_def_cfa_sf:
kono
parents:
diff changeset
1152 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1153 fs->regs.cfa_reg = (_Unwind_Word)utmp;
kono
parents:
diff changeset
1154 insn_ptr = read_sleb128 (insn_ptr, &stmp);
kono
parents:
diff changeset
1155 fs->regs.cfa_offset = (_Unwind_Sword)stmp;
kono
parents:
diff changeset
1156 fs->regs.cfa_how = CFA_REG_OFFSET;
kono
parents:
diff changeset
1157 fs->regs.cfa_offset *= fs->data_align;
kono
parents:
diff changeset
1158 break;
kono
parents:
diff changeset
1159
kono
parents:
diff changeset
1160 case DW_CFA_def_cfa_offset_sf:
kono
parents:
diff changeset
1161 insn_ptr = read_sleb128 (insn_ptr, &stmp);
kono
parents:
diff changeset
1162 fs->regs.cfa_offset = (_Unwind_Sword)stmp;
kono
parents:
diff changeset
1163 fs->regs.cfa_offset *= fs->data_align;
kono
parents:
diff changeset
1164 /* cfa_how deliberately not set. */
kono
parents:
diff changeset
1165 break;
kono
parents:
diff changeset
1166
kono
parents:
diff changeset
1167 case DW_CFA_val_offset:
kono
parents:
diff changeset
1168 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1169 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1170 offset = (_Unwind_Sword) utmp * fs->data_align;
kono
parents:
diff changeset
1171 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1172 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1173 {
kono
parents:
diff changeset
1174 fs->regs.reg[reg].how = REG_SAVED_VAL_OFFSET;
kono
parents:
diff changeset
1175 fs->regs.reg[reg].loc.offset = offset;
kono
parents:
diff changeset
1176 }
kono
parents:
diff changeset
1177 break;
kono
parents:
diff changeset
1178
kono
parents:
diff changeset
1179 case DW_CFA_val_offset_sf:
kono
parents:
diff changeset
1180 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1181 insn_ptr = read_sleb128 (insn_ptr, &stmp);
kono
parents:
diff changeset
1182 offset = stmp * fs->data_align;
kono
parents:
diff changeset
1183 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1184 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1185 {
kono
parents:
diff changeset
1186 fs->regs.reg[reg].how = REG_SAVED_VAL_OFFSET;
kono
parents:
diff changeset
1187 fs->regs.reg[reg].loc.offset = offset;
kono
parents:
diff changeset
1188 }
kono
parents:
diff changeset
1189 break;
kono
parents:
diff changeset
1190
kono
parents:
diff changeset
1191 case DW_CFA_val_expression:
kono
parents:
diff changeset
1192 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1193 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1194 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1195 {
kono
parents:
diff changeset
1196 fs->regs.reg[reg].how = REG_SAVED_VAL_EXP;
kono
parents:
diff changeset
1197 fs->regs.reg[reg].loc.exp = insn_ptr;
kono
parents:
diff changeset
1198 }
kono
parents:
diff changeset
1199 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1200 insn_ptr += utmp;
kono
parents:
diff changeset
1201 break;
kono
parents:
diff changeset
1202
kono
parents:
diff changeset
1203 case DW_CFA_GNU_window_save:
kono
parents:
diff changeset
1204 #if defined (__aarch64__) && !defined (__ILP32__)
kono
parents:
diff changeset
1205 /* This CFA is multiplexed with Sparc. On AArch64 it's used to toggle
kono
parents:
diff changeset
1206 return address signing status. */
kono
parents:
diff changeset
1207 fs->regs.reg[DWARF_REGNUM_AARCH64_RA_STATE].loc.offset ^= 1;
kono
parents:
diff changeset
1208 #else
kono
parents:
diff changeset
1209 /* ??? Hardcoded for SPARC register window configuration. */
kono
parents:
diff changeset
1210 if (__LIBGCC_DWARF_FRAME_REGISTERS__ >= 32)
kono
parents:
diff changeset
1211 for (reg = 16; reg < 32; ++reg)
kono
parents:
diff changeset
1212 {
kono
parents:
diff changeset
1213 fs->regs.reg[reg].how = REG_SAVED_OFFSET;
kono
parents:
diff changeset
1214 fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *);
kono
parents:
diff changeset
1215 }
kono
parents:
diff changeset
1216 #endif
kono
parents:
diff changeset
1217 break;
kono
parents:
diff changeset
1218
kono
parents:
diff changeset
1219 case DW_CFA_GNU_args_size:
kono
parents:
diff changeset
1220 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1221 context->args_size = (_Unwind_Word)utmp;
kono
parents:
diff changeset
1222 break;
kono
parents:
diff changeset
1223
kono
parents:
diff changeset
1224 case DW_CFA_GNU_negative_offset_extended:
kono
parents:
diff changeset
1225 /* Obsoleted by DW_CFA_offset_extended_sf, but used by
kono
parents:
diff changeset
1226 older PowerPC code. */
kono
parents:
diff changeset
1227 insn_ptr = read_uleb128 (insn_ptr, &reg);
kono
parents:
diff changeset
1228 insn_ptr = read_uleb128 (insn_ptr, &utmp);
kono
parents:
diff changeset
1229 offset = (_Unwind_Word) utmp * fs->data_align;
kono
parents:
diff changeset
1230 reg = DWARF_REG_TO_UNWIND_COLUMN (reg);
kono
parents:
diff changeset
1231 if (UNWIND_COLUMN_IN_RANGE (reg))
kono
parents:
diff changeset
1232 {
kono
parents:
diff changeset
1233 fs->regs.reg[reg].how = REG_SAVED_OFFSET;
kono
parents:
diff changeset
1234 fs->regs.reg[reg].loc.offset = -offset;
kono
parents:
diff changeset
1235 }
kono
parents:
diff changeset
1236 break;
kono
parents:
diff changeset
1237
kono
parents:
diff changeset
1238 default:
kono
parents:
diff changeset
1239 gcc_unreachable ();
kono
parents:
diff changeset
1240 }
kono
parents:
diff changeset
1241 }
kono
parents:
diff changeset
1242 }
kono
parents:
diff changeset
1243
kono
parents:
diff changeset
1244 /* Given the _Unwind_Context CONTEXT for a stack frame, look up the FDE for
kono
parents:
diff changeset
1245 its caller and decode it into FS. This function also sets the
kono
parents:
diff changeset
1246 args_size and lsda members of CONTEXT, as they are really information
kono
parents:
diff changeset
1247 about the caller's frame. */
kono
parents:
diff changeset
1248
kono
parents:
diff changeset
1249 static _Unwind_Reason_Code
kono
parents:
diff changeset
1250 uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
kono
parents:
diff changeset
1251 {
kono
parents:
diff changeset
1252 const struct dwarf_fde *fde;
kono
parents:
diff changeset
1253 const struct dwarf_cie *cie;
kono
parents:
diff changeset
1254 const unsigned char *aug, *insn, *end;
kono
parents:
diff changeset
1255
kono
parents:
diff changeset
1256 memset (fs, 0, sizeof (*fs));
kono
parents:
diff changeset
1257 context->args_size = 0;
kono
parents:
diff changeset
1258 context->lsda = 0;
kono
parents:
diff changeset
1259
kono
parents:
diff changeset
1260 if (context->ra == 0)
kono
parents:
diff changeset
1261 return _URC_END_OF_STACK;
kono
parents:
diff changeset
1262
kono
parents:
diff changeset
1263 fde = _Unwind_Find_FDE (context->ra + _Unwind_IsSignalFrame (context) - 1,
kono
parents:
diff changeset
1264 &context->bases);
kono
parents:
diff changeset
1265 if (fde == NULL)
kono
parents:
diff changeset
1266 {
kono
parents:
diff changeset
1267 #ifdef MD_FALLBACK_FRAME_STATE_FOR
kono
parents:
diff changeset
1268 /* Couldn't find frame unwind info for this function. Try a
kono
parents:
diff changeset
1269 target-specific fallback mechanism. This will necessarily
kono
parents:
diff changeset
1270 not provide a personality routine or LSDA. */
kono
parents:
diff changeset
1271 return MD_FALLBACK_FRAME_STATE_FOR (context, fs);
kono
parents:
diff changeset
1272 #else
kono
parents:
diff changeset
1273 return _URC_END_OF_STACK;
kono
parents:
diff changeset
1274 #endif
kono
parents:
diff changeset
1275 }
kono
parents:
diff changeset
1276
kono
parents:
diff changeset
1277 fs->pc = context->bases.func;
kono
parents:
diff changeset
1278
kono
parents:
diff changeset
1279 cie = get_cie (fde);
kono
parents:
diff changeset
1280 insn = extract_cie_info (cie, context, fs);
kono
parents:
diff changeset
1281 if (insn == NULL)
kono
parents:
diff changeset
1282 /* CIE contained unknown augmentation. */
kono
parents:
diff changeset
1283 return _URC_FATAL_PHASE1_ERROR;
kono
parents:
diff changeset
1284
kono
parents:
diff changeset
1285 /* First decode all the insns in the CIE. */
kono
parents:
diff changeset
1286 end = (const unsigned char *) next_fde ((const struct dwarf_fde *) cie);
kono
parents:
diff changeset
1287 execute_cfa_program (insn, end, context, fs);
kono
parents:
diff changeset
1288
kono
parents:
diff changeset
1289 /* Locate augmentation for the fde. */
kono
parents:
diff changeset
1290 aug = (const unsigned char *) fde + sizeof (*fde);
kono
parents:
diff changeset
1291 aug += 2 * size_of_encoded_value (fs->fde_encoding);
kono
parents:
diff changeset
1292 insn = NULL;
kono
parents:
diff changeset
1293 if (fs->saw_z)
kono
parents:
diff changeset
1294 {
kono
parents:
diff changeset
1295 _uleb128_t i;
kono
parents:
diff changeset
1296 aug = read_uleb128 (aug, &i);
kono
parents:
diff changeset
1297 insn = aug + i;
kono
parents:
diff changeset
1298 }
kono
parents:
diff changeset
1299 if (fs->lsda_encoding != DW_EH_PE_omit)
kono
parents:
diff changeset
1300 {
kono
parents:
diff changeset
1301 _Unwind_Ptr lsda;
kono
parents:
diff changeset
1302
kono
parents:
diff changeset
1303 aug = read_encoded_value (context, fs->lsda_encoding, aug, &lsda);
kono
parents:
diff changeset
1304 context->lsda = (void *) lsda;
kono
parents:
diff changeset
1305 }
kono
parents:
diff changeset
1306
kono
parents:
diff changeset
1307 /* Then the insns in the FDE up to our target PC. */
kono
parents:
diff changeset
1308 if (insn == NULL)
kono
parents:
diff changeset
1309 insn = aug;
kono
parents:
diff changeset
1310 end = (const unsigned char *) next_fde (fde);
kono
parents:
diff changeset
1311 execute_cfa_program (insn, end, context, fs);
kono
parents:
diff changeset
1312
kono
parents:
diff changeset
1313 return _URC_NO_REASON;
kono
parents:
diff changeset
1314 }
kono
parents:
diff changeset
1315
kono
parents:
diff changeset
1316 typedef struct frame_state
kono
parents:
diff changeset
1317 {
kono
parents:
diff changeset
1318 void *cfa;
kono
parents:
diff changeset
1319 void *eh_ptr;
kono
parents:
diff changeset
1320 long cfa_offset;
kono
parents:
diff changeset
1321 long args_size;
kono
parents:
diff changeset
1322 long reg_or_offset[PRE_GCC3_DWARF_FRAME_REGISTERS+1];
kono
parents:
diff changeset
1323 unsigned short cfa_reg;
kono
parents:
diff changeset
1324 unsigned short retaddr_column;
kono
parents:
diff changeset
1325 char saved[PRE_GCC3_DWARF_FRAME_REGISTERS+1];
kono
parents:
diff changeset
1326 } frame_state;
kono
parents:
diff changeset
1327
kono
parents:
diff changeset
1328 struct frame_state * __frame_state_for (void *, struct frame_state *);
kono
parents:
diff changeset
1329
kono
parents:
diff changeset
1330 /* Called from pre-G++ 3.0 __throw to find the registers to restore for
kono
parents:
diff changeset
1331 a given PC_TARGET. The caller should allocate a local variable of
kono
parents:
diff changeset
1332 `struct frame_state' and pass its address to STATE_IN. */
kono
parents:
diff changeset
1333
kono
parents:
diff changeset
1334 struct frame_state *
kono
parents:
diff changeset
1335 __frame_state_for (void *pc_target, struct frame_state *state_in)
kono
parents:
diff changeset
1336 {
kono
parents:
diff changeset
1337 struct _Unwind_Context context;
kono
parents:
diff changeset
1338 _Unwind_FrameState fs;
kono
parents:
diff changeset
1339 int reg;
kono
parents:
diff changeset
1340
kono
parents:
diff changeset
1341 memset (&context, 0, sizeof (struct _Unwind_Context));
kono
parents:
diff changeset
1342 if (!ASSUME_EXTENDED_UNWIND_CONTEXT)
kono
parents:
diff changeset
1343 context.flags = EXTENDED_CONTEXT_BIT;
kono
parents:
diff changeset
1344 context.ra = pc_target + 1;
kono
parents:
diff changeset
1345
kono
parents:
diff changeset
1346 if (uw_frame_state_for (&context, &fs) != _URC_NO_REASON)
kono
parents:
diff changeset
1347 return 0;
kono
parents:
diff changeset
1348
kono
parents:
diff changeset
1349 /* We have no way to pass a location expression for the CFA to our
kono
parents:
diff changeset
1350 caller. It wouldn't understand it anyway. */
kono
parents:
diff changeset
1351 if (fs.regs.cfa_how == CFA_EXP)
kono
parents:
diff changeset
1352 return 0;
kono
parents:
diff changeset
1353
kono
parents:
diff changeset
1354 for (reg = 0; reg < PRE_GCC3_DWARF_FRAME_REGISTERS + 1; reg++)
kono
parents:
diff changeset
1355 {
kono
parents:
diff changeset
1356 state_in->saved[reg] = fs.regs.reg[reg].how;
kono
parents:
diff changeset
1357 switch (state_in->saved[reg])
kono
parents:
diff changeset
1358 {
kono
parents:
diff changeset
1359 case REG_SAVED_REG:
kono
parents:
diff changeset
1360 state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.reg;
kono
parents:
diff changeset
1361 break;
kono
parents:
diff changeset
1362 case REG_SAVED_OFFSET:
kono
parents:
diff changeset
1363 state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.offset;
kono
parents:
diff changeset
1364 break;
kono
parents:
diff changeset
1365 default:
kono
parents:
diff changeset
1366 state_in->reg_or_offset[reg] = 0;
kono
parents:
diff changeset
1367 break;
kono
parents:
diff changeset
1368 }
kono
parents:
diff changeset
1369 }
kono
parents:
diff changeset
1370
kono
parents:
diff changeset
1371 state_in->cfa_offset = fs.regs.cfa_offset;
kono
parents:
diff changeset
1372 state_in->cfa_reg = fs.regs.cfa_reg;
kono
parents:
diff changeset
1373 state_in->retaddr_column = fs.retaddr_column;
kono
parents:
diff changeset
1374 state_in->args_size = context.args_size;
kono
parents:
diff changeset
1375 state_in->eh_ptr = fs.eh_ptr;
kono
parents:
diff changeset
1376
kono
parents:
diff changeset
1377 return state_in;
kono
parents:
diff changeset
1378 }
kono
parents:
diff changeset
1379
kono
parents:
diff changeset
1380 typedef union { _Unwind_Ptr ptr; _Unwind_Word word; } _Unwind_SpTmp;
kono
parents:
diff changeset
1381
kono
parents:
diff changeset
1382 static inline void
kono
parents:
diff changeset
1383 _Unwind_SetSpColumn (struct _Unwind_Context *context, void *cfa,
kono
parents:
diff changeset
1384 _Unwind_SpTmp *tmp_sp)
kono
parents:
diff changeset
1385 {
kono
parents:
diff changeset
1386 int size = dwarf_reg_size_table[__builtin_dwarf_sp_column ()];
kono
parents:
diff changeset
1387
kono
parents:
diff changeset
1388 if (size == sizeof(_Unwind_Ptr))
kono
parents:
diff changeset
1389 tmp_sp->ptr = (_Unwind_Ptr) cfa;
kono
parents:
diff changeset
1390 else
kono
parents:
diff changeset
1391 {
kono
parents:
diff changeset
1392 gcc_assert (size == sizeof(_Unwind_Word));
kono
parents:
diff changeset
1393 tmp_sp->word = (_Unwind_Ptr) cfa;
kono
parents:
diff changeset
1394 }
kono
parents:
diff changeset
1395 _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), tmp_sp);
kono
parents:
diff changeset
1396 }
kono
parents:
diff changeset
1397
kono
parents:
diff changeset
1398 static void
kono
parents:
diff changeset
1399 uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
kono
parents:
diff changeset
1400 {
kono
parents:
diff changeset
1401 struct _Unwind_Context orig_context = *context;
kono
parents:
diff changeset
1402 void *cfa;
kono
parents:
diff changeset
1403 long i;
kono
parents:
diff changeset
1404
kono
parents:
diff changeset
1405 #ifdef __LIBGCC_EH_RETURN_STACKADJ_RTX__
kono
parents:
diff changeset
1406 /* Special handling here: Many machines do not use a frame pointer,
kono
parents:
diff changeset
1407 and track the CFA only through offsets from the stack pointer from
kono
parents:
diff changeset
1408 one frame to the next. In this case, the stack pointer is never
kono
parents:
diff changeset
1409 stored, so it has no saved address in the context. What we do
kono
parents:
diff changeset
1410 have is the CFA from the previous stack frame.
kono
parents:
diff changeset
1411
kono
parents:
diff changeset
1412 In very special situations (such as unwind info for signal return),
kono
parents:
diff changeset
1413 there may be location expressions that use the stack pointer as well.
kono
parents:
diff changeset
1414
kono
parents:
diff changeset
1415 Do this conditionally for one frame. This allows the unwind info
kono
parents:
diff changeset
1416 for one frame to save a copy of the stack pointer from the previous
kono
parents:
diff changeset
1417 frame, and be able to use much easier CFA mechanisms to do it.
kono
parents:
diff changeset
1418 Always zap the saved stack pointer value for the next frame; carrying
kono
parents:
diff changeset
1419 the value over from one frame to another doesn't make sense. */
kono
parents:
diff changeset
1420
kono
parents:
diff changeset
1421 _Unwind_SpTmp tmp_sp;
kono
parents:
diff changeset
1422
kono
parents:
diff changeset
1423 if (!_Unwind_GetGRPtr (&orig_context, __builtin_dwarf_sp_column ()))
kono
parents:
diff changeset
1424 _Unwind_SetSpColumn (&orig_context, context->cfa, &tmp_sp);
kono
parents:
diff changeset
1425 _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), NULL);
kono
parents:
diff changeset
1426 #endif
kono
parents:
diff changeset
1427
kono
parents:
diff changeset
1428 /* Compute this frame's CFA. */
kono
parents:
diff changeset
1429 switch (fs->regs.cfa_how)
kono
parents:
diff changeset
1430 {
kono
parents:
diff changeset
1431 case CFA_REG_OFFSET:
kono
parents:
diff changeset
1432 cfa = _Unwind_GetPtr (&orig_context, fs->regs.cfa_reg);
kono
parents:
diff changeset
1433 cfa += fs->regs.cfa_offset;
kono
parents:
diff changeset
1434 break;
kono
parents:
diff changeset
1435
kono
parents:
diff changeset
1436 case CFA_EXP:
kono
parents:
diff changeset
1437 {
kono
parents:
diff changeset
1438 const unsigned char *exp = fs->regs.cfa_exp;
kono
parents:
diff changeset
1439 _uleb128_t len;
kono
parents:
diff changeset
1440
kono
parents:
diff changeset
1441 exp = read_uleb128 (exp, &len);
kono
parents:
diff changeset
1442 cfa = (void *) (_Unwind_Ptr)
kono
parents:
diff changeset
1443 execute_stack_op (exp, exp + len, &orig_context, 0);
kono
parents:
diff changeset
1444 break;
kono
parents:
diff changeset
1445 }
kono
parents:
diff changeset
1446
kono
parents:
diff changeset
1447 default:
kono
parents:
diff changeset
1448 gcc_unreachable ();
kono
parents:
diff changeset
1449 }
kono
parents:
diff changeset
1450 context->cfa = cfa;
kono
parents:
diff changeset
1451
kono
parents:
diff changeset
1452 /* Compute the addresses of all registers saved in this frame. */
kono
parents:
diff changeset
1453 for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__ + 1; ++i)
kono
parents:
diff changeset
1454 switch (fs->regs.reg[i].how)
kono
parents:
diff changeset
1455 {
kono
parents:
diff changeset
1456 case REG_UNSAVED:
kono
parents:
diff changeset
1457 case REG_UNDEFINED:
kono
parents:
diff changeset
1458 break;
kono
parents:
diff changeset
1459
kono
parents:
diff changeset
1460 case REG_SAVED_OFFSET:
kono
parents:
diff changeset
1461 _Unwind_SetGRPtr (context, i,
kono
parents:
diff changeset
1462 (void *) (cfa + fs->regs.reg[i].loc.offset));
kono
parents:
diff changeset
1463 break;
kono
parents:
diff changeset
1464
kono
parents:
diff changeset
1465 case REG_SAVED_REG:
kono
parents:
diff changeset
1466 if (_Unwind_GRByValue (&orig_context, fs->regs.reg[i].loc.reg))
kono
parents:
diff changeset
1467 _Unwind_SetGRValue (context, i,
kono
parents:
diff changeset
1468 _Unwind_GetGR (&orig_context,
kono
parents:
diff changeset
1469 fs->regs.reg[i].loc.reg));
kono
parents:
diff changeset
1470 else
kono
parents:
diff changeset
1471 _Unwind_SetGRPtr (context, i,
kono
parents:
diff changeset
1472 _Unwind_GetGRPtr (&orig_context,
kono
parents:
diff changeset
1473 fs->regs.reg[i].loc.reg));
kono
parents:
diff changeset
1474 break;
kono
parents:
diff changeset
1475
kono
parents:
diff changeset
1476 case REG_SAVED_EXP:
kono
parents:
diff changeset
1477 {
kono
parents:
diff changeset
1478 const unsigned char *exp = fs->regs.reg[i].loc.exp;
kono
parents:
diff changeset
1479 _uleb128_t len;
kono
parents:
diff changeset
1480 _Unwind_Ptr val;
kono
parents:
diff changeset
1481
kono
parents:
diff changeset
1482 exp = read_uleb128 (exp, &len);
kono
parents:
diff changeset
1483 val = execute_stack_op (exp, exp + len, &orig_context,
kono
parents:
diff changeset
1484 (_Unwind_Ptr) cfa);
kono
parents:
diff changeset
1485 _Unwind_SetGRPtr (context, i, (void *) val);
kono
parents:
diff changeset
1486 }
kono
parents:
diff changeset
1487 break;
kono
parents:
diff changeset
1488
kono
parents:
diff changeset
1489 case REG_SAVED_VAL_OFFSET:
kono
parents:
diff changeset
1490 _Unwind_SetGRValue (context, i,
kono
parents:
diff changeset
1491 (_Unwind_Internal_Ptr)
kono
parents:
diff changeset
1492 (cfa + fs->regs.reg[i].loc.offset));
kono
parents:
diff changeset
1493 break;
kono
parents:
diff changeset
1494
kono
parents:
diff changeset
1495 case REG_SAVED_VAL_EXP:
kono
parents:
diff changeset
1496 {
kono
parents:
diff changeset
1497 const unsigned char *exp = fs->regs.reg[i].loc.exp;
kono
parents:
diff changeset
1498 _uleb128_t len;
kono
parents:
diff changeset
1499 _Unwind_Ptr val;
kono
parents:
diff changeset
1500
kono
parents:
diff changeset
1501 exp = read_uleb128 (exp, &len);
kono
parents:
diff changeset
1502 val = execute_stack_op (exp, exp + len, &orig_context,
kono
parents:
diff changeset
1503 (_Unwind_Ptr) cfa);
kono
parents:
diff changeset
1504 _Unwind_SetGRValue (context, i, val);
kono
parents:
diff changeset
1505 }
kono
parents:
diff changeset
1506 break;
kono
parents:
diff changeset
1507 }
kono
parents:
diff changeset
1508
kono
parents:
diff changeset
1509 _Unwind_SetSignalFrame (context, fs->signal_frame);
kono
parents:
diff changeset
1510
kono
parents:
diff changeset
1511 #ifdef MD_FROB_UPDATE_CONTEXT
kono
parents:
diff changeset
1512 MD_FROB_UPDATE_CONTEXT (context, fs);
kono
parents:
diff changeset
1513 #endif
kono
parents:
diff changeset
1514 }
kono
parents:
diff changeset
1515
kono
parents:
diff changeset
1516 /* CONTEXT describes the unwind state for a frame, and FS describes the FDE
kono
parents:
diff changeset
1517 of its caller. Update CONTEXT to refer to the caller as well. Note
kono
parents:
diff changeset
1518 that the args_size and lsda members are not updated here, but later in
kono
parents:
diff changeset
1519 uw_frame_state_for. */
kono
parents:
diff changeset
1520
kono
parents:
diff changeset
1521 static void
kono
parents:
diff changeset
1522 uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
kono
parents:
diff changeset
1523 {
kono
parents:
diff changeset
1524 uw_update_context_1 (context, fs);
kono
parents:
diff changeset
1525
kono
parents:
diff changeset
1526 /* In general this unwinder doesn't make any distinction between
kono
parents:
diff changeset
1527 undefined and same_value rule. Call-saved registers are assumed
kono
parents:
diff changeset
1528 to have same_value rule by default and explicit undefined
kono
parents:
diff changeset
1529 rule is handled like same_value. The only exception is
kono
parents:
diff changeset
1530 DW_CFA_undefined on retaddr_column which is supposed to
kono
parents:
diff changeset
1531 mark outermost frame in DWARF 3. */
kono
parents:
diff changeset
1532 if (fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (fs->retaddr_column)].how
kono
parents:
diff changeset
1533 == REG_UNDEFINED)
kono
parents:
diff changeset
1534 /* uw_frame_state_for uses context->ra == 0 check to find outermost
kono
parents:
diff changeset
1535 stack frame. */
kono
parents:
diff changeset
1536 context->ra = 0;
kono
parents:
diff changeset
1537 else
kono
parents:
diff changeset
1538 {
kono
parents:
diff changeset
1539 /* Compute the return address now, since the return address column
kono
parents:
diff changeset
1540 can change from frame to frame. */
kono
parents:
diff changeset
1541 context->ra = __builtin_extract_return_addr
kono
parents:
diff changeset
1542 (_Unwind_GetPtr (context, fs->retaddr_column));
kono
parents:
diff changeset
1543 #ifdef MD_POST_EXTRACT_FRAME_ADDR
kono
parents:
diff changeset
1544 context->ra = MD_POST_EXTRACT_FRAME_ADDR (context, fs, context->ra);
kono
parents:
diff changeset
1545 #endif
kono
parents:
diff changeset
1546 }
kono
parents:
diff changeset
1547 }
kono
parents:
diff changeset
1548
kono
parents:
diff changeset
1549 static void
kono
parents:
diff changeset
1550 uw_advance_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
kono
parents:
diff changeset
1551 {
kono
parents:
diff changeset
1552 uw_update_context (context, fs);
kono
parents:
diff changeset
1553 }
kono
parents:
diff changeset
1554
kono
parents:
diff changeset
1555 /* Fill in CONTEXT for top-of-stack. The only valid registers at this
kono
parents:
diff changeset
1556 level will be the return address and the CFA. */
kono
parents:
diff changeset
1557
kono
parents:
diff changeset
1558 #define uw_init_context(CONTEXT) \
kono
parents:
diff changeset
1559 do \
kono
parents:
diff changeset
1560 { \
kono
parents:
diff changeset
1561 /* Do any necessary initialization to access arbitrary stack frames. \
kono
parents:
diff changeset
1562 On the SPARC, this means flushing the register windows. */ \
kono
parents:
diff changeset
1563 __builtin_unwind_init (); \
kono
parents:
diff changeset
1564 uw_init_context_1 (CONTEXT, __builtin_dwarf_cfa (), \
kono
parents:
diff changeset
1565 __builtin_return_address (0)); \
kono
parents:
diff changeset
1566 } \
kono
parents:
diff changeset
1567 while (0)
kono
parents:
diff changeset
1568
kono
parents:
diff changeset
1569 static inline void
kono
parents:
diff changeset
1570 init_dwarf_reg_size_table (void)
kono
parents:
diff changeset
1571 {
kono
parents:
diff changeset
1572 __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table);
kono
parents:
diff changeset
1573 }
kono
parents:
diff changeset
1574
kono
parents:
diff changeset
1575 static void __attribute__((noinline))
kono
parents:
diff changeset
1576 uw_init_context_1 (struct _Unwind_Context *context,
kono
parents:
diff changeset
1577 void *outer_cfa, void *outer_ra)
kono
parents:
diff changeset
1578 {
kono
parents:
diff changeset
1579 void *ra = __builtin_extract_return_addr (__builtin_return_address (0));
kono
parents:
diff changeset
1580 #ifdef MD_POST_EXTRACT_ROOT_ADDR
kono
parents:
diff changeset
1581 ra = MD_POST_EXTRACT_ROOT_ADDR (ra);
kono
parents:
diff changeset
1582 #endif
kono
parents:
diff changeset
1583 _Unwind_FrameState fs;
kono
parents:
diff changeset
1584 _Unwind_SpTmp sp_slot;
kono
parents:
diff changeset
1585 _Unwind_Reason_Code code;
kono
parents:
diff changeset
1586
kono
parents:
diff changeset
1587 memset (context, 0, sizeof (struct _Unwind_Context));
kono
parents:
diff changeset
1588 context->ra = ra;
kono
parents:
diff changeset
1589 if (!ASSUME_EXTENDED_UNWIND_CONTEXT)
kono
parents:
diff changeset
1590 context->flags = EXTENDED_CONTEXT_BIT;
kono
parents:
diff changeset
1591
kono
parents:
diff changeset
1592 code = uw_frame_state_for (context, &fs);
kono
parents:
diff changeset
1593 gcc_assert (code == _URC_NO_REASON);
kono
parents:
diff changeset
1594
kono
parents:
diff changeset
1595 #if __GTHREADS
kono
parents:
diff changeset
1596 {
kono
parents:
diff changeset
1597 static __gthread_once_t once_regsizes = __GTHREAD_ONCE_INIT;
kono
parents:
diff changeset
1598 if (__gthread_once (&once_regsizes, init_dwarf_reg_size_table) != 0
kono
parents:
diff changeset
1599 && dwarf_reg_size_table[0] == 0)
kono
parents:
diff changeset
1600 init_dwarf_reg_size_table ();
kono
parents:
diff changeset
1601 }
kono
parents:
diff changeset
1602 #else
kono
parents:
diff changeset
1603 if (dwarf_reg_size_table[0] == 0)
kono
parents:
diff changeset
1604 init_dwarf_reg_size_table ();
kono
parents:
diff changeset
1605 #endif
kono
parents:
diff changeset
1606
kono
parents:
diff changeset
1607 /* Force the frame state to use the known cfa value. */
kono
parents:
diff changeset
1608 _Unwind_SetSpColumn (context, outer_cfa, &sp_slot);
kono
parents:
diff changeset
1609 fs.regs.cfa_how = CFA_REG_OFFSET;
kono
parents:
diff changeset
1610 fs.regs.cfa_reg = __builtin_dwarf_sp_column ();
kono
parents:
diff changeset
1611 fs.regs.cfa_offset = 0;
kono
parents:
diff changeset
1612
kono
parents:
diff changeset
1613 uw_update_context_1 (context, &fs);
kono
parents:
diff changeset
1614
kono
parents:
diff changeset
1615 /* If the return address column was saved in a register in the
kono
parents:
diff changeset
1616 initialization context, then we can't see it in the given
kono
parents:
diff changeset
1617 call frame data. So have the initialization context tell us. */
kono
parents:
diff changeset
1618 context->ra = __builtin_extract_return_addr (outer_ra);
kono
parents:
diff changeset
1619 #ifdef MD_POST_EXTRACT_ROOT_ADDR
kono
parents:
diff changeset
1620 context->ra = MD_POST_EXTRACT_ROOT_ADDR (context->ra);
kono
parents:
diff changeset
1621 #endif
kono
parents:
diff changeset
1622 }
kono
parents:
diff changeset
1623
kono
parents:
diff changeset
1624 static void _Unwind_DebugHook (void *, void *)
kono
parents:
diff changeset
1625 __attribute__ ((__noinline__, __used__, __noclone__));
kono
parents:
diff changeset
1626
kono
parents:
diff changeset
1627 /* This function is called during unwinding. It is intended as a hook
kono
parents:
diff changeset
1628 for a debugger to intercept exceptions. CFA is the CFA of the
kono
parents:
diff changeset
1629 target frame. HANDLER is the PC to which control will be
kono
parents:
diff changeset
1630 transferred. */
kono
parents:
diff changeset
1631 static void
kono
parents:
diff changeset
1632 _Unwind_DebugHook (void *cfa __attribute__ ((__unused__)),
kono
parents:
diff changeset
1633 void *handler __attribute__ ((__unused__)))
kono
parents:
diff changeset
1634 {
kono
parents:
diff changeset
1635 /* We only want to use stap probes starting with v3. Earlier
kono
parents:
diff changeset
1636 versions added too much startup cost. */
kono
parents:
diff changeset
1637 #if defined (HAVE_SYS_SDT_H) && defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3
kono
parents:
diff changeset
1638 STAP_PROBE2 (libgcc, unwind, cfa, handler);
kono
parents:
diff changeset
1639 #else
kono
parents:
diff changeset
1640 asm ("");
kono
parents:
diff changeset
1641 #endif
kono
parents:
diff changeset
1642 }
kono
parents:
diff changeset
1643
kono
parents:
diff changeset
1644 /* Frob exception handler's address kept in TARGET before installing into
kono
parents:
diff changeset
1645 CURRENT context. */
kono
parents:
diff changeset
1646
kono
parents:
diff changeset
1647 static inline void *
kono
parents:
diff changeset
1648 uw_frob_return_addr (struct _Unwind_Context *current
kono
parents:
diff changeset
1649 __attribute__ ((__unused__)),
kono
parents:
diff changeset
1650 struct _Unwind_Context *target)
kono
parents:
diff changeset
1651 {
kono
parents:
diff changeset
1652 void *ret_addr = __builtin_frob_return_addr (target->ra);
kono
parents:
diff changeset
1653 #ifdef MD_POST_FROB_EH_HANDLER_ADDR
kono
parents:
diff changeset
1654 ret_addr = MD_POST_FROB_EH_HANDLER_ADDR (current, target, ret_addr);
kono
parents:
diff changeset
1655 #endif
kono
parents:
diff changeset
1656 return ret_addr;
kono
parents:
diff changeset
1657 }
kono
parents:
diff changeset
1658
kono
parents:
diff changeset
1659 /* Install TARGET into CURRENT so that we can return to it. This is a
kono
parents:
diff changeset
1660 macro because __builtin_eh_return must be invoked in the context of
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1661 our caller. FRAMES is a number of frames to be unwind.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1662 _Unwind_Frames_Extra is a macro to do additional work during unwinding
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1663 if needed, for example shadow stack pointer adjustment for Intel CET
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1664 technology. */
111
kono
parents:
diff changeset
1665
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1666 #define uw_install_context(CURRENT, TARGET, FRAMES) \
111
kono
parents:
diff changeset
1667 do \
kono
parents:
diff changeset
1668 { \
kono
parents:
diff changeset
1669 long offset = uw_install_context_1 ((CURRENT), (TARGET)); \
kono
parents:
diff changeset
1670 void *handler = uw_frob_return_addr ((CURRENT), (TARGET)); \
kono
parents:
diff changeset
1671 _Unwind_DebugHook ((TARGET)->cfa, handler); \
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1672 _Unwind_Frames_Extra (FRAMES); \
111
kono
parents:
diff changeset
1673 __builtin_eh_return (offset, handler); \
kono
parents:
diff changeset
1674 } \
kono
parents:
diff changeset
1675 while (0)
kono
parents:
diff changeset
1676
kono
parents:
diff changeset
1677 static long
kono
parents:
diff changeset
1678 uw_install_context_1 (struct _Unwind_Context *current,
kono
parents:
diff changeset
1679 struct _Unwind_Context *target)
kono
parents:
diff changeset
1680 {
kono
parents:
diff changeset
1681 long i;
kono
parents:
diff changeset
1682 _Unwind_SpTmp sp_slot;
kono
parents:
diff changeset
1683
kono
parents:
diff changeset
1684 /* If the target frame does not have a saved stack pointer,
kono
parents:
diff changeset
1685 then set up the target's CFA. */
kono
parents:
diff changeset
1686 if (!_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ()))
kono
parents:
diff changeset
1687 _Unwind_SetSpColumn (target, target->cfa, &sp_slot);
kono
parents:
diff changeset
1688
kono
parents:
diff changeset
1689 for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__; ++i)
kono
parents:
diff changeset
1690 {
kono
parents:
diff changeset
1691 void *c = (void *) (_Unwind_Internal_Ptr) current->reg[i];
kono
parents:
diff changeset
1692 void *t = (void *) (_Unwind_Internal_Ptr)target->reg[i];
kono
parents:
diff changeset
1693
kono
parents:
diff changeset
1694 gcc_assert (current->by_value[i] == 0);
kono
parents:
diff changeset
1695 if (target->by_value[i] && c)
kono
parents:
diff changeset
1696 {
kono
parents:
diff changeset
1697 _Unwind_Word w;
kono
parents:
diff changeset
1698 _Unwind_Ptr p;
kono
parents:
diff changeset
1699 if (dwarf_reg_size_table[i] == sizeof (_Unwind_Word))
kono
parents:
diff changeset
1700 {
kono
parents:
diff changeset
1701 w = (_Unwind_Internal_Ptr) t;
kono
parents:
diff changeset
1702 memcpy (c, &w, sizeof (_Unwind_Word));
kono
parents:
diff changeset
1703 }
kono
parents:
diff changeset
1704 else
kono
parents:
diff changeset
1705 {
kono
parents:
diff changeset
1706 gcc_assert (dwarf_reg_size_table[i] == sizeof (_Unwind_Ptr));
kono
parents:
diff changeset
1707 p = (_Unwind_Internal_Ptr) t;
kono
parents:
diff changeset
1708 memcpy (c, &p, sizeof (_Unwind_Ptr));
kono
parents:
diff changeset
1709 }
kono
parents:
diff changeset
1710 }
kono
parents:
diff changeset
1711 else if (t && c && t != c)
kono
parents:
diff changeset
1712 memcpy (c, t, dwarf_reg_size_table[i]);
kono
parents:
diff changeset
1713 }
kono
parents:
diff changeset
1714
kono
parents:
diff changeset
1715 /* If the current frame doesn't have a saved stack pointer, then we
kono
parents:
diff changeset
1716 need to rely on EH_RETURN_STACKADJ_RTX to get our target stack
kono
parents:
diff changeset
1717 pointer value reloaded. */
kono
parents:
diff changeset
1718 if (!_Unwind_GetGRPtr (current, __builtin_dwarf_sp_column ()))
kono
parents:
diff changeset
1719 {
kono
parents:
diff changeset
1720 void *target_cfa;
kono
parents:
diff changeset
1721
kono
parents:
diff changeset
1722 target_cfa = _Unwind_GetPtr (target, __builtin_dwarf_sp_column ());
kono
parents:
diff changeset
1723
kono
parents:
diff changeset
1724 /* We adjust SP by the difference between CURRENT and TARGET's CFA. */
kono
parents:
diff changeset
1725 if (__LIBGCC_STACK_GROWS_DOWNWARD__)
kono
parents:
diff changeset
1726 return target_cfa - current->cfa + target->args_size;
kono
parents:
diff changeset
1727 else
kono
parents:
diff changeset
1728 return current->cfa - target_cfa - target->args_size;
kono
parents:
diff changeset
1729 }
kono
parents:
diff changeset
1730 return 0;
kono
parents:
diff changeset
1731 }
kono
parents:
diff changeset
1732
kono
parents:
diff changeset
1733 static inline _Unwind_Ptr
kono
parents:
diff changeset
1734 uw_identify_context (struct _Unwind_Context *context)
kono
parents:
diff changeset
1735 {
kono
parents:
diff changeset
1736 /* The CFA is not sufficient to disambiguate the context of a function
kono
parents:
diff changeset
1737 interrupted by a signal before establishing its frame and the context
kono
parents:
diff changeset
1738 of the signal itself. */
kono
parents:
diff changeset
1739 if (__LIBGCC_STACK_GROWS_DOWNWARD__)
kono
parents:
diff changeset
1740 return _Unwind_GetCFA (context) - _Unwind_IsSignalFrame (context);
kono
parents:
diff changeset
1741 else
kono
parents:
diff changeset
1742 return _Unwind_GetCFA (context) + _Unwind_IsSignalFrame (context);
kono
parents:
diff changeset
1743 }
kono
parents:
diff changeset
1744
kono
parents:
diff changeset
1745
kono
parents:
diff changeset
1746 #include "unwind.inc"
kono
parents:
diff changeset
1747
kono
parents:
diff changeset
1748 #if defined (USE_GAS_SYMVER) && defined (SHARED) && defined (USE_LIBUNWIND_EXCEPTIONS)
kono
parents:
diff changeset
1749 alias (_Unwind_Backtrace);
kono
parents:
diff changeset
1750 alias (_Unwind_DeleteException);
kono
parents:
diff changeset
1751 alias (_Unwind_FindEnclosingFunction);
kono
parents:
diff changeset
1752 alias (_Unwind_ForcedUnwind);
kono
parents:
diff changeset
1753 alias (_Unwind_GetDataRelBase);
kono
parents:
diff changeset
1754 alias (_Unwind_GetTextRelBase);
kono
parents:
diff changeset
1755 alias (_Unwind_GetCFA);
kono
parents:
diff changeset
1756 alias (_Unwind_GetGR);
kono
parents:
diff changeset
1757 alias (_Unwind_GetIP);
kono
parents:
diff changeset
1758 alias (_Unwind_GetLanguageSpecificData);
kono
parents:
diff changeset
1759 alias (_Unwind_GetRegionStart);
kono
parents:
diff changeset
1760 alias (_Unwind_RaiseException);
kono
parents:
diff changeset
1761 alias (_Unwind_Resume);
kono
parents:
diff changeset
1762 alias (_Unwind_Resume_or_Rethrow);
kono
parents:
diff changeset
1763 alias (_Unwind_SetGR);
kono
parents:
diff changeset
1764 alias (_Unwind_SetIP);
kono
parents:
diff changeset
1765 #endif
kono
parents:
diff changeset
1766
kono
parents:
diff changeset
1767 #endif /* !USING_SJLJ_EXCEPTIONS */