Reputation: 21259
I am debugging a Linux program to which I have no symbols. The binary is stripped. No big deal, I can handle that. However, how can I skip a call inside the debugger when I reach a particular piece of code?
What I am asking is not this: Use gdb to debug assembly, how to skip a call
I am interested if I have a:
call 0x12345678
...
to jump to the ...
straight without executing the call
.
How can I do that?
Upvotes: 1
Views: 484
Reputation: 21259
After some more reading I found the solution.
In my case I know the opcode for the call
is fives bytes long, so I can resolve it by setting the GDB register name $pc
("program counter") to jump over it:
set $pc+=5
According to the comment on this answer by Employed Russian the following provides the same functionality:
jump *$pc+5
Assuming you have the call
at address 0x01234567
and want to skip five bytes, you can do the following in your .gdbinit
:
b *0x01234567
commands 1
x/i $pc
echo Not executing the call\n
set $pc+=5
x/i $pc
end
Upvotes: 2
Reputation: 62048
Set the rip
value to the address of the instruction right after this call 0x12345678
.
Upvotes: 1