Giter Club home page Giter Club logo

c_guide's Introduction

反汇编

一. 每次进入main函数时均需执行以下指令:(用于建立新的函数的栈帧结构)

函数B中的ebp用于存放上一层函数A的栈帧的基指 (上一层函数A的栈帧的栈顶地址值),当由函数B进入到下一层函数C后,需将函数B的ebp压入函数B的栈帧顶部,并作为函数B的栈帧的栈顶(此时函数B的栈帧结束),同时需将上一层函数B的栈帧的基指(上一层函数B的栈帧的栈顶地址值)esp赋值给ebp作为函数c的ebp

汇 编 指 令 指令说明
push ebp 将上一函数A的栈帧(SF Stack Frame)的基指(栈顶地址值)ebp压入上一函数A的栈帧的顶部(作为上一函数A的栈帧的栈顶)
mov ebp,esp 将上一函数A的栈帧的栈顶地址值(基址)esp赋值给ebp作为main函数的ebp
ebp 将上一函数A的栈帧(SF Stack Frame)的基指(栈顶地址值)ebp压入上一函数A的栈帧的顶部(作为上一函数A的栈帧的栈顶)
#include<stdio.h>
int Add(int x, int y)
{
	int result;
	result=x+y;
	return result;
}
int main()
{
    int a=1,b=2,s;
    s=Add(a,b);
    printf("s=%d\n",a+b);//可以step into看一下printf函数的具体执行过程
    return 0;
}

c_guide's People

Contributors

threetown avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.