[Dwarf-Discuss] Location list entries for caller-saved registers at time of call

Michael Eager eager@eagerm.com
Fri Dec 7 00:55:39 GMT 2018


On 12/06/2018 12:47 PM, Cary Coutant via Dwarf-Discuss wrote:
>> Another perfectly good solution is for the compiler to assure that the return PC is always in the
>> right scope to begin with. All it takes is to include a (never executed) NOP following any non-returning
>> CALL at the last address of the routine.Such calls are not common, plus many environments align
>> the beginning of (any subsequent) functions anyway so padding bytes are likely to be available. As a
>> result, such "extra" bytes are not going to be a space issue.
> 
> In fact, the PA-RISC and Itanium calling conventions specifically require this.

Not all ABIs do this.  Many allow the end of one function to be
immediately followed by the start of the next function.

Subtracting one from the return address is a trivial way to insure
that the address is within the calling function and not in the
next function.  And it works on all architectures.

In any case, this is the way that GDB has handled return addresses
for n >= 2 decades.  Whatever the OP's issue is, this is not related.

-- 
Michael Eager    eager at eagerm.com
1960 Park Blvd., Palo Alto, CA 94306



More information about the Dwarf-discuss mailing list