About the understanding of MIPS-FP (frame pointer) registers

Source: Internet
Author: User
1,stack Frame
Stack we all know that every process has its own stack. Considering the scenario in which a function call occurs when the process executes, the parent function and the child function use the same stack, and in general, we do not need to distinguish which part of the stack is used by the parent function and the child function respectively. However, this information is important when we need to backtrace the function calls during execution. Simply put, the stack frame is part of a stack used by a function, and the stack frame of all functions forms a complete stack. The two boundaries of a stack frame are defined by the FP and SP, respectively.


2,backtrace the SP and FP of the parent function can be obtained by using the stack frame defined by the SP and FP in the course of the program execution (usually in the event of an unexpected situation), the stack frame of the parent function (PC,LR,SP, The FP will press the stack at the first time of the function call, so that all functions are called in sequence.
3,GCC the optimization option for stack frame looks like FP is only useful in backtrace, so if we don't have backstrace requirements, can we not use FP. In fact, GCC has an optimization option for stack frame:-fomit-frame-pointer

Transferred from: http://blog.chinaunix.net/uid-26817832-id-3347227.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.