UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
syms_unwind_elf_x64.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2/* date = September 28th 2021 9:35 am */
3
4#ifndef SYMS_UNWIND_ELF_X64_H
5#define SYMS_UNWIND_ELF_X64_H
6
8// NOTE(allen): Generated Code
9
11
13// NOTE(allen): ELF-x64 Unwind Types
14
15// EH: Exception Frames
16
18enum{
20 SYMS_DwEhPtrEnc_PTR = 0x00, // Pointer sized unsigned value
21 SYMS_DwEhPtrEnc_ULEB128 = 0x01, // Unsigned LE base-128 value
22 SYMS_DwEhPtrEnc_UDATA2 = 0x02, // Unsigned 16-bit value
23 SYMS_DwEhPtrEnc_UDATA4 = 0x03, // Unsigned 32-bit value
24 SYMS_DwEhPtrEnc_UDATA8 = 0x04, // Unsigned 64-bit value
25 SYMS_DwEhPtrEnc_SIGNED = 0x08, // Signed pointer
26 SYMS_DwEhPtrEnc_SLEB128 = 0x09, // Signed LE base-128 value
27 SYMS_DwEhPtrEnc_SDATA2 = 0x0A, // Signed 16-bit value
28 SYMS_DwEhPtrEnc_SDATA4 = 0x0B, // Signed 32-bit value
29 SYMS_DwEhPtrEnc_SDATA8 = 0x0C, // Signed 64-bit value
30};
31enum{
33 SYMS_DwEhPtrEnc_PCREL = 0x10, // Value is relative to the current program counter.
34 SYMS_DwEhPtrEnc_TEXTREL = 0x20, // Value is relative to the .text section.
35 SYMS_DwEhPtrEnc_DATAREL = 0x30, // Value is relative to the .got or .eh_frame_hdr section.
36 SYMS_DwEhPtrEnc_FUNCREL = 0x40, // Value is relative to the function.
37 SYMS_DwEhPtrEnc_ALIGNED = 0x50, // Value is aligned to an address unit sized boundary.
38};
39enum{
40 SYMS_DwEhPtrEnc_INDIRECT = 0x80, // This flag indicates that value is stored in virtual memory.
41
43};
44
45typedef struct SYMS_DwEhPtrCtx{
46 SYMS_U64 raw_base_vaddr; // address where pointer is being read
47 SYMS_U64 text_vaddr; // base address of section with instructions (used for encoding pointer on SH and IA64)
48 SYMS_U64 data_vaddr; // base address of data section (used for encoding pointer on x86-64)
49 SYMS_U64 func_vaddr; // base address of function where IP is located
51
52// CIE: Common Information Entry
70
76
77// FDE: Frame Description Entry
84
85// CFI: Call Frame Information
91
96
107
117
125
131
139
141enum{
143 // 1,2,4,8 reserved for literal byte sizes
147};
148
150enum{
157};
158
161
162// NOTE(allen): register codes for unwinding match the SYMS_DwRegX64 register codes
163#define SYMS_UNWIND_ELF_X64__REG_SLOT_COUNT 17
164
166// NOTE(allen): ELF-x64 Unwind Function
167
169 SYMS_MemoryView *memview, SYMS_U64 stack_pointer,
171
174 SYMS_MemoryView *memview, SYMS_U64 stack_pointer,
176
178// NOTE(allen): ELF-x64 Unwind Helper Functions
179
181
185
186//- eh_frame parsing
199 SYMS_DwEhPtrCtx *ptr_ctx,
201
202//- cfi machine
203
205 SYMS_DwEhPtrCtx *ptr_ctx);
207 SYMS_DwCFIRow *initial_row);
209 SYMS_U64 fde_ip);
210
214 SYMS_U64 cells_per_row);
215
219
220#endif //SYMS_UNWIND_ELF_X64_H
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
char * dst
Definition lz4.h:735
Definition syms_unwind_elf_x64.h:97
SYMS_S64 offset
Definition syms_unwind_elf_x64.h:102
SYMS_U64Range expr
Definition syms_unwind_elf_x64.h:104
SYMS_U64 reg_idx
Definition syms_unwind_elf_x64.h:101
SYMS_DwCFICFARule rule
Definition syms_unwind_elf_x64.h:98
Definition syms_unwind_elf_x64.h:118
SYMS_U64Range expr
Definition syms_unwind_elf_x64.h:122
SYMS_DwCFIRegisterRule rule
Definition syms_unwind_elf_x64.h:119
SYMS_S64 n
Definition syms_unwind_elf_x64.h:121
Definition syms_unwind_elf_x64.h:132
SYMS_U64 fde_ip
Definition syms_unwind_elf_x64.h:137
SYMS_DwCFIRow * initial_row
Definition syms_unwind_elf_x64.h:136
SYMS_U64 cells_per_row
Definition syms_unwind_elf_x64.h:133
SYMS_DwEhPtrCtx * ptr_ctx
Definition syms_unwind_elf_x64.h:135
SYMS_DwCIEUnpacked * cie
Definition syms_unwind_elf_x64.h:134
Definition syms_unwind_elf_x64.h:86
SYMS_DwFDEUnpacked fde
Definition syms_unwind_elf_x64.h:89
SYMS_DwCIEUnpacked cie
Definition syms_unwind_elf_x64.h:88
SYMS_B32 valid
Definition syms_unwind_elf_x64.h:87
Definition syms_unwind_elf_x64.h:126
SYMS_DwCFICFACell cfa_cell
Definition syms_unwind_elf_x64.h:129
SYMS_DwCFICell * cells
Definition syms_unwind_elf_x64.h:128
struct SYMS_DwCFIRow * next
Definition syms_unwind_elf_x64.h:127
Definition syms_unwind_elf_x64.h:71
SYMS_U64 offset
Definition syms_unwind_elf_x64.h:74
SYMS_DwCIEUnpacked cie
Definition syms_unwind_elf_x64.h:73
struct SYMS_DwCIEUnpackedNode * next
Definition syms_unwind_elf_x64.h:72
Definition syms_unwind_elf_x64.h:53
SYMS_S64 data_align_factor
Definition syms_unwind_elf_x64.h:63
SYMS_B8 has_augmentation_size
Definition syms_unwind_elf_x64.h:58
SYMS_DwEhPtrEnc lsda_encoding
Definition syms_unwind_elf_x64.h:55
SYMS_U8 version
Definition syms_unwind_elf_x64.h:54
SYMS_U64 code_align_factor
Definition syms_unwind_elf_x64.h:62
SYMS_U64 handler_ip
Definition syms_unwind_elf_x64.h:66
SYMS_String8 augmentation
Definition syms_unwind_elf_x64.h:60
SYMS_U64Range cfi_range
Definition syms_unwind_elf_x64.h:68
SYMS_U64 ret_addr_reg
Definition syms_unwind_elf_x64.h:64
SYMS_U64 augmentation_size
Definition syms_unwind_elf_x64.h:59
SYMS_DwEhPtrEnc addr_encoding
Definition syms_unwind_elf_x64.h:56
Definition syms_unwind_elf_x64.h:45
SYMS_U64 raw_base_vaddr
Definition syms_unwind_elf_x64.h:46
SYMS_U64 text_vaddr
Definition syms_unwind_elf_x64.h:47
SYMS_U64 data_vaddr
Definition syms_unwind_elf_x64.h:48
SYMS_U64 func_vaddr
Definition syms_unwind_elf_x64.h:49
Definition syms_unwind_elf_x64.h:78
SYMS_U64Range cfi_range
Definition syms_unwind_elf_x64.h:82
SYMS_U64 lsda_ip
Definition syms_unwind_elf_x64.h:80
SYMS_U64Range ip_voff_range
Definition syms_unwind_elf_x64.h:79
Definition syms_dwarf_expr.h:15
Definition syms_elf_parser.h:68
Definition syms_base.h:410
Definition syms_base.h:296
Definition syms_base.h:264
Definition syms_base.h:420
#define SYMS_API
Definition syms_base.h:29
SYMS_S32 SYMS_B32
Definition syms_base.h:99
SYMS_S8 SYMS_B8
Definition syms_base.h:97
#define SYMS_GLOBAL
Definition syms_base.h:42
uint64_t SYMS_U64
Definition syms_crt_overrides.h:39
uint16_t SYMS_U16
Definition syms_crt_overrides.h:37
int64_t SYMS_S64
Definition syms_crt_overrides.h:35
uint8_t SYMS_U8
Definition syms_crt_overrides.h:36
#define SYMS_Arena
Definition syms_default_arena.h:61
@ SYMS_DwCFADetail_OPL_KIND1
Definition syms_meta_dwarf_cfi.h:40
@ SYMS_DwCFADetail_OPL_KIND2
Definition syms_meta_dwarf_cfi.h:41
SYMS_API void syms_unwind_elf_x64__row_copy(SYMS_DwCFIRow *dst, SYMS_DwCFIRow *src, SYMS_U64 cells_per_row)
Definition syms_unwind_elf_x64.c:887
SYMS_U16 SYMS_DwCFAControlBits
Definition syms_unwind_elf_x64.h:149
SYMS_U8 SYMS_DwEhPtrEnc
Definition syms_unwind_elf_x64.h:17
SYMS_API void syms_unwind_elf_x64__init(void)
Definition syms_unwind_elf_x64.c:321
SYMS_API SYMS_DwCFIRecords syms_unwind_elf_x64__eh_frame_cfi_from_ip__sloppy(void *base, SYMS_U64Range range, SYMS_DwEhPtrCtx *ptr_ctx, SYMS_U64 ip_voff)
Definition syms_unwind_elf_x64.c:641
@ SYMS_DwEhPtrEnc_PCREL
Definition syms_unwind_elf_x64.h:33
@ SYMS_DwEhPtrEnc_MODIF_MASK
Definition syms_unwind_elf_x64.h:32
@ SYMS_DwEhPtrEnc_ALIGNED
Definition syms_unwind_elf_x64.h:37
@ SYMS_DwEhPtrEnc_DATAREL
Definition syms_unwind_elf_x64.h:35
@ SYMS_DwEhPtrEnc_FUNCREL
Definition syms_unwind_elf_x64.h:36
@ SYMS_DwEhPtrEnc_TEXTREL
Definition syms_unwind_elf_x64.h:34
SYMS_API SYMS_U64 syms_unwind_elf_x64__parse_pointer(void *base, SYMS_U64Range range, SYMS_DwEhPtrCtx *ptr_ctx, SYMS_DwEhPtrEnc ptr_enc, SYMS_U64 off, SYMS_U64 *ptr_out)
Definition syms_unwind_elf_x64.c:359
SYMS_API void syms_unwind_elf_x64__eh_frame_parse_fde(void *base, SYMS_U64Range range, SYMS_DwEhPtrCtx *ptr_ctx, SYMS_DwCIEUnpacked *parent_cie, SYMS_U64 off, SYMS_DwFDEUnpacked *fde_out)
Definition syms_unwind_elf_x64.c:585
@ SYMS_DwEhPtrEnc_SLEB128
Definition syms_unwind_elf_x64.h:26
@ SYMS_DwEhPtrEnc_SDATA8
Definition syms_unwind_elf_x64.h:29
@ SYMS_DwEhPtrEnc_UDATA2
Definition syms_unwind_elf_x64.h:22
@ SYMS_DwEhPtrEnc_SDATA4
Definition syms_unwind_elf_x64.h:28
@ SYMS_DwEhPtrEnc_UDATA8
Definition syms_unwind_elf_x64.h:24
@ SYMS_DwEhPtrEnc_TYPE_MASK
Definition syms_unwind_elf_x64.h:19
@ SYMS_DwEhPtrEnc_SDATA2
Definition syms_unwind_elf_x64.h:27
@ SYMS_DwEhPtrEnc_ULEB128
Definition syms_unwind_elf_x64.h:21
@ SYMS_DwEhPtrEnc_SIGNED
Definition syms_unwind_elf_x64.h:25
@ SYMS_DwEhPtrEnc_UDATA4
Definition syms_unwind_elf_x64.h:23
@ SYMS_DwEhPtrEnc_PTR
Definition syms_unwind_elf_x64.h:20
SYMS_GLOBAL SYMS_DwCFAControlBits syms_unwind_elf__cfa_control_bits_kind2[SYMS_DwCFADetail_OPL_KIND2+1]
Definition syms_unwind_elf_x64.h:160
SYMS_API SYMS_DwCFIRecords syms_unwind_elf_x64__eh_frame_hdr_from_ip(void *base, SYMS_U64Range eh_frame_hdr_range, SYMS_U64Range eh_frame_range, SYMS_DwEhPtrCtx *ptr_ctx, SYMS_U64 ip_voff)
Definition syms_unwind_elf_x64.c:794
SYMS_API SYMS_UnwindResult syms_unwind_elf_x64(SYMS_String8 bin_data, SYMS_ElfBinAccel *bin, SYMS_U64 bin_base, SYMS_MemoryView *memview, SYMS_U64 stack_pointer, SYMS_DwRegsX64 *regs_in_out)
Definition syms_unwind_elf_x64.c:15
SYMS_DwCFICFARule
Definition syms_unwind_elf_x64.h:92
@ SYMS_DwCFICFARule_REGOFF
Definition syms_unwind_elf_x64.h:93
@ SYMS_DwCFICFARule_EXPR
Definition syms_unwind_elf_x64.h:94
@ SYMS_DwEhPtrEnc_INDIRECT
Definition syms_unwind_elf_x64.h:40
@ SYMS_DwEhPtrEnc_OMIT
Definition syms_unwind_elf_x64.h:42
SYMS_U8 SYMS_DwCFADecode
Definition syms_unwind_elf_x64.h:140
SYMS_API void syms_unwind_elf_x64__machine_equip_fde_ip(SYMS_DwCFIMachine *machine, SYMS_U64 fde_ip)
Definition syms_unwind_elf_x64.c:869
SYMS_API SYMS_UnwindResult syms_unwind_elf_x64__apply_rules(SYMS_String8 bin_data, SYMS_DwCFIRow *row, SYMS_U64 text_base_vaddr, SYMS_MemoryView *memview, SYMS_U64 stack_pointer, SYMS_DwRegsX64 *regs_in_out)
Definition syms_unwind_elf_x64.c:145
SYMS_API void syms_unwind_elf_x64__machine_equip_initial_row(SYMS_DwCFIMachine *machine, SYMS_DwCFIRow *initial_row)
Definition syms_unwind_elf_x64.c:864
@ SYMS_DwCFADecode_ADDRESS
Definition syms_unwind_elf_x64.h:144
@ SYMS_DwCFADecode_SLEB128
Definition syms_unwind_elf_x64.h:146
@ SYMS_DwCFADecode_ULEB128
Definition syms_unwind_elf_x64.h:145
@ SYMS_DwCFADecode_NOP
Definition syms_unwind_elf_x64.h:142
SYMS_API SYMS_DwCFIMachine syms_unwind_elf_x64__machine_make(SYMS_U64 cells_per_row, SYMS_DwCIEUnpacked *cie, SYMS_DwEhPtrCtx *ptr_ctx)
Definition syms_unwind_elf_x64.c:855
SYMS_DwCFIRegisterRule
Definition syms_unwind_elf_x64.h:108
@ SYMS_DwCFIRegisterRule_UNDEFINED
Definition syms_unwind_elf_x64.h:110
@ SYMS_DwCFIRegisterRule_EXPRESSION
Definition syms_unwind_elf_x64.h:114
@ SYMS_DwCFIRegisterRule_REGISTER
Definition syms_unwind_elf_x64.h:113
@ SYMS_DwCFIRegisterRule_SAME_VALUE
Definition syms_unwind_elf_x64.h:109
@ SYMS_DwCFIRegisterRule_VAL_OFFSET
Definition syms_unwind_elf_x64.h:112
@ SYMS_DwCFIRegisterRule_VAL_EXPRESSION
Definition syms_unwind_elf_x64.h:115
@ SYMS_DwCFIRegisterRule_OFFSET
Definition syms_unwind_elf_x64.h:111
@ SYMS_DwCFAControlBits_NEW_ROW
Definition syms_unwind_elf_x64.h:156
@ SYMS_DwCFAControlBits_DEC2_MASK
Definition syms_unwind_elf_x64.h:152
@ SYMS_DwCFAControlBits_DEC1_MASK
Definition syms_unwind_elf_x64.h:151
@ SYMS_DwCFAControlBits_IS_REG_0
Definition syms_unwind_elf_x64.h:153
@ SYMS_DwCFAControlBits_IS_REG_1
Definition syms_unwind_elf_x64.h:154
@ SYMS_DwCFAControlBits_IS_REG_2
Definition syms_unwind_elf_x64.h:155
SYMS_API void syms_unwind_elf_x64__row_zero(SYMS_DwCFIRow *row, SYMS_U64 cells_per_row)
Definition syms_unwind_elf_x64.c:881
SYMS_API void syms_unwind_elf_x64__eh_frame_parse_cie(void *base, SYMS_U64Range range, SYMS_DwEhPtrCtx *ptr_ctx, SYMS_U64 off, SYMS_DwCIEUnpacked *cie_out)
Definition syms_unwind_elf_x64.c:453
SYMS_API SYMS_B32 syms_unwind_elf_x64__machine_run_to_ip(void *base, SYMS_U64Range range, SYMS_DwCFIMachine *machine, SYMS_U64 target_ip, SYMS_DwCFIRow *row_out)
Definition syms_unwind_elf_x64.c:894
SYMS_API SYMS_DwCFIRow * syms_unwind_elf_x64__row_alloc(SYMS_Arena *arena, SYMS_U64 cells_per_row)
Definition syms_unwind_elf_x64.c:874
SYMS_GLOBAL SYMS_DwCFAControlBits syms_unwind_elf__cfa_control_bits_kind1[SYMS_DwCFADetail_OPL_KIND1+1]
Definition syms_unwind_elf_x64.h:159