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

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.



call-frame-32.patch (2.67 KB)

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.


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.)