C源程序:
# include <stdio.h>
int global_x = 9;
void function(int a,int b)
{
}
int main()
{
int local_x = 5;
function(1,2);
return 0;
}
LINUX下反汇编:
(gdb) disas main
Dump of assembler code for function main:
0x080483c7 <+0>: push %ebp
0x080483c8 <+1>: mov %esp,%ebp
0x080483ca <+3>: sub $0x18,%esp
0x080483cd <+6>: movl $0x5,-0x4(%ebp)
0x080483d4 <+13>: movl $0x2,0x4(%esp)
0x080483dc <+21>: movl $0x1,(%esp)
0x080483e3 <+28>: call 0x80483b4 <function>
0x080483e8 <+33>: mov $0x0,%eax
0x080483ed <+38>: leave
0x080483ee <+39>: ret
End of assembler dump.
(gdb)
WINDOWS下反汇编:
CPU Disasm
地址 HEX 数据 指令 注释
00401190 /$ 55 PUSH EBP ; temp.<模块入口点> (void
00401191 |. 8BEC MOV EBP,ESP
00401193 |. 6A FF PUSH -1
00401195 |. 68 30214200 PUSH OFFSET 00422130
0040119A |. 68 40424000 PUSH __except_handler3
0040119F |. 64:A1 0000000 MOV EAX,DWORD PTR FS:[0]
004011A5 |. 50 PUSH EAX
004011A6 |. 64:8925 00000 MOV DWORD PTR FS:[0],ESP ; Installs SE 处理器 __except_handler3
004011AD |. 83C4 F0 ADD ESP,-10
004011B0 |. 53 PUSH EBX
004011B1 |. 56 PUSH ESI
004011B2 |. 57 PUSH EDI
004011B3 |. 8965 E8 MOV DWORD PTR SS:[LOCAL.6],ESP
004011B6 |. FF15 4CA14200 CALL DWORD PTR DS:[<&KERNEL32.GetVersion ; [KERNEL32.GetVersion
004011BC |. A3 847C4200 MOV DWORD PTR DS:[_osver],EAX
004011C1 |. A1 847C4200 MOV EAX,DWORD PTR DS:[_osver]