problems parsing dwarf frame info on amd64 optimized code
Max Asbock
masbock@us.ibm.com
Mon Mar 8 19:18:00 GMT 2004
Hi all,
I am trying to parse the dwarf frame info on amd64 using the dwarf parser
from libunwind which I had to slightly modify to run on amd64.
The parser works correctly in unoptimized code that uses frame pointers.
When I turn on the -O flag things fall apart. This is with gcc 3.2.2.
The 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 <offset>
...
This works for stepping from the first frame to the second, but
on the next step it fails, since the CFA is read again from r7 (rsp)
which hasn't changed. And it seems that the CFA <offset> is the
offset relative to the current CFA, not relative to the value in rsp.
I hope I am making sense. I am not a gcc nor a dwarf expert, so
I don't really know if the compiler is generating the correct dwarf info
and the parser needs to do something different or the other way
around.
Any help or hints would be greatly appreciated.
regards,
max
More information about the Gcc
mailing list