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/profiling/benchmark_cache/gdbscript2.py

17 lines
574 B
Python

import pwndbg
if hasattr(pwndbg.lib, 'memoize'):
# In old versions of Pwndbg, before https://github.com/pwndbg/pwndbg/pull/1678
clear_caches = pwndbg.lib.memoize.reset
print("Using old version of Pwndbg with lib.memoize")
else:
clear_caches = pwndbg.lib.cache.clear_caches
print("Using new version of Pwndbg with lib.cache")
pwndbg.profiling.profiler.start()
for i in range(500):
gdb.execute("pi pwndbg.commands.context.context()", to_string=True)
#clear_caches() # <-- explicitly commented out
pwndbg.profiling.profiler.stop('profile.prof')