Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ➜  wbench  gcc func.c -o func -g -mpreferred-stack-boundary=12
  2. ➜  wbench  gdb -q func                                        
  3. Reading symbols from func...done.
  4. (gdb) set disassembly-flavor intel
  5. (gdb) disas main
  6. Dump of assembler code for function main:
  7.    0x0000000000400514 <+0>: push   rbp
  8.    0x0000000000400515 <+1>: mov    rbp,rsp
  9.    0x0000000000400518 <+4>: sub    rsp,0x1000
  10.    0x000000000040051f <+11>:    mov    DWORD PTR [rbp-0x8],0x41
  11.    0x0000000000400526 <+18>:    mov    DWORD PTR [rbp-0x4],0x2
  12.    0x000000000040052d <+25>:    mov    eax,DWORD PTR [rbp-0x4]
  13.    0x0000000000400530 <+28>:    mov    edi,eax
  14.    0x0000000000400532 <+30>:    call   0x4004ed <function>
  15.    0x0000000000400537 <+35>:    mov    DWORD PTR [rbp-0x4],eax
  16.    0x000000000040053a <+38>:    mov    eax,DWORD PTR [rbp-0x4]
  17.    0x000000000040053d <+41>:    leave  
  18.    0x000000000040053e <+42>:    ret    
  19. End of assembler dump.
  20. (gdb) disas function
  21. Dump of assembler code for function function:
  22.    0x00000000004004ed <+0>: push   rbp
  23.    0x00000000004004ee <+1>: mov    rbp,rsp
  24.    0x00000000004004f1 <+4>: sub    rsp,0xf8c
  25.    0x00000000004004f8 <+11>:    mov    DWORD PTR [rbp-0x1004],edi
  26.    0x00000000004004fe <+17>:    mov    DWORD PTR [rbp-0x4],0x42
  27.    0x0000000000400505 <+24>:    add    DWORD PTR [rbp-0x1004],0x1
  28.    0x000000000040050c <+31>:    mov    eax,DWORD PTR [rbp-0x1004]
  29.    0x0000000000400512 <+37>:    leave  
  30.    0x0000000000400513 <+38>:    ret    
  31. End of assembler dump.
  32. (gdb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement