March 15, 2011
I spend some time trying to get dwarf running for 64 bit.
There are two reasons this currently doesn't work.
The simple one being, that the CFA state bookkeeping is partly 64-bit
unaware.

The more subtle one concerns the function frame base and how values are addressed.

It got recently broken for 32-bit by commit b90e32b0.., I think you actually want to revert this commit for now.

The issue is that debug_info variable locations are emitted relative to
EBP seen from within the function.
In contrast the DW_AT_frame_base location list follows the outer frame
pointer.

Now there are two possibilities to solve this:
   1. make DW_AT_frame_base follow the inner frame pointer
     Pro:
       - can use var addresses the compiler is emitting anyways

     Con:
       - CFA and DW_AT_frame_base diverge while DWARF3 allows to
         define frame_base as CFA making location lists for each
         prolog obsolete (DW_OP_call_frame_cfa).

       - There is not alway two pointers between inner/outer frame
         pointer (farfunc on 32, interrupt func)

   2. adjust variable addresses to account for the difference
     Pro:
       - frame_base is easier computed and equals gcc behavior, also equal
to CFA
       - frame_base doesn't point into unallocated area during call

     Con:
       - need to cope with different storage classes for parameters


-------------------- <- DW_AT_frame_base and CFA point here (outer frame  
pointer)
| Return address   |
--------------------
| pushed EBP       |
-------------------- <- EBP points here during function (inner frame  
pointer)
| pushed registers |
--------------------
| local storage    |
--------------------

So any opinions about this ?

Maybe someone could also help with the following.
How can I declare a an interrupt function?
What's the exact semantic of Aoff, Poff, BPoff and symbol->Soffset?