Dwarf_FDE (libdw)

Sasha Da Rocha Pinheiro darochapinhe@wisc.edu
Mon Jul 17 17:16:00 GMT 2017

So you're saying that the augmentation data of a FDE is the augmentation data of its CIE?
https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html says differently.

The thing is I need to get catch blocks, and eh_frame is not exactly Dwarf format. That's why I need FDE augmentation data also.
Libdw doesn't do this, am I correct?
From: Mark Wielaard <mark@klomp.org>
Sent: Monday, July 17, 2017 8:28:56 AM
To: Sasha Da Rocha Pinheiro
Cc: elfutils-devel@sourceware.org
Subject: Re: Dwarf_FDE (libdw)
On Mon, 2017-07-17 at 04:12 +0000, Sasha Da Rocha Pinheiro wrote:
> So how do you get the augmentation data out of a Dwarf_Frame?

You don't. You can only get the actual information relevant for the
frame through the augmentation data from the Dwarf_Frame. Is there
information missing you need?

> Or how do you "simulate" the two next functions as libdwarf do?
> dwarf_get_cie_augmentation_data
> dwarf_get_fde_augmentation_data

I don't know what those functions do precisely. But if you really want
to do something low level like get the CIE augmentation data you could
do it through dwarf_next_cfi and DWarf_CFI_entry:

Dwarf_CFI_Entry entry;
dwarf_next_cfi (e_ident, d, true|false, off, &next, &entry);

if (dwarf_cfi_cie_p (&entry))
     cie_aug = entry.cie.augmentation_data;
     cie_aug_size = entry.cie.augmentation_data_size;
    Dwarf_Off off = entry.fde.CIE_pointer;
    dwarf_next_cfi (e_ident, d, true|false, off, &next, &entry);
    assert (dwarf_cfi_cie_p (&entry));
    cie_aug = entry.cie.augmentation_data;
    cie_aug_size = entry.cie.augmentation_data_size;

Plus some error handling. If you then also want to get the FDE
augmentation data it is a bit more work since you'll have to decode the
FDE data yourself (based on the CIE augmentation data you now got).

But instead of trying to extract the exact encoding of the low level
data it is probably better to see how we can make all the information
you need available through Dwarf_Frames.



More information about the Elfutils-devel mailing list