| Linux Standard Base Core Specification, Generic Part | ||
|---|---|---|
| <<< Previous | Chapter 10. 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, Version 4. 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 10-8. Call Frame Information Format
| Common Information Entry Record |
| Frame Description Entry Record(s) |
Table 10-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 |
LengthA 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 LengthA 8 byte unsigned value indicating the length in bytes of the CIE structure,
not including the Length and
Extended Length fields themselves.
This field is not present unless the Length field
contains the value 0xffffffff.
CIE IDA 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.
VersionA 1 byte value that identifies the version number of the frame information structure. This value shall be 1.
Augmentation StringThis 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 FactorAn 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 FactorA 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 LengthAn 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 DataA 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 InstructionsInitial set of Call Frame Instructions. The number of instructions is determined by the remaining space in the CIE record.
PaddingExtra 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 10-10. Frame Description Entry Format
| Length | Required |
| Extended Length | Optional |
| FDE Pointer | Required |
| PC Begin | Required |
| PC Range | Required |
| Augmentation Data Length | Optional |
| Augmentation Data | Optional |
| Call Frame Instructions | Required |
| Padding |
LengthA 4 byte unsigned value indicating the length in bytes of the FDE 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 FDE shall
be considered a terminator and processing shall end.
Extended LengthA 8 byte unsigned value indicating the length in bytes of the FDE structure,
not including the Length or
Extended Length field themselves.
This field is not present unless the Length field
contains the value 0xffffffff.
CIE PointerA 4 byte unsigned value that when subtracted from the offset of the CIE Pointer in the current FDE yields the offset of the start of the associated CIE. This value shall never be 0.
PC BeginAn encoded value that indicates the address of the initial location associated with this FDE. The encoding format is specified in the Augmentation Data.
PC RangeAn absolute value that indicates the number of bytes of instructions associated with this FDE.
Augmentation LengthAn 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 DataA 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 InstructionsA set of Call Frame Instructions.
PaddingExtra 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 10.5.1.
Table 10-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 |