Dwarf_FDE (libdw)

Mark Wielaard mark@klomp.org
Mon Jul 17 13:29:00 GMT 2017


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;
  }
else
  {
    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.

Cheers,

Mark



More information about the Elfutils-devel mailing list