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: Var-tracking generates broken DW_AT_frame_base on s390


> The way the stack is layed out on s390 is as follows:  after function
> entry, the prolog code subtracts from the stack pointer (%r15), allocating 
> a stack frame.  All local variables are accessed using positive offsets 
> relative to %r15, which remains constant throughout the function (until 
> the epilog).  The exception are functions that use variably-sized stack 
> allocations; these function will set up a frame pointer (%r11) at the end 
> of the prolog, and will access all local variables using that register.
> 
> However, the new var-tracking code tries to be clever and emits a location
> list for DW_AT_frame_base itself.  In doing so, there appears to be the
> hard-coded assumption that the frame base must be identical to the value
> of the stack pointer at function entry.  The var-tracking code traces the
> prolog RTX and notices the insn that subtracts from the stack pointer; 
> from that point on, the frame_base location is then represented as 
> (%r15 + frame-size), which is clearly wrong for s390.

IMHO this is correct because all references to stack variables in
location lists should have "frame-size" subtracted from the offset.
The value "(%r15 + frame-size)" is the stack pointer at the function
entry. We need some fixed point so that we could handle changes of
stack pointer when something is pushed to stack when using
-fomit-frame-pointer and the stack pointer at the function entry
is a good fixed point.

Anyway, I'll look into it to see if there is any problem.

BTW: you need to use GDB 6.1 to debug programs with location lists.

Josef
--
zlomekj@suse.cz
zlomj9am@artax.karlin.mff.cuni.cz
GPG fingerprint: 74E6 31D3 56D7 91FD 5A06  6BD5 96FF 99C4 25C0 EC0B

Attachment: signature.asc
Description: Digital signature


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