本文介绍了EBP寄存器(基框指针)仅适用于x86中的调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

学习x86程序集,框架指针正在吹我的脑海中。我从这个中了解到,EBP使生活更加美好调试。那太好了,但我很好奇,EBP还用什么?查看维基百科文章,EBP是动态堆栈分配所必需的。

Learning x86 assembly and the frame pointer is blowing my mind a little. I learned from this SO question that EBP makes life awesome for debugging. That's great, but I was curious, "What else is EBP used for?" Looking at the call stack Wikipedia article, EBP is necessary for dynamic stack allocation.

由于我一直以为动态分配在堆上的假设。那么,为什么要使用动态堆栈分配 - 为什么堆不够好?而且,EBP如何对此有用?

As I've always been under the assumption that dynamic allocation goes on the heap. So, why would I want to use dynamic stack allocation - why isn't the heap good enough? And, how is EBP useful for this?

推荐答案

从堆分配中分配少量内存是非常快的。当我们从堆分配内存时,我们必须调用API或内存管理器。

Allocating small amount of memory from stack is extremely fast compared to heap allocating. When we allocate memory from heap then we must call API or memory manager.

YES 您可以使用EBP注册,以用于其他任何其他目的32位寄存器,但您必须首先存储其内容,然后在退出程序之后进行恢复。

YES you can use EBP register also for any other purpose like other 32bit registers but you must first to store its content and after that restore before you exit your procedure.

您可以使用 PUSH EBP 用于将EBP内容存储到堆栈, POP EBP 进行恢复。

You can use PUSH EBP for storing the EBP content to the stack and POP EBP for restoring.

这篇关于EBP寄存器(基框指针)仅适用于x86中的调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 15:26