|
|
|
|
@ -9,6 +9,8 @@ from __future__ import division
|
|
|
|
|
from __future__ import print_function
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
import capstone
|
|
|
|
|
import gdb
|
|
|
|
|
|
|
|
|
|
@ -78,14 +80,27 @@ def break_next_interrupt(address=None):
|
|
|
|
|
gdb.execute('continue', from_tty=False, to_string=True)
|
|
|
|
|
return ins
|
|
|
|
|
|
|
|
|
|
def break_next_call(address=None):
|
|
|
|
|
def break_next_call(symbol_regex=None):
|
|
|
|
|
while pwndbg.proc.alive:
|
|
|
|
|
ins = break_next_branch(address)
|
|
|
|
|
ins = break_next_branch()
|
|
|
|
|
|
|
|
|
|
if not ins:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
if capstone.CS_GRP_CALL in ins.groups:
|
|
|
|
|
# continue if not a call
|
|
|
|
|
if capstone.CS_GRP_CALL not in ins.groups:
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
# return call if we don't search for a symbol
|
|
|
|
|
if not symbol_regex:
|
|
|
|
|
return ins
|
|
|
|
|
|
|
|
|
|
# return call if we match target address
|
|
|
|
|
if ins.target_const and re.match('%s$' % symbol_regex, hex(ins.target)):
|
|
|
|
|
return ins
|
|
|
|
|
|
|
|
|
|
# return call if we match symbol name
|
|
|
|
|
if ins.symbol and re.match('%s$' % symbol_regex, ins.symbol):
|
|
|
|
|
return ins
|
|
|
|
|
|
|
|
|
|
def break_on_next(address=None):
|
|
|
|
|
|