Adds stepret command and nextret docstring (#448)

So that now we can step-until-return-like-instruction like a boss! :)
pull/449/head
Disconnect3d 8 years ago committed by GitHub
parent 0323e769cf
commit f834bf4a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,10 +38,25 @@ def nextcall(*args):
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextret(*args):
"""Breaks at next return-like instruction"""
if pwndbg.next.break_next_ret():
pwndbg.commands.context.context()
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def stepret(*args):
"""Breaks at next return-like instruction by 'stepping' to it"""
while pwndbg.proc.alive and not pwndbg.next.break_next_ret() and pwndbg.next.break_next_branch():
# Here we are e.g. on a CALL instruction (temporarily breakpointed by `break_next_branch`)
# We need to step so that we take this branch instead of ignoring it
gdb.execute('si')
continue
if pwndbg.proc.alive:
pwndbg.commands.context.context()
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextproginstr(*args):

Loading…
Cancel
Save