Advertisement
Guest User

Untitled

a guest
Jun 9th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GDB 5.33 KB | None | 0 0
  1. $ gcc -g -o helloworld helloworld.c
  2.  
  3.  
  4. gdb -q helloworld
  5. Reading symbols from helloworld...done.
  6. gdb-peda$ disas main
  7. Dump of assembler code for function main:
  8.    0x000000000000063a <+0>: push   rbp
  9.    0x000000000000063b <+1>: mov    rbp,rsp
  10.    0x000000000000063e <+4>: lea    rdi,[rip+0x9f]        # 0x6e4
  11.    0x0000000000000645 <+11>:    call   0x510 <puts@plt>
  12.    0x000000000000064a <+16>:    mov    eax,0x0
  13.    0x000000000000064f <+21>:    pop    rbp
  14.    0x0000000000000650 <+22>:    ret
  15. End of assembler dump.
  16. gdb-peda$ b *(main+11)
  17. Breakpoint 1 at 0x645: file helloworld.c, line 21.
  18. gdb-peda$ r
  19. Starting program: /home/ubuntu/c/helloworld
  20. [----------------------------------registers-----------------------------------]
  21. RAX: 0x55555555463a (<main>:    push   rbp)
  22. RBX: 0x0
  23. RCX: 0x555555554660 (<__libc_csu_init>: push   r15)
  24. RDX: 0x7fffffffe3b8 --> 0x7fffffffe64c ("LANG=en_US.UTF-8")
  25. RSI: 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
  26. RDI: 0x5555555546e4 ("Hello world!")
  27. RBP: 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>:  push   r15)
  28. RSP: 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>:  push   r15)
  29. RIP: 0x555555554645 (<main+11>: call   0x555555554510 <puts@plt>)
  30. R8 : 0x7ffff7dd0d80 --> 0x0
  31. R9 : 0x7ffff7dd0d80 --> 0x0
  32. R10: 0x0
  33. R11: 0x1
  34. R12: 0x555555554530 (<_start>:  xor    ebp,ebp)
  35. R13: 0x7fffffffe3a0 --> 0x1
  36. R14: 0x0
  37. R15: 0x0
  38. EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
  39. [-------------------------------------code-------------------------------------]
  40.    0x55555555463a <main>:   push   rbp
  41.    0x55555555463b <main+1>: mov    rbp,rsp
  42.    0x55555555463e <main+4>: lea    rdi,[rip+0x9f]        # 0x5555555546e4
  43. => 0x555555554645 <main+11>:    call   0x555555554510 <puts@plt>
  44.    0x55555555464a <main+16>:    mov    eax,0x0
  45.    0x55555555464f <main+21>:    pop    rbp
  46.    0x555555554650 <main+22>:    ret
  47.    0x555555554651:  nop    WORD PTR cs:[rax+rax*1+0x0]
  48. Guessed arguments:
  49. arg[0]: 0x5555555546e4 ("Hello world!")
  50. [------------------------------------stack-------------------------------------]
  51. 0000| 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>: push   r15)
  52. 0008| 0x7fffffffe2c8 --> 0x7ffff7a05b97 (<__libc_start_main+231>:   mov    edi,eax)
  53. 0016| 0x7fffffffe2d0 --> 0x1
  54. 0024| 0x7fffffffe2d8 --> 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
  55. 0032| 0x7fffffffe2e0 --> 0x100008000
  56. 0040| 0x7fffffffe2e8 --> 0x55555555463a (<main>:    push   rbp)
  57. 0048| 0x7fffffffe2f0 --> 0x0
  58. 0056| 0x7fffffffe2f8 --> 0xeb556094de1bb3f8
  59. [------------------------------------------------------------------------------]
  60. Legend: code, data, rodata, value
  61.  
  62. Breakpoint 1, 0x0000555555554645 in main () at helloworld.c:21
  63. 21      printf("Hello world!\n");
  64. gdb-peda$ si
  65. [----------------------------------registers-----------------------------------]
  66. RAX: 0x55555555463a (<main>:    push   rbp)
  67. RBX: 0x0
  68. RCX: 0x555555554660 (<__libc_csu_init>: push   r15)
  69. RDX: 0x7fffffffe3b8 --> 0x7fffffffe64c ("LANG=en_US.UTF-8")
  70. RSI: 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
  71. RDI: 0x5555555546e4 ("Hello world!")
  72. RBP: 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>:  push   r15)
  73. RSP: 0x7fffffffe2b8 --> 0x55555555464a (<main+16>:  mov    eax,0x0)
  74. RIP: 0x555555554510 (<puts@plt>:    jmp    QWORD PTR [rip+0x200aba]        # 0x555555754fd0)
  75. R8 : 0x7ffff7dd0d80 --> 0x0
  76. R9 : 0x7ffff7dd0d80 --> 0x0
  77. R10: 0x0
  78. R11: 0x1
  79. R12: 0x555555554530 (<_start>:  xor    ebp,ebp)
  80. R13: 0x7fffffffe3a0 --> 0x1
  81. R14: 0x0
  82. R15: 0x0
  83. EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
  84. [-------------------------------------code-------------------------------------]
  85.    0x555555554501:  xor    eax,0x200aba
  86.    0x555555554506:  jmp    QWORD PTR [rip+0x200abc]        # 0x555555754fc8
  87.    0x55555555450c:  nop    DWORD PTR [rax+0x0]
  88. => 0x555555554510 <puts@plt>:   jmp    QWORD PTR [rip+0x200aba]        # 0x555555754fd0
  89.  | 0x555555554516 <puts@plt+6>: push   0x0
  90.  | 0x55555555451b <puts@plt+11>:    jmp    0x555555554500
  91.  | 0x555555554520 <__cxa_finalize@plt>: jmp    QWORD PTR [rip+0x200ad2]        # 0x555555754ff8
  92.  | 0x555555554526 <__cxa_finalize@plt+6>:   xchg   ax,ax
  93.  |->   0x7ffff7a649c0 <_IO_puts>:   push   r13
  94.        0x7ffff7a649c2 <_IO_puts+2>: push   r12
  95.        0x7ffff7a649c4 <_IO_puts+4>: mov    r12,rdi
  96.        0x7ffff7a649c7 <_IO_puts+7>: push   rbp
  97.                                                                   JUMP is taken
  98. [------------------------------------stack-------------------------------------]
  99. 0000| 0x7fffffffe2b8 --> 0x55555555464a (<main+16>: mov    eax,0x0)
  100. 0008| 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>: push   r15)
  101. 0016| 0x7fffffffe2c8 --> 0x7ffff7a05b97 (<__libc_start_main+231>:   mov    edi,eax)
  102. 0024| 0x7fffffffe2d0 --> 0x1
  103. 0032| 0x7fffffffe2d8 --> 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
  104. 0040| 0x7fffffffe2e0 --> 0x100008000
  105. 0048| 0x7fffffffe2e8 --> 0x55555555463a (<main>:    push   rbp)
  106. 0056| 0x7fffffffe2f0 --> 0x0
  107. [------------------------------------------------------------------------------]
  108. Legend: code, data, rodata, value
  109. 0x0000555555554510 in puts@plt ()
  110. gdb-peda$ x/gx 0x555555754fd0
  111. 0x555555754fd0: 0x00007ffff7a649c0
  112. gdb-peda$ x/4i 0x00007ffff7a649c0
  113.    0x7ffff7a649c0 <_IO_puts>:   push   r13
  114.    0x7ffff7a649c2 <_IO_puts+2>: push   r12
  115.    0x7ffff7a649c4 <_IO_puts+4>: mov    r12,rdi
  116.    0x7ffff7a649c7 <_IO_puts+7>: push   rbp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement