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]

How to get the offset of a local variable relative to the stack frame address


The offset of a local variable relative to the frame address in C or C++ may be found by||:
||
|(char*)&a -(char*)__builtin_frame_address(0)|
||
|||A more straightforward builtin should be already available by gcc. Which is it ?|
||
|p.s. the previous code adds the offset to bp and afterwards subtracts from the result bp.|

||
||||
||
||


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