Msg/ClobberedSP

From CPUlator Wiki

< Msg
Revision as of 23:11, 9 March 2019 by Henry (talk | contribs) (Created page with "A function should always ensure that the stack pointer is the same at the entry and exit of the function. This message tells you that this didn't happen: the stack pointer was...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A function should always ensure that the stack pointer is the same at the entry and exit of the function. This message tells you that this didn't happen: the stack pointer was different at the function return than when the function was first called.

Examples

ARMv7

.global _start
_start:
    mov sp, #0x1000		// Initialize SP to something sane
    bl MyFunction
    nop
    nop
    # ...
    
MyFunction:
    push {r4}	// Changes SP
    bx lr		// Return, but SP is different

Disabling this message

This debugging check can be disabled in the Debugging Checks section of the Settings box: Function clobbered ra or sp.