Skip to main content

How to modify branching machine code in GDB? [Resolved]

I have a simple c code which is compiled and then the text code extracted using objdump utility. here is the dump file (A piece of dumped file):

0804841b 
: 804841b: 8d 4c 24 04 lea 0x4(%esp),%ecx 804841f: 83 e4 f0 and $0xfffffff0,%esp 8048422: ff 71 fc pushl -0x4(%ecx) 8048425: 55 push %ebp 8048426: 89 e5 mov %esp,%ebp 8048428: 51 push %ecx 8048429: 83 ec 14 sub $0x14,%esp 804842c: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 8048433: c7 45 f4 0a 00 00 00 movl $0xa,-0xc(%ebp) 804843a: 8b 45 f4 mov -0xc(%ebp),%eax 804843d: 01 45 f0 add %eax,-0x10(%ebp) 8048440: 8b 45 f0 mov -0x10(%ebp),%eax 8048443: 3b 45 f4 cmp -0xc(%ebp),%eax 8048446: 7e 0f jle 8048457 8048448: 83 ec 0c sub $0xc,%esp 804844b: 6a 78 push $0x78 804844d: e8 be fe ff ff call 8048310 8048452: 83 c4 10 add $0x10,%esp 8048455: eb 15 jmp 804846c 8048457: 8b 45 f4 mov -0xc(%ebp),%eax 804845a: 3b 45 f0 cmp -0x10(%ebp),%eax 804845d: 7e 0d jle 804846c

the instruction at address 8048446 is jle 8048457 which has the machine code 7e 0f

the statement is refer to the location of target instruction shifted from the main address, i.e. the 3c is equal 60 which mean that after 60 bytes from the main, the instruction

8048457:   8b 45 f4                mov    -0xc(%ebp),%eax

is located. The machine code of the instruction at address 8048446 is 7e 0f
7e is the machine code of jle. The 0f what is?

In another branch instruction like this:

 8048455:   eb 15                   jmp    804846c 

what is 15 means?


Question Credit: husin alhaj ahmade
Question Reference
Asked May 13, 2019
Posted Under: Unix Linux
8 views
1 Answers

Your Answer
D:\Adnan\Candoerz\CandoProject\vQA