1
/* libunwind - a platform-independent unwind library
2
Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
3
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
5
This file is part of libunwind.
7
Permission is hereby granted, free of charge, to any person obtaining
8
a copy of this software and associated documentation files (the
9
"Software"), to deal in the Software without restriction, including
10
without limitation the rights to use, copy, modify, merge, publish,
11
distribute, sublicense, and/or sell copies of the Software, and to
12
permit persons to whom the Software is furnished to do so, subject to
13
the following conditions:
15
The above copyright notice and this permission notice shall be
16
included in all copies or substantial portions of the Software.
18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
31
/* This header file defines the format of a DWARF exception-header
32
section (.eh_frame_hdr, pointed to by program-header
33
PT_GNU_EH_FRAME). The exception-header is self-describing in the
34
sense that the format of the addresses contained in it is expressed
35
as a one-byte type-descriptor called a "pointer-encoding" (PE).
37
The exception header encodes the address of the .eh_frame section
38
and optionally contains a binary search table for the
39
Frame Descriptor Entries (FDEs) in the .eh_frame. The contents of
40
.eh_frame has the format described by the DWARF v3 standard
41
(http://www.eagercon.com/dwarf/dwarf3std.htm), except that code
42
addresses may be encoded in different ways. Also, .eh_frame has
43
augmentations that allow encoding a language-specific data-area
44
(LSDA) pointer and a pointer to a personality-routine.
48
The Common Information Entry (CIE) associated with an FDE may
49
contain an augmentation string. Each character in this string has
50
a specific meaning and either one or two associated operands. The
51
operands are stored in an augmentation body which appears right
52
after the "return_address_register" member and before the
53
"initial_instructions" member. The operands appear in the order
54
in which the characters appear in the string. For example, if the
55
augmentation string is "zL", the operand for 'z' would be first in
56
the augmentation body and the operand for 'L' would be second.
57
The following characters are supported for the CIE augmentation
60
'z': The operand for this character is a uleb128 value that gives the
61
length of the CIE augmentation body, not counting the length
62
of the uleb128 operand itself. If present, this code must
63
appear as the first character in the augmentation body.
65
'L': Indicates that the FDE's augmentation body contains an LSDA
66
pointer. The operand for this character is a single byte
67
that specifies the pointer-encoding (PE) that is used for
70
'R': Indicates that the code-pointers (FDE members
71
"initial_location" and "address_range" and the operand for
72
DW_CFA_set_loc) in the FDE have a non-default encoding. The
73
operand for this character is a single byte that specifies
74
the pointer-encoding (PE) that is used for the
75
code-pointers. Note: the "address_range" member is always
76
encoded as an absolute value. Apart from that, the specified
77
FDE pointer-encoding applies.
79
'P': Indicates the presence of a personality routine (handler).
80
The first operand for this character specifies the
81
pointer-encoding (PE) that is used for the second operand,
82
which specifies the address of the personality routine.
84
If the augmentation string contains any other characters, the
85
remainder of the augmentation string should be ignored.
86
Furthermore, if the size of the augmentation body is unknown
87
(i.e., 'z' is not the first character of the augmentation string),
88
then the entire CIE as well all associated FDEs must be ignored.
90
A Frame Descriptor Entries (FDE) may contain an augmentation body
91
which, if present, appears right after the "address_range" member
92
and before the "instructions" member. The contents of this body
93
is implicitly defined by the augmentation string of the associated
94
CIE. The meaning of the characters in the CIE's augmentation
95
string as far as FDEs are concerned is as follows:
97
'z': The first operand in the FDE's augmentation body specifies
98
the total length of the augmentation body as a uleb128 (not
99
counting the length of the uleb128 operand itself).
101
'L': The operand for this character is an LSDA pointer, encoded
102
in the format specified by the corresponding operand in the
103
CIE's augmentation body.
107
#define DW_EH_VERSION 1 /* The version we're implementing */
109
struct dwarf_eh_frame_hdr
111
unsigned char version;
112
unsigned char eh_frame_ptr_enc;
113
unsigned char fde_count_enc;
114
unsigned char table_enc;
115
/* The rest of the header is variable-length and consists of the
118
encoded_t eh_frame_ptr;
122
encoded_t start_ip; // first address covered by this FDE
123
encoded_t fde_addr; // address of the FDE
125
binary_search_table[fde_count]; */
128
#endif /* dwarf_eh_h */