diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py index 004085a4e..e48742f24 100755 --- a/pwndbg/__init__.py +++ b/pwndbg/__init__.py @@ -30,6 +30,7 @@ import pwndbg.commands.hexdump import pwndbg.commands.ida import pwndbg.commands.leakfind import pwndbg.commands.misc +import pwndbg.commands.memoize import pwndbg.commands.mprotect import pwndbg.commands.next import pwndbg.commands.peda @@ -161,5 +162,5 @@ signal.signal(signal.SIGWINCH, lambda signum, frame: gdb.execute("set width %i" if 1: gdb.execute('set remote search-memory-packet off') -# Reading Comment file +# Reading Comment file pwndbg.commands.comments.init() diff --git a/pwndbg/commands/memoize.py b/pwndbg/commands/memoize.py new file mode 100644 index 000000000..4ff2cb41c --- /dev/null +++ b/pwndbg/commands/memoize.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import argparse + +import pwndbg.commands +from pwndbg.color import message + +parser = argparse.ArgumentParser(description=''' +Toggles memoization (caching). Pwndbg will work slower when it's off, however +it's useful for diagnosing caching-related bugs. +''') + +@pwndbg.commands.ArgparsedCommand(parser) +def memoize(): + pwndbg.memoize.memoize.caching = not pwndbg.memoize.memoize.caching + + status = message.off('OFF (pwndbg will work slower, use only for debugging pwndbg)') + if pwndbg.memoize.memoize.caching: + status = message.on('ON') + + print("Caching is now %s" % status)