dwarf_frame.h
3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
dwarf_frame.h
$Revision: 1.1.1.1 $ $Date: 2002/05/02 03:29:20 $
*/
#define DW_DEBUG_FRAME_VERSION 1
#define DW_DEBUG_FRAME_AUGMENTER_STRING "mti v1"
/* The value of the offset field for Cie's. */
#define DW_CIE_OFFSET ~(0x0)
/* The augmentation string may be NULL. */
#define DW_EMPTY_STRING ""
#define DW_FRAME_INSTR_OPCODE_SHIFT 6
#define DW_FRAME_INSTR_OFFSET_MASK 0x3f
/*
This struct denotes the rule for a register in a row of
the frame table. In other words, it is one element of
the table.
*/
struct Dwarf_Reg_Rule_s {
/*
Is a flag indicating whether the rule includes
the offset field, ie whether the ru_offset field
is valid or not. Actually not sure that it is
needed since the offset is always additive, and
no offset is the same as a 0 offset.
Guess needed mostly for dwarf_get_fde_info_for_reg().
*/
Dwarf_Sbyte ru_is_off;
/* Register involved in this rule. */
Dwarf_Half ru_register;
/* Offset to add to register, if indicated by ru_is_offset. */
Dwarf_Addr ru_offset;
};
typedef struct Dwarf_Frame_s *Dwarf_Frame;
/*
This structure represents a row of the frame table.
Fr_loc is the pc value for this row, and Fr_reg
contains the rule for each column.
*/
struct Dwarf_Frame_s {
/* Pc value corresponding to this row of the frame table. */
Dwarf_Addr fr_loc;
/* Rules for all the registers in this row. */
struct Dwarf_Reg_Rule_s fr_reg[DW_FRAME_LAST_REG_NUM];
Dwarf_Frame fr_next;
};
typedef struct Dwarf_Frame_Op_List_s *Dwarf_Frame_Op_List;
/* This is used to chain together Dwarf_Frame_Op structures. */
struct Dwarf_Frame_Op_List_s {
Dwarf_Frame_Op *fl_frame_instr;
Dwarf_Frame_Op_List fl_next;
};
/*
This structure contains all the pertinent info for a Cie. Most
of the fields are taken straight from the definition of a Cie.
Ci_cie_start points to the address (in .debug_frame) where this
Cie begins. Ci_cie_instr_start points to the first byte of the
frame instructions for this Cie. Ci_dbg points to the associated
Dwarf_Debug structure. Ci_initial_table is a pointer to the table
row generated by the instructions for this Cie.
*/
struct Dwarf_Cie_s {
Dwarf_Word ci_length;
char *ci_augmentation;
Dwarf_Small ci_code_alignment_factor;
Dwarf_Sbyte ci_data_alignment_factor;
Dwarf_Small ci_return_address_register;
Dwarf_Small *ci_cie_start;
Dwarf_Small *ci_cie_instr_start;
Dwarf_Debug ci_dbg;
Dwarf_Frame ci_initial_table;
Dwarf_Cie ci_next;
};
/*
This structure contains all the pertinent info for a Fde.
Most of the fields are taken straight from the definition.
fd_cie_index is the index of the Cie associated with this
Fde in the list of Cie's for this debug_frame. Fd_cie
points to the corresponsing Dwarf_Cie structure. Fd_fde_start
points to the start address of the Fde. Fd_fde_instr_start
points to the start of the instructions for this Fde. Fd_dbg
points to the associated Dwarf_Debug structure.
*/
struct Dwarf_Fde_s {
Dwarf_Word fd_length;
Dwarf_Addr fd_cie_offset;
Dwarf_Sword fd_cie_index;
Dwarf_Cie fd_cie;
Dwarf_Addr fd_initial_location;
Dwarf_Small *fd_initial_loc_pos;
Dwarf_Addr fd_address_range;
Dwarf_Small *fd_fde_start;
Dwarf_Small *fd_fde_instr_start;
Dwarf_Debug fd_dbg;
Dwarf_Fde fd_next;
};
/* These error codes are very specific to debug_frame
but they should probably be moved into dwarf_error.h
*/
#define DF_NO_CIE_AUGMENTATION -1
#define DF_REG_NUM_TOO_HIGH -2
#define DF_MAKE_INSTR_NO_INIT -3
#define DF_NEW_LOC_LESS_OLD_LOC -4
#define DF_POP_EMPTY_STACK -5
#define DF_ALLOC_FAIL -6
#define DF_FRAME_DECODING_ERROR -7
int
_dwarf_frame_address_offsets(Dwarf_Debug dbg,Dwarf_Addr **addrlist,
Dwarf_Off **offsetlist,Dwarf_Signed *returncount,
Dwarf_Error *err);