Mercurial > hg > CbC > CbC_gcc
comparison libgcc/unwind-dw2.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* DWARF2 exception handling and frame unwind runtime interface routines. | 1 /* DWARF2 exception handling and frame unwind runtime interface routines. |
2 Copyright (C) 1997-2017 Free Software Foundation, Inc. | 2 Copyright (C) 1997-2018 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify it | 6 GCC is free software; you can redistribute it and/or modify it |
7 under the terms of the GNU General Public License as published by | 7 under the terms of the GNU General Public License as published by |
214 { | 214 { |
215 return (ASSUME_EXTENDED_UNWIND_CONTEXT | 215 return (ASSUME_EXTENDED_UNWIND_CONTEXT |
216 || (context->flags & EXTENDED_CONTEXT_BIT)); | 216 || (context->flags & EXTENDED_CONTEXT_BIT)); |
217 } | 217 } |
218 | 218 |
219 /* Get the value of register INDEX as saved in CONTEXT. */ | 219 /* Get the value of register REGNO as saved in CONTEXT. */ |
220 | 220 |
221 inline _Unwind_Word | 221 inline _Unwind_Word |
222 _Unwind_GetGR (struct _Unwind_Context *context, int index) | 222 _Unwind_GetGR (struct _Unwind_Context *context, int regno) |
223 { | 223 { |
224 int size; | 224 int size, index; |
225 _Unwind_Context_Reg_Val val; | 225 _Unwind_Context_Reg_Val val; |
226 | 226 |
227 #ifdef DWARF_ZERO_REG | 227 #ifdef DWARF_ZERO_REG |
228 if (index == DWARF_ZERO_REG) | 228 if (index == DWARF_ZERO_REG) |
229 return 0; | 229 return 0; |
230 #endif | 230 #endif |
231 | 231 |
232 index = DWARF_REG_TO_UNWIND_COLUMN (index); | 232 index = DWARF_REG_TO_UNWIND_COLUMN (regno); |
233 gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); | 233 gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); |
234 size = dwarf_reg_size_table[index]; | 234 size = dwarf_reg_size_table[index]; |
235 val = context->reg[index]; | 235 val = context->reg[index]; |
236 | 236 |
237 if (_Unwind_IsExtendedContext (context) && context->by_value[index]) | 237 if (_Unwind_IsExtendedContext (context) && context->by_value[index]) |
238 return _Unwind_Get_Unwind_Word (val); | 238 return _Unwind_Get_Unwind_Word (val); |
239 | |
240 #ifdef DWARF_LAZY_REGISTER_VALUE | |
241 { | |
242 _Unwind_Word value; | |
243 if (DWARF_LAZY_REGISTER_VALUE (regno, &value)) | |
244 return value; | |
245 } | |
246 #endif | |
239 | 247 |
240 /* This will segfault if the register hasn't been saved. */ | 248 /* This will segfault if the register hasn't been saved. */ |
241 if (size == sizeof(_Unwind_Ptr)) | 249 if (size == sizeof(_Unwind_Ptr)) |
242 return * (_Unwind_Ptr *) (_Unwind_Internal_Ptr) val; | 250 return * (_Unwind_Ptr *) (_Unwind_Internal_Ptr) val; |
243 else | 251 else |
1642 return ret_addr; | 1650 return ret_addr; |
1643 } | 1651 } |
1644 | 1652 |
1645 /* Install TARGET into CURRENT so that we can return to it. This is a | 1653 /* Install TARGET into CURRENT so that we can return to it. This is a |
1646 macro because __builtin_eh_return must be invoked in the context of | 1654 macro because __builtin_eh_return must be invoked in the context of |
1647 our caller. */ | 1655 our caller. FRAMES is a number of frames to be unwind. |
1648 | 1656 _Unwind_Frames_Extra is a macro to do additional work during unwinding |
1649 #define uw_install_context(CURRENT, TARGET) \ | 1657 if needed, for example shadow stack pointer adjustment for Intel CET |
1658 technology. */ | |
1659 | |
1660 #define uw_install_context(CURRENT, TARGET, FRAMES) \ | |
1650 do \ | 1661 do \ |
1651 { \ | 1662 { \ |
1652 long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ | 1663 long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ |
1653 void *handler = uw_frob_return_addr ((CURRENT), (TARGET)); \ | 1664 void *handler = uw_frob_return_addr ((CURRENT), (TARGET)); \ |
1654 _Unwind_DebugHook ((TARGET)->cfa, handler); \ | 1665 _Unwind_DebugHook ((TARGET)->cfa, handler); \ |
1666 _Unwind_Frames_Extra (FRAMES); \ | |
1655 __builtin_eh_return (offset, handler); \ | 1667 __builtin_eh_return (offset, handler); \ |
1656 } \ | 1668 } \ |
1657 while (0) | 1669 while (0) |
1658 | 1670 |
1659 static long | 1671 static long |