Hi,
I was working on some cfi pre-processing for systemtap and noticed the
following things in the elfutils/libdw cfi interface.
- dwarf_next_cfi () has the following comment:
"On success, returns 0 and fills in *ENTRY; use dwarf_cfi_cie_p to
see whether ENTRY->cie or ENTRY->fde is valid."
But dwarf_cfi_cie_p is only defined in the private cfi.h header.
- There is dwarf_next_cfi () which you can use to walk through the raw
section data, which gives you a Dwarf_CFI_Entry. And there is
dwarf_cfi_addrframe () which you can use to query an address for the
corresponding Dwarf_Frame for an address. Ideally I would like to
get a dwarf_cfi_frame_next () to walk through all the FDEs. And
something like a dwarf_frame_cie () and dwarf_frame_fde () that
provided the info in the the cfi.h dwarf_cie and dwarf_fde structs.
This is probably a bit specific to the systemtap use case, where we
want to preprocess the frame data. But I think it could be useful
in other cases.
- readelf cannot show eh_frame[_hdr] for binaries with separate
debuginfo files. This is somewhat inconvenient. binutils readelf
can show --debug-dump=frames in that case, but the elfutils readelf
output is nicer.
- gcc outputs an identical CIE over and over again. The .debug_frame
section of my vmlinux debuginfo image contains 1000+ identical CIEs.
Maybe gcc can be changed to keep track of CIEs it already created so
FDEs can all reference the same one. If not, it might be an easy
target for the dwarf compressor.
Cheers,
Mark