Hi

Bug in the specs or bug in the code?

I do not know, but one of this is wrong:

In the Linux Standard specs in
http://www.freestandards.org/spec/booksets/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
it is written in the specification of the FDE (Frame Description Entry) the following:

CIE Pointer

A 4 byte unsigned value that when subtracted from the offset of the current FDE yields the offset of the start of the associated CIE. This value shall never be 0.

So, the offset is from the beginning of the current FDE, the specs say....

BUT

What does the code say?
In the file unwind-dw2-fde.h we find:
/* Locate the CIE for a given FDE.  */

static inline const struct dwarf_cie *
get_cie (const struct dwarf_fde *f)
{
 return (void *)&f->CIE_delta - f->CIE_delta;
}

Note that the first term is &f->CIE_delta and NOT &f as specified by the standard.

This fact took me two days of work for finding it out. Either a bug in the code a bug in the specs. The difference is 4 bytes since CIE_delta comes after the length
field.

Please fix the specs, since if you fix the code everything will go crashing as my
program did...

jacob

Reply via email to