Advertisement
Guest User

Untitled

a guest
Jun 10th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GDB 5.49 KB | None | 0 0
  1.  
  2. $ gcc -g -o helloworld helloworld.c
  3.  
  4. $ gdb -q helloworld
  5. Reading symbols from helloworld...done.
  6. gdb-peda$ set env LD_BIND_NOW
  7. Setting environment variable "LD_BIND_NOW" to null value.
  8. gdb-peda$ b main
  9. Breakpoint 1 at 0x63e: file helloworld.c, line 21.
  10. gdb-peda$ r
  11. Starting program: /home/ubuntu/Dropbox/Workspace/c/doodle/helloworld
  12. [----------------------------------registers-----------------------------------]
  13. RAX: 0x55555555463a (<main>:    push   rbp)
  14. RBX: 0x0
  15. RCX: 0x555555554660 (<__libc_csu_init>: push   r15)
  16. RDX: 0x7fffffffe368 --> 0x7fffffffe616 ("HOME=/home/ubuntu")
  17. RSI: 0x7fffffffe358 --> 0x7fffffffe5e3 ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld")
  18. RDI: 0x1
  19. RBP: 0x7fffffffe270 --> 0x555555554660 (<__libc_csu_init>:      push   r15)
  20. RSP: 0x7fffffffe270 --> 0x555555554660 (<__libc_csu_init>:      push   r15)
  21. RIP: 0x55555555463e (<main+4>:  lea    rdi,[rip+0x9f]        # 0x5555555546e4)
  22. R8 : 0x7ffff7dd0d80 --> 0x0
  23. R9 : 0x7ffff7dd0d80 --> 0x0
  24. R10: 0x0
  25. R11: 0x1
  26. R12: 0x555555554530 (<_start>:  xor    ebp,ebp)
  27. R13: 0x7fffffffe350 --> 0x1
  28. R14: 0x0
  29. R15: 0x0
  30. EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
  31. [-------------------------------------code-------------------------------------]
  32.    0x555555554635 <frame_dummy+5>:      jmp    0x5555555545a0 <register_tm_clones>
  33.    0x55555555463a <main>:       push   rbp
  34.    0x55555555463b <main+1>:     mov    rbp,rsp
  35. => 0x55555555463e <main+4>:     lea    rdi,[rip+0x9f]        # 0x5555555546e4
  36.    0x555555554645 <main+11>:    call   0x555555554510 <puts@plt>
  37.    0x55555555464a <main+16>:    mov    eax,0x0
  38.    0x55555555464f <main+21>:    pop    rbp
  39.    0x555555554650 <main+22>:    ret
  40. [------------------------------------stack-------------------------------------]
  41. 0000| 0x7fffffffe270 --> 0x555555554660 (<__libc_csu_init>:     push   r15)
  42. 0008| 0x7fffffffe278 --> 0x7ffff7a05b97 (<__libc_start_main+231>:       mov    edi,eax)
  43. 0016| 0x7fffffffe280 --> 0x1
  44. 0024| 0x7fffffffe288 --> 0x7fffffffe358 --> 0x7fffffffe5e3 ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld")
  45. 0032| 0x7fffffffe290 --> 0x100008000
  46. 0040| 0x7fffffffe298 --> 0x55555555463a (<main>:        push   rbp)
  47. 0048| 0x7fffffffe2a0 --> 0x0
  48. 0056| 0x7fffffffe2a8 --> 0xb753b8891c71e1e2
  49. [------------------------------------------------------------------------------]
  50. Legend: code, data, rodata, value
  51.  
  52. Breakpoint 1, main () at helloworld.c:21
  53. 21          printf("Hello world!\n");
  54. gdb-peda$ x/i 0x555555554510
  55.    0x555555554510 <puts@plt>:   jmp    QWORD PTR [rip+0x200aba]        # 0x555555754fd0
  56. gdb-peda$ x/gx 0x555555754fd0
  57. 0x555555754fd0: 0x00007ffff7a649c0
  58. gdb-peda$ x/4i 0x00007ffff7a649c0
  59.    0x7ffff7a649c0 <_IO_puts>:   push   r13
  60.    0x7ffff7a649c2 <_IO_puts+2>: push   r12
  61.    0x7ffff7a649c4 <_IO_puts+4>: mov    r12,rdi
  62.    0x7ffff7a649c7 <_IO_puts+7>: push   rbp
  63. gdb-peda$ set env LD_BIND_NOW=1
  64. gdb-peda$ show env LD_BIND_NOW
  65. LD_BIND_NOW = 1
  66. gdb-peda$ r
  67. Starting program: /home/ubuntu/Dropbox/Workspace/c/doodle/helloworld
  68. [----------------------------------registers-----------------------------------]
  69. RAX: 0x55555555463a (<main>:    push   rbp)
  70. RBX: 0x0
  71. RCX: 0x555555554660 (<__libc_csu_init>: push   r15)
  72. RDX: 0x7fffffffe368 --> 0x7fffffffe615 ("HOME=/home/ubuntu")
  73. RSI: 0x7fffffffe358 --> 0x7fffffffe5e2 ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld")
  74. RDI: 0x1
  75. RBP: 0x7fffffffe270 --> 0x555555554660 (<__libc_csu_init>:      push   r15)
  76. RSP: 0x7fffffffe270 --> 0x555555554660 (<__libc_csu_init>:      push   r15)
  77. RIP: 0x55555555463e (<main+4>:  lea    rdi,[rip+0x9f]        # 0x5555555546e4)
  78. R8 : 0x7ffff7dd0d80 --> 0x0
  79. R9 : 0x7ffff7dd0d80 --> 0x0
  80. R10: 0x0
  81. R11: 0x1
  82. R12: 0x555555554530 (<_start>:  xor    ebp,ebp)
  83. R13: 0x7fffffffe350 --> 0x1
  84. R14: 0x0
  85. R15: 0x0
  86. EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
  87. [-------------------------------------code-------------------------------------]
  88.    0x555555554635 <frame_dummy+5>:      jmp    0x5555555545a0 <register_tm_clones>
  89.    0x55555555463a <main>:       push   rbp
  90.    0x55555555463b <main+1>:     mov    rbp,rsp
  91. => 0x55555555463e <main+4>:     lea    rdi,[rip+0x9f]        # 0x5555555546e4
  92.    0x555555554645 <main+11>:    call   0x555555554510 <puts@plt>
  93.    0x55555555464a <main+16>:    mov    eax,0x0
  94.    0x55555555464f <main+21>:    pop    rbp
  95.    0x555555554650 <main+22>:    ret
  96. [------------------------------------stack-------------------------------------]
  97. 0000| 0x7fffffffe270 --> 0x555555554660 (<__libc_csu_init>:     push   r15)
  98. 0008| 0x7fffffffe278 --> 0x7ffff7a05b97 (<__libc_start_main+231>:       mov    edi,eax)
  99. 0016| 0x7fffffffe280 --> 0x1
  100. 0024| 0x7fffffffe288 --> 0x7fffffffe358 --> 0x7fffffffe5e2 ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld")
  101. 0032| 0x7fffffffe290 --> 0x100008000
  102. 0040| 0x7fffffffe298 --> 0x55555555463a (<main>:        push   rbp)
  103. 0048| 0x7fffffffe2a0 --> 0x0
  104. 0056| 0x7fffffffe2a8 --> 0xd117bf73fe78886d
  105. [------------------------------------------------------------------------------]
  106. Legend: code, data, rodata, value
  107.  
  108. Breakpoint 1, main () at helloworld.c:21
  109. 21          printf("Hello world!\n");
  110. gdb-peda$ x/i 0x555555554510
  111.    0x555555554510 <puts@plt>:   jmp    QWORD PTR [rip+0x200aba]        # 0x555555754fd0
  112. gdb-peda$ x/gx 0x555555754fd0
  113. 0x555555754fd0: 0x00007ffff7a649c0
  114. gdb-peda$ x/4i 0x00007ffff7a649c0
  115.    0x7ffff7a649c0 <_IO_puts>:   push   r13
  116.    0x7ffff7a649c2 <_IO_puts+2>: push   r12
  117.    0x7ffff7a649c4 <_IO_puts+4>: mov    r12,rdi
  118.    0x7ffff7a649c7 <_IO_puts+7>: push   rbp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement