Add stepsyscall and rename next_syscall to nextsyscall (#447)

* Add stepsyscall (and stepsc) command

So that one can break at a syscall which is e.g. inside a call.

* Rename next_syscall into nextsyscall

* Display context on next/stepsyscall only if process is alive
pull/449/head
Disconnect3d 8 years ago committed by GitHub
parent f834bf4a0d
commit 089fe869c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,6 +8,8 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gdb
import pwndbg.commands
import pwndbg.next
@ -81,19 +83,43 @@ def so(*args):
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def next_syscall(*args):
def nextsyscall(*args):
"""
Breaks at the next syscall.
Breaks at the next syscall not taking branches.
"""
while pwndbg.proc.alive and not pwndbg.next.break_next_interrupt() and pwndbg.next.break_next_branch():
continue
pwndbg.commands.context.context()
if pwndbg.proc.alive:
pwndbg.commands.context.context()
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextsc(*args):
"""
Breaks at the next syscall.
Breaks at the next syscall not taking branches.
"""
next_syscall(*args)
nextsyscall(*args)
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def stepsyscall(*args):
"""
Breaks at the next syscall by taking branches.
"""
while pwndbg.proc.alive and not pwndbg.next.break_next_interrupt() 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 stepsc(*args):
stepsyscall(*args)

Loading…
Cancel
Save