Linux Standard Base Core Specification 3.1 | ||
---|---|---|
<<< Previous | Chapter 11. Object Format | Next >>> |
When using languages that support exceptions, such as C++, additional information must be provided to the runtime environment that describes the call frames that must be unwound during the processing of an exception. This information is contained in the special sections .eh_frame and .eh_framehdr.
Note: The format of the .eh_frame section is similar in format and purpose to the .debug_frame section which is specified in DWARF Debugging Information Format, Revision 3.0.0 (Draft). Readers are advised that there are some subtle difference, and care should be taken when comparing the two sections.
The .eh_frame section shall contain 1 or more Call Frame Information (CFI) records. The number of records present shall be determined by size of the section as contained in the section header. Each CFI record contains a Common Information Entry (CIE) record followed by 1 or more Frame Description Entry (FDE) records. Both CIEs and FDEs shall be aligned to an addressing unit sized boundary.
Table 11-8. Call Frame Information Format
Common Information Entry Record |
Frame Description Entry Record(s) |
Table 11-9. Common Information Entry Format
Length | Required |
Extended Length | Optional |
CIE ID | Required |
Version | Required |
Augmentation String | Required |
Code Alignment Factor | Required |
Data Alignment Factor | Required |
Return Address Register | Required |
Augmentation Data Length | Optional |
Augmentation Data | Optional |
Initial Instructions | Required |
Padding |
Length
A 4 byte unsigned value indicating the length in bytes of the CIE structure,
not including the Length
field itself. If
Length
contains the value 0xffffffff, then the
length is contained in the Extended Length
field.
If Length
contains the value 0, then this CIE shall
be considered a terminator and processing shall end.
Extended Length
A 8 byte unsigned value indicating the length in bytes of the CIE structure,
not including the Length
and
Extended Length
fields.
CIE ID
A 4 byte unsigned value that is used to distinguish CIE records from FDE records. This value shall always be 0, which indicates this record is a CIE.
Version
A 1 byte value that identifies the version number of the frame information structure. This value shall be 1.
Augmentation String
This value is a NUL terminated string that identifies the augmentation to the CIE or to the FDEs associated with this CIE. A zero length string indicates that no augmentation data is present. The augmentation string is case sensitive and shall be interpreted as described below.
Code Alignment Factor
An unsigned LEB128 encoded value that is factored out of all advance location instructions that are associated with this CIE or its FDEs. This value shall be multiplied by the delta argument of an adavance location instruction to obtain the new location value.
Data Alignment Factor
A signed LEB128 encoded value that is factored out of all offset instructions that are associated with this CIE or its FDEs. This value shall be multiplied by the register offset argument of an offset instruction to obtain the new offset value.
Augmentation Length
An unsigned LEB128 encoded value indicating the length in bytes of the Augmentation Data. This field is only present if the Augmentation String contains the character 'z'.
Augmentation Data
A block of data whose contents are defined by the contents of the Augmentation String as described below. This field is only present if the Augmentation String contains the character 'z'. The size of this data is given by the Augentation Length.
Initial Instructions
Initial set of Call Frame Instructions. The number of instructions is determined by the remaining space in the CIE record.
Padding
Extra bytes to align the CIE structure to an addressing unit size boundary.
The Agumentation String indicates the presence of some optional fields, and how those fields should be intepreted. This string is case sensitive. Each character in the augmentation string in the CIE can be interpreted as below:
Table 11-10. Frame Description Entry Format
Length | Required |
Extended Length | Optional |
CIE Pointer | Required |
PC Begin | Required |
PC Range | Required |
Augmentation Data Length | Optional |
Augmentation Data | Optional |
Call Frame Instructions | Required |
Padding |
Length
A 4 byte unsigned value indicating the length in bytes of the CIE structure,
not including the Length
field itself. If
Length
contains the value 0xffffffff, then the
length is contained the Extended Length
field.
If Length
contains the value 0, then this CIE shall
be considered a terminator and processing shall end.
Extended Length
A 8 byte unsigned value indicating the length in bytes of the CIE structure,
not including the Length
field itself.
CIE Pointer
A 4 byte unsigned value that when subtracted from the offset of the the CIE Pointer in the current FDE yields the offset of the start of the associated CIE. This value shall never be 0.
PC Begin
An encoded value that indicates the address of the initial location associated with this FDE. The encoding format is specified in the Augmentation Data.
PC Range
An absolute value that indicates the number of bytes of instructions associated with this FDE.
Augmentation Length
An unsigned LEB128 encoded value indicating the length in bytes of the Augmentation Data. This field is only present if the Augmentation String in the associated CIE contains the character 'z'.
Augmentation Data
A block of data whose contents are defined by the contents of the Augmentation String in the associated CIE as described above. This field is only present if the Augmentation String in the associated CIE contains the character 'z'. The size of this data is given by the Augentation Length.
Call Frame Instructions
A set of Call Frame Instructions.
Padding
Extra bytes to align the FDE structure to an addressing unit size boundary.
The .eh_frame_hdr section contains additional information about the .eh_frame section. A pointer to the start of the .eh_frame data, and optionally, a binary search table of pointers to the .eh_frame records are found in this section.
Data in this section is encoded according to Section 11.5.1.
Table 11-11. .eh_frame_hdr Section Format
Encoding | Field |
---|---|
unsigned byte | version |
unsigned byte | eh_frame_ptr_enc |
unsigned byte | fde_count_enc |
unsigned byte | table_enc |
encoded | eh_frame_ptr |
encoded | fde_count |
binary search table |
<<< Previous | Home | Next >>> |
DWARF Extensions | Up | Symbol Versioning |