Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ gcc -g -o helloworld helloworld.c
- gdb -q helloworld
- Reading symbols from helloworld...done.
- gdb-peda$ disas main
- Dump of assembler code for function main:
- 0x000000000000063a <+0>: push rbp
- 0x000000000000063b <+1>: mov rbp,rsp
- 0x000000000000063e <+4>: lea rdi,[rip+0x9f] # 0x6e4
- 0x0000000000000645 <+11>: call 0x510 <puts@plt>
- 0x000000000000064a <+16>: mov eax,0x0
- 0x000000000000064f <+21>: pop rbp
- 0x0000000000000650 <+22>: ret
- End of assembler dump.
- gdb-peda$ b *(main+11)
- Breakpoint 1 at 0x645: file helloworld.c, line 21.
- gdb-peda$ r
- Starting program: /home/ubuntu/c/helloworld
- [----------------------------------registers-----------------------------------]
- RAX: 0x55555555463a (<main>: push rbp)
- RBX: 0x0
- RCX: 0x555555554660 (<__libc_csu_init>: push r15)
- RDX: 0x7fffffffe3b8 --> 0x7fffffffe64c ("LANG=en_US.UTF-8")
- RSI: 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
- RDI: 0x5555555546e4 ("Hello world!")
- RBP: 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>: push r15)
- RSP: 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>: push r15)
- RIP: 0x555555554645 (<main+11>: call 0x555555554510 <puts@plt>)
- R8 : 0x7ffff7dd0d80 --> 0x0
- R9 : 0x7ffff7dd0d80 --> 0x0
- R10: 0x0
- R11: 0x1
- R12: 0x555555554530 (<_start>: xor ebp,ebp)
- R13: 0x7fffffffe3a0 --> 0x1
- R14: 0x0
- R15: 0x0
- EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
- [-------------------------------------code-------------------------------------]
- 0x55555555463a <main>: push rbp
- 0x55555555463b <main+1>: mov rbp,rsp
- 0x55555555463e <main+4>: lea rdi,[rip+0x9f] # 0x5555555546e4
- => 0x555555554645 <main+11>: call 0x555555554510 <puts@plt>
- 0x55555555464a <main+16>: mov eax,0x0
- 0x55555555464f <main+21>: pop rbp
- 0x555555554650 <main+22>: ret
- 0x555555554651: nop WORD PTR cs:[rax+rax*1+0x0]
- Guessed arguments:
- arg[0]: 0x5555555546e4 ("Hello world!")
- [------------------------------------stack-------------------------------------]
- 0000| 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>: push r15)
- 0008| 0x7fffffffe2c8 --> 0x7ffff7a05b97 (<__libc_start_main+231>: mov edi,eax)
- 0016| 0x7fffffffe2d0 --> 0x1
- 0024| 0x7fffffffe2d8 --> 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
- 0032| 0x7fffffffe2e0 --> 0x100008000
- 0040| 0x7fffffffe2e8 --> 0x55555555463a (<main>: push rbp)
- 0048| 0x7fffffffe2f0 --> 0x0
- 0056| 0x7fffffffe2f8 --> 0xeb556094de1bb3f8
- [------------------------------------------------------------------------------]
- Legend: code, data, rodata, value
- Breakpoint 1, 0x0000555555554645 in main () at helloworld.c:21
- 21 printf("Hello world!\n");
- gdb-peda$ si
- [----------------------------------registers-----------------------------------]
- RAX: 0x55555555463a (<main>: push rbp)
- RBX: 0x0
- RCX: 0x555555554660 (<__libc_csu_init>: push r15)
- RDX: 0x7fffffffe3b8 --> 0x7fffffffe64c ("LANG=en_US.UTF-8")
- RSI: 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
- RDI: 0x5555555546e4 ("Hello world!")
- RBP: 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>: push r15)
- RSP: 0x7fffffffe2b8 --> 0x55555555464a (<main+16>: mov eax,0x0)
- RIP: 0x555555554510 (<puts@plt>: jmp QWORD PTR [rip+0x200aba] # 0x555555754fd0)
- R8 : 0x7ffff7dd0d80 --> 0x0
- R9 : 0x7ffff7dd0d80 --> 0x0
- R10: 0x0
- R11: 0x1
- R12: 0x555555554530 (<_start>: xor ebp,ebp)
- R13: 0x7fffffffe3a0 --> 0x1
- R14: 0x0
- R15: 0x0
- EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
- [-------------------------------------code-------------------------------------]
- 0x555555554501: xor eax,0x200aba
- 0x555555554506: jmp QWORD PTR [rip+0x200abc] # 0x555555754fc8
- 0x55555555450c: nop DWORD PTR [rax+0x0]
- => 0x555555554510 <puts@plt>: jmp QWORD PTR [rip+0x200aba] # 0x555555754fd0
- | 0x555555554516 <puts@plt+6>: push 0x0
- | 0x55555555451b <puts@plt+11>: jmp 0x555555554500
- | 0x555555554520 <__cxa_finalize@plt>: jmp QWORD PTR [rip+0x200ad2] # 0x555555754ff8
- | 0x555555554526 <__cxa_finalize@plt+6>: xchg ax,ax
- |-> 0x7ffff7a649c0 <_IO_puts>: push r13
- 0x7ffff7a649c2 <_IO_puts+2>: push r12
- 0x7ffff7a649c4 <_IO_puts+4>: mov r12,rdi
- 0x7ffff7a649c7 <_IO_puts+7>: push rbp
- JUMP is taken
- [------------------------------------stack-------------------------------------]
- 0000| 0x7fffffffe2b8 --> 0x55555555464a (<main+16>: mov eax,0x0)
- 0008| 0x7fffffffe2c0 --> 0x555555554660 (<__libc_csu_init>: push r15)
- 0016| 0x7fffffffe2c8 --> 0x7ffff7a05b97 (<__libc_start_main+231>: mov edi,eax)
- 0024| 0x7fffffffe2d0 --> 0x1
- 0032| 0x7fffffffe2d8 --> 0x7fffffffe3a8 --> 0x7fffffffe619 ("/home/ubuntu/c/helloworld")
- 0040| 0x7fffffffe2e0 --> 0x100008000
- 0048| 0x7fffffffe2e8 --> 0x55555555463a (<main>: push rbp)
- 0056| 0x7fffffffe2f0 --> 0x0
- [------------------------------------------------------------------------------]
- Legend: code, data, rodata, value
- 0x0000555555554510 in puts@plt ()
- gdb-peda$ x/gx 0x555555754fd0
- 0x555555754fd0: 0x00007ffff7a649c0
- gdb-peda$ x/4i 0x00007ffff7a649c0
- 0x7ffff7a649c0 <_IO_puts>: push r13
- 0x7ffff7a649c2 <_IO_puts+2>: push r12
- 0x7ffff7a649c4 <_IO_puts+4>: mov r12,rdi
- 0x7ffff7a649c7 <_IO_puts+7>: push rbp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement