博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C--汇编对应查看方法
阅读量:4710 次
发布时间:2019-06-10

本文共 1776 字,大约阅读时间需要 5 分钟。

一:c语言编写简单函数(function_example.c)

#include 
int static add(int a, int b){ return a+b;}int main(){ int x = 5; int y = 10; int u = add(x, y);}

二:gcc编译

$ gcc -g -c function_example.c

三:objdump查看C语言和对应汇编

$ objdump -d -M intel -S function_example.ofunction_example.o:     file format elf64-x86-64Disassembly of section .text:0000000000000000 
:#include
int static add(int a, int b){ 0: 55 push rbp 1: 48 89 e5 mov rbp,rsp 4: 89 7d fc mov DWORD PTR [rbp-0x4],edi 7: 89 75 f8 mov DWORD PTR [rbp-0x8],esi return a+b; a: 8b 55 fc mov edx,DWORD PTR [rbp-0x4] d: 8b 45 f8 mov eax,DWORD PTR [rbp-0x8] 10: 01 d0 add eax,edx} 12: 5d pop rbp 13: c3 ret 0000000000000014
:int main(){ 14: 55 push rbp 15: 48 89 e5 mov rbp,rsp 18: 48 83 ec 10 sub rsp,0x10 int x = 5; 1c: c7 45 fc 05 00 00 00 mov DWORD PTR [rbp-0x4],0x5 int y = 10; 23: c7 45 f8 0a 00 00 00 mov DWORD PTR [rbp-0x8],0xa int u = add(x, y); 2a: 8b 55 f8 mov edx,DWORD PTR [rbp-0x8] 2d: 8b 45 fc mov eax,DWORD PTR [rbp-0x4] 30: 89 d6 mov esi,edx 32: 89 c7 mov edi,eax 34: e8 c7 ff ff ff call 0
39: 89 45 f4 mov DWORD PTR [rbp-0xc],eax 3c: b8 00 00 00 00 mov eax,0x0} 41: c9 leave 42: c3 ret

转载于:https://www.cnblogs.com/sojrs/p/10995965.html

你可能感兴趣的文章
vi/vim编辑器
查看>>
黑马程序员——创建线程的两种方式
查看>>
Webservice之axis
查看>>
运输计划 洛谷P2680
查看>>
用 C# 计算 与 java 一致的unix时间戳 (长时间整形 如:1476956079961)
查看>>
找回任务栏得“显示桌面"图标
查看>>
mondrian 4.7 源码部署
查看>>
C#方法重载(overload)方法重写(override)隐藏(new)
查看>>
读书笔记1-编写可维护javascript代码
查看>>
Redis系列(三)—— 订阅/发布
查看>>
过拟合原因
查看>>
Hystrix使用入门手册(中文)
查看>>
jQuery学习-属性选择器
查看>>
mysql数据类型
查看>>
HBuilder ,及自用主题
查看>>
思科交换机备份与还原
查看>>
位运算-实现加减乘除
查看>>
Mac 自带的Apache php 狼神的
查看>>
requests模块高级使用
查看>>
决策树--从原理到实现
查看>>