Skip to main content

Crate lsda

Crate lsda 

Source
Expand description

lsda is a library for reading and writing the language-specific data area (LSDA) of GCC-compatible exception handling, as stored in the .gcc_except_table section.

An LSDA describes, for one function, which call sites may throw, where their landing pads are, and which exception types each landing pad handles. The personality routine (such as __gxx_personality_v0) finds it through the L augmentation of the function’s FDE in .eh_frame, or, on Arm, at the end of the function’s .ARM.extab entry.

The format has no standalone specification. It is defined by its producers and consumers, which this crate follows:

  • GCC gcc/except.cc (output_one_function_exception_table), the original producer;
  • libstdc++ libsupc++/eh_personality.cc and libgcc unwind-pe.h, the reference consumer, including its Arm EHABI and SJLJ variants;
  • LLVM CodeGen/AsmPrinter/EHStreamer.cpp and libc++abi cxa_personality.cpp.

Pointer encodings are the DW_EH_PE_* values of the Linux Standard Base Core Specification 5.0, “Exception Frames”.

The API is organised as follows:

The read and write module documentation each start with a complete example.

§Cargo features

  • read (default): the read module.
  • write (default): the write module.
  • fallible-iterator: implement fallible_iterator::FallibleIterator for the iterators.

The crate is no_std and requires alloc. The error types implement core::error::Error.

Modules§

constants
Constant definitions.
leb128
LEB128 encoding, as used throughout the LSDA.
readread
Read LSDAs from .gcc_except_table (or .ARM.extab).
writewrite
Write LSDAs to .gcc_except_table.

Structs§

BaseAddresses
The base addresses that relative pointer encodings are resolved against.
BigEndian
Big endian byte order.
Encoding
A DW_EH_PE_* pointer encoding.
Format
The target properties needed to parse or write an LSDA.
LittleEndian
Little endian byte order.
LsdaOffset
An offset into the section that holds the LSDAs.

Enums§

Base
One of the base addresses in BaseAddresses.
RunTimeEndian
Byte order that is selectable at runtime.
Unwinder
The unwinder that the tables are used with.

Traits§

Endianity
A trait describing the endianity of some buffer.

Type Aliases§

NativeEndianLittle-endian
The native endianity for the target platform.