Stack frame, the machine uses stacks to pass process parameters, store return information, save registers for later recovery, and local storage. The portion of the stack allocated for a single procedure (function call) is called a stack frame. The stack frame is actually a two pointer register,
The register%EBP is a frame pointer, and the register is%esp as a stack pointer, and when the program runs, the stack pointer can move (most of the information is accessed through the frame pointer). In short, the main function of the stack frame is to control and save a process
All the information. The stack frame structure looks like this:
Below, we use a simple program to understand the stack frame:
Simple function analysis, such as:
the stack frame condition of the function :
When *p=bug, modify the position of the return value in the stack frame, so that the function is not returned normally, but into the bug function, when the Exit function is encountered, the program terminates, does not jump back to the main function to terminate.
Linux-Stack frames for functions