Skip to content

Instantly share code, notes, and snippets.

@fcuny
Created July 12, 2015 04:16
Show Gist options
  • Save fcuny/5ab16ac3a075200aafa1 to your computer and use it in GitHub Desktop.
Save fcuny/5ab16ac3a075200aafa1 to your computer and use it in GitHub Desktop.
$ gdb ./test
Reading symbols from ./test...done.
(gdb) break main
Breakpoint 1 at 0x4005c1
(gdb) run
Starting program: /home/fcuny/workspace/tmp/file/test
Breakpoint 1, 0x00000000004005c1 in main ()
(gdb) disassemble
Dump of assembler code for function main:
0x00000000004005bd <+0>: push %rbp
0x00000000004005be <+1>: mov %rsp,%rbp
=> 0x00000000004005c1 <+4>: sub $0x10,%rsp
0x00000000004005c5 <+8>: mov $0x400694,%esi
0x00000000004005ca <+13>: mov $0x400696,%edi
0x00000000004005cf <+18>: callq 0x4004b0 <fopen@plt>
0x00000000004005d4 <+23>: mov %rax,-0x8(%rbp)
0x00000000004005d8 <+27>: cmpq $0x0,-0x8(%rbp)
0x00000000004005dd <+32>: jne 0x4005f0 <main+51>
0x00000000004005df <+34>: mov $0x4006a1,%edi
0x00000000004005e4 <+39>: callq 0x4004c0 <perror@plt>
0x00000000004005e9 <+44>: mov $0x1,%eax
0x00000000004005ee <+49>: jmp 0x400601 <main+68>
0x00000000004005f0 <+51>: mov -0x8(%rbp),%rax
0x00000000004005f4 <+55>: mov %rax,%rdi
0x00000000004005f7 <+58>: callq 0x400480 <fclose@plt>
0x00000000004005fc <+63>: mov $0x0,%eax
0x0000000000400601 <+68>: leaveq
0x0000000000400602 <+69>: retq
End of assembler dump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment