是EBP寄存器(基本帧指针)只适用于x86的调试? [英] Is the EBP register (base frame pointer) only for Debugging in x86?

查看:221
本文介绍了是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.

您可以使用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的调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆