This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: problems parsing dwarf frame info on amd64 optimized code


Hi Richard,

sorry for being unclear. I will try again:
I am unwinding through -O optimized amd64 C code using the dwarf unwind info.
(gcc version 3.5.0 20040308)

First Frame:
The dwarf parser finds two rules in the CIE:
CFA_def_cfa r7+0x8           (rsp)
CFA_offset r16 at cfa-0x8  (return address)
and then in the FDE it finds:
...
CFA_def_cfa_offset <offset1>
When applying the rules I set
cfa1 = r7 + offset1
There is no rule for r7, so I was assuming r7 stays unchanged.

Second Frame:
CFA_def_cfa r7+0x8
CFA_offset r16 at cfa-0x8
...
CFA_def_cfa_offset <offset2>
Applying the rules gives
cfa2 = r7 + offset2
however this is incorrect, the actual value is
cfa2 = cfa1 + offset2

From this I infer that the assumption I made about r7 remaining unchanged 
when there is no rule for it is incorrect and what I really have to do is something
like:
Frame 1:
cfa1 = r7 + offset1
if (r7 unspecified)	r7 = cfa1
Frame 2:
cfa2 = r7 + offset2
....
Is this the correct approach or are there cases where it would fail?

thanks,
max


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