This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Some elfutils/libdw/cfi comments


On Wed, 2010-06-16 at 03:42 -0700, Roland McGrath wrote:
> Look at the new branch roland/dwarf_cfi_validate_fde.
> Roll your own declaration and tell me if that meets your needs.

Thanks for:

/* Look up the FDE described at OFFSET bytes into the CFI section,
   and validate it by decoding the FDE fully.  Returns -1 for errors.
   On success, returns the maximum DWARF register number that this
   FDE describes and fills *START and *END with the PC address range
   this FDE covers, *SIGNALP with whether this is a signal frame, and
   *ENCODING with the pointer encoding used in this FDE.  This is not
   necessarily the exact encoding byte given in the augmentation string;
   it will describe the exact address size used (DW_EH_PE_udata4 or
   DW_EH_PE_udata8) if a DW_EH_PE_absptr encoding is being used.  */
extern int dwarf_cfi_validate_fde (Dwarf_CFI *cache,
                                   Dwarf_Off offset,
                                   Dwarf_Addr *start, Dwarf_Addr *end,
                                   bool *signalp, uint8_t *encoding);

This seems very useful for the "is this cfi data useful/not bogus" case.
This also allows for creating a search table independent of whether the
cfi table is debug or eh frame data (and independent from the encoding).

I am not completely clear on why the encoding is given as udata4/8
instead of the actual encoding in use. While it is useful to ensure that
the addresses used are all sane according to the arch used. But it seems
more useful to have the actual encoding (also).

The reason I like to know the actual encoding is because then I can
decide whether or not using an FDE might require extra pointer decoding
or not.

One use case that isn't easily possible with this interface is rewriting
the FDEs/CIEs. For example for filtering out duplicate CIEs, or
reencoding the address encoding used.

If that is not out of scope, then for that it would be nice to also get
the actual Dwarf_CIE referenced by the FDE (so the caller doesn't have
to cache that themselves), and having the FDE augmentation and
instructions data pointers plus sizes being returned by the function.

Thanks,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]