Those familiar with x86 assembly programming are very used to the typical function prologue / epilogue:
push ebp
mov esp, ebp
sub esp, [size of local variables]
...
mov esp, ebp
pop ebp
ret
https://code.i-harness.com/en/q/191a90f
Why does this assembly code doesn't have pop ebp
in function epilogue?
(gdb) disas main
Dump of assembler code for function main:
0x000004ed <+0>: push ebp
0x000004ee <+1>: mov ebp,esp
0x000004f0 <+3>: sub esp,0x10
0x000004f3 <+6>: call 0x512 <__x86.get_pc_thunk.ax>
0x000004f8 <+11>: add eax,0x1ae4
0x000004fd <+16>: mov DWORD PTR [ebp-0x8],0x1
0x00000504 <+23>: mov DWORD PTR [ebp-0x4],0x2
0x0000050b <+30>: mov eax,0x0
0x00000510 <+35>: leave
0x00000511 <+36>: ret
End of assembler dump.
(gdb)
User contributions licensed under CC BY-SA 3.0