(gdb) list
1 #include <stdio.h>
2
3 int main()
4 {
5 int i;
6 for (i=0; i<10; i++)
7 {
8 puts("Hello World");
9 }
10 return 0;
(gdb) set disassembly-flavor intel
(gdb) disas main
Dump of assembler code for function main:
0x00401460 <+0>: push ebp // setting up the stack frame
0x00401461 <+1>: mov ebp,esp // ...
0x00401463 <+3>: and esp,0xfffffff0 // ...
0x00401466 <+6>: sub esp,0x20 // ... done
0x00401469 <+9>: call 0x4019d0 <__main> // fill the stack frame
0x0040146e <+14>: mov DWORD PTR [esp+0x1c],0x0 // i=0
0x00401476 <+22>: jmp 0x401489 <main+41> // goto loop_head
0x00401478 <+24>: mov DWORD PTR [esp],0x405064 // loop_body:
0x0040147f <+31>: call 0x403a70 <puts> // puts("Hello World")
0x00401484 <+36>: add DWORD PTR [esp+0x1c],0x1 // i++
0x00401489 <+41>: cmp DWORD PTR [esp+0x1c],0x9 // loop_head: Compare i with 9
0x0040148e <+46>: jle 0x401478 <main+24> // If (<=) goto loop_body
0x00401490 <+48>: mov eax,0x0 // cleaning up the stack frame
0x00401495 <+53>: leave // ... done
0x00401496 <+54>: ret // return
End of assembler dump.
DWORD … 4 Byte (on x86)
For a basic assembly instruction: Link