> But there is dwarf_offdie, which you can feed a "raw" Dwarf_Off. So you > can iterate with dwarf_nextcu and get the actual Dwarf_Die through > dwarf_offdie. It would be convenient (at least for my little hacking > project) to have something similar for CFI. Something like: > > /* Compute what's known about a call frame for a FDE at a given offset. > Returns 0 for success or -1 for errors. > On success, *FRAME is a malloc'd pointer. */ > extern int dwarf_cfi_offframe (Dwarf_CFI *cache, Dwarf_Off offset, > Dwarf_Frame **frame) > __nonnull_attribute__ (3); > > If that makes sense, I could try to hack up something.
I'm not sure it does make sense. I guess I don't really understand what information you want to get out of this. An FDE is an artifact of the format, a set of PCs that is encoded together. The Dwarf_Frame represents the state at one particular PC value. So I can only guess what you mean this call would do. Is it the same as dwarf_cfi_addrframe called on the address that is the first PC value covered by the FDE at OFFSET? What information do you want to get out of that Dwarf_Frame? If you are interested in the PC bounds covered by the FDE, this is not a convenient way to get the upper bound, only the lower bound (i.e. if you had the internal struct dwarf_fde, only fde->start and not fde->end). The addresses you get from dwarf_frame_info are the bounds of what PC that Dwarf_Frame applies to. This is a subrange of the FDE's PC range, not the whole thing. You can then iterate through the whole FDE's CFI program by calling dwarf_cfi_addrframe again on the end address, until you get an error because you hit a hole--but you may well just be moving into the next FDE if it's immediately adjacent. You can only actually know the end of the FDE's range by decoding the bytes at Dwarf_FDE.start from your dwarf_next_cfi call, which requires looking up the CIE_pointer (possibly pointing later in the file after the FDE!) to grok its augmentation string so you know for sure how to decode the FDE's PC range. Thanks, Roland _______________________________________________ elfutils-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/elfutils-devel
