You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pwndbg/pwndbg/commands/next.py

55 lines
1.2 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Stepping until an event occurs
"""
import gdb
import pwndbg.commands
import pwndbg.next
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextjmp(*args):
"""Breaks at the next jump instruction"""
if pwndbg.next.break_next_branch():
pwndbg.commands.context.context()
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextj(*args):
"""Breaks at the next jump instruction"""
nextjmp(*args)
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextjump(*args):
"""Breaks at the next jump instruction"""
nextjmp(*args)
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextcall(*args):
"""Breaks at the next call instruction"""
if pwndbg.next.break_next_call():
pwndbg.commands.context.context()
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def nextc(*args):
"""Breaks at the next call instruction"""
nextcall(*args)
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def stepover(*args):
"""Sets a breakpoint on the instruction after this one"""
pwndbg.next.break_on_next(*args)
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def so(*args):
stepover(*args)