| 1 |
/* DWARF2 frame unwind data structure. |
| 2 |
Copyright (C) 1997-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 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 |
| 8 |
the Free Software Foundation; either version 3, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, but WITHOUT |
| 12 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 13 |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 14 |
License for more details. |
| 15 |
|
| 16 |
Under Section 7 of GPL version 3, you are granted additional |
| 17 |
permissions described in the GCC Runtime Library Exception, version |
| 18 |
3.1, as published by the Free Software Foundation. |
| 19 |
|
| 20 |
You should have received a copy of the GNU General Public License and |
| 21 |
a copy of the GCC Runtime Library Exception along with this program; |
| 22 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 23 |
<http://www.gnu.org/licenses/>. */ |
| 24 |
|
| 25 |
#include "md-unwind-def.h" |
| 26 |
|
| 27 |
enum register_rule |
| 28 |
{ |
| 29 |
REG_UNSAVED, |
| 30 |
REG_SAVED_OFFSET, |
| 31 |
REG_SAVED_REG, |
| 32 |
REG_SAVED_EXP, |
| 33 |
REG_SAVED_VAL_OFFSET, |
| 34 |
REG_SAVED_VAL_EXP, |
| 35 |
REG_ARCHEXT, /* Target specific extension. */ |
| 36 |
REG_UNDEFINED |
| 37 |
} __attribute__((packed)); |
| 38 |
|
| 39 |
/* The result of interpreting the frame unwind info for a frame. |
| 40 |
This is all symbolic at this point, as none of the values can |
| 41 |
be resolved until the target pc is located. */ |
| 42 |
typedef struct |
| 43 |
{ |
| 44 |
/* Each register save state can be described in terms of a CFA slot, |
| 45 |
another register, or a location expression. */ |
| 46 |
struct frame_state_reg_info |
| 47 |
{ |
| 48 |
struct { |
| 49 |
union { |
| 50 |
_Unwind_Word reg; |
| 51 |
_Unwind_Sword offset; |
| 52 |
const unsigned char *exp; |
| 53 |
} loc; |
| 54 |
} reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; |
| 55 |
enum register_rule how[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; |
| 56 |
|
| 57 |
enum { |
| 58 |
CFA_UNSET, |
| 59 |
CFA_REG_OFFSET, |
| 60 |
CFA_EXP |
| 61 |
} cfa_how : 8; |
| 62 |
|
| 63 |
/* Used to implement DW_CFA_remember_state. */ |
| 64 |
struct frame_state_reg_info *prev; |
| 65 |
|
| 66 |
/* The CFA can be described in terms of a reg+offset or a |
| 67 |
location expression. */ |
| 68 |
_Unwind_Sword cfa_offset; |
| 69 |
_Unwind_Word cfa_reg; |
| 70 |
const unsigned char *cfa_exp; |
| 71 |
|
| 72 |
/* Architecture extensions information from CIE/FDE. |
| 73 |
Note: this information has to be saved in struct frame_state_reg_info |
| 74 |
instead of _Unwind_FrameState as DW_CFA_restore_state has to be able to |
| 75 |
restore them. */ |
| 76 |
#if defined(MD_ARCH_FRAME_STATE_T) |
| 77 |
MD_ARCH_FRAME_STATE_T arch_fs; |
| 78 |
#endif |
| 79 |
} regs; |
| 80 |
|
| 81 |
/* The PC described by the current frame state. */ |
| 82 |
void *pc; |
| 83 |
|
| 84 |
/* The information we care about from the CIE/FDE. */ |
| 85 |
_Unwind_Personality_Fn personality; |
| 86 |
_Unwind_Sword data_align; |
| 87 |
_Unwind_Word code_align; |
| 88 |
_Unwind_Word retaddr_column; |
| 89 |
unsigned char fde_encoding; |
| 90 |
unsigned char lsda_encoding; |
| 91 |
unsigned char saw_z; |
| 92 |
unsigned char signal_frame; |
| 93 |
void *eh_ptr; |
| 94 |
} _Unwind_FrameState; |
| 95 |
|