[lldb-dev] [PATCH][Review Request] Call frame address validation for 32-bit ABI

Jason Molenda jmolenda at apple.com
Tue Aug 20 15:36:58 PDT 2013


Hi Andrew, I've been meaning to make a change like this.  Note that the current implementation is not correct, the ABI on i386 for Darwin requires 16-byte alignment for stack frames, v.

https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/LowLevelABI/130-IA-32_Function_Calling_Conventions/IA32.html

If you could make that small fix while you're at it, I'd appreciate it.  Thanks!

(the ABISysV_x86_64 also incorrectly checks for 8-byte alignment - in reality Darwin is following the standard SysV x86-64 ABI and requiring 16-byte alignment.)

On Aug 20, 2013, at 2:23 PM, Kaylor, Andrew <andrew.kaylor at intel.com> wrote:

> Currently the MacOSX-i386 ABI plugin gets used for both Darwin and Linux platforms (probably FreeBSD also) when debugging a 32-bit inferior.  This makes sense because in almost all cases the ABI definition is the same across these platforms.
>  
> However, if I’m reading the specs correctly, there is an exception with regard to call frame address alignment.  It appears that call frame addresses must be 8-byte aligned on Darwin, whereas on Linux they can be 4-byte aligned.
>  
> The attached patch modifies the MacOSX-i386 ABI creation mechanism to allow separate ABI instances for Darwin and non-Darwin targets and passes a flag to the constructor that will be used in the case of cfa validation.
>  
> If there’s a better way to handle this, I’m open to guidance.
>  
> Some correction to the cfa validation is necessary to enable correct stack unwinding with 32-bit targets on Linux.
>  
> Thanks,
> Andy
> <call-frame-32.patch>





More information about the lldb-dev mailing list