template <class Elf = Elf<>>

class EhFrameHdr

Defined at line 85 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

The EhFrameHdr object acts like a container of PC, FDE pairs (Entry) giving

the vaddr of the corresponding FDE. Its `.find` method does binary search.

The API is otherwise also similar to `const std::map

<uintNN

_t, uintNN_t>`,

except that `operator[]` is an index rather than associative (use `.find`).

This object only handles the index table, not actually decoding FDEs. Once

an FDE is found in the table,

<elfldltl

/dwarf/cfi-entry.h> APIs decode it.

Note that the PT_GNU_EH_FRAME p_filesz only covers .eh_frame_hdr, not

.eh_frame. So the eh_frame_ptr (see below) and the FDE addresses in the

table will point outside the bounds of memory fetched (or bounded) just to

decode .eh_frame_hdr. They will both be in the same RODATA segment, so if

the entire segment is made accessible then both .eh_frame_hdr and entries it

locates can be gleaned from it can be accessed in a uniform manner.

Public Members

static const uint8_t kAddressSize

Public Methods

size_t size_bytes ()

This is the whole size occupied at the PT_GNU_EH_FRAME vaddr.

Defined at line 246 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

size_t size ()

The container-like methods act similarly to std::array

<value

_type, N>.

Defined at line 256 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

bool empty ()

Defined at line 260 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

iterator begin ()

Defined at line 262 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

iterator cbegin ()

Defined at line 263 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

iterator end ()

Defined at line 265 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

iterator cend ()

Defined at line 266 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

const value_type & operator[] (size_t idx)

Defined at line 268 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

iterator find (address_size_type pc)

This just does simple binary search. Note that entries identify only the

FDE's starting PC and not its PC limit, so this will "find" the last FDE

in the table for any PC that's above all the entries. The FDE itself must

be decoded to determine where its PC range ends. (Usually the EhFrameHdr

for a given module will only be searched for a PC already known to fall

within that module's vaddr bounds, so only PCs off the end of the last FDE

in alignment fill or code lacking CFI would "wrongly" report that FDE.)

Defined at line 277 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

address_size_type eh_frame_ptr ()

This is the vaddr of the start of the .eh_frame table. This is not really

needed since .eh_frame_hdr table entries have the vaddr of an FDE inside.

When the lookup table is omitted (empty() returns true), .eh_frame can be

searched linearly and will be terminated by an invalid CFI entry with zero

initial length (i.e. a lone zero uint32_t after the valid last entry).

Defined at line 286 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

template <class Diagnostics, typename... ErrorArgs, auto& memory>
bool Init (Diagnostics & diag, MemoryReader<address_size_type, std::byte, EhFrameHdrEncoding> auto & memory, const Phdr & phdr, ErrorArgs &&... error_args)

Initialize directly from the PT_GNU_EH_FRAME phdr.

Defined at line 290 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

template <class Diagnostics, typename... ErrorArgs, auto& memory>
bool Init (Diagnostics & diag, MemoryReader<address_size_type, std::byte, EhFrameHdrEncoding> auto & memory, address_size_type vaddr, ErrorArgs &&... error_args)

Initialize from .eh_frame_hdr data read from the vaddr via the Memory

object. The return value is propagated from the Diagnostics object.

Defined at line 299 of file ../../src/lib/elfldltl/include/lib/elfldltl/dwarf/eh-frame-hdr.h

Records