From e7e6296c61ee0a94f94654301886fd6963b6597c Mon Sep 17 00:00:00 2001 From: hugsy Date: Tue, 25 Aug 2020 19:01:47 -0700 Subject: [PATCH] Fixed #559: ensure that __gef_default_main_arena__ restores its original value when attaching to another process --- .gitignore | 3 ++- gef.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4d6d4ceb5..563fe730e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ tests/pylint.html tests/pylint.txt tests/pylint3.html .vscode -_build \ No newline at end of file +_build +debug.log \ No newline at end of file diff --git a/gef.py b/gef.py index bda27a0da..f1ad62e99 100644 --- a/gef.py +++ b/gef.py @@ -185,11 +185,14 @@ def update_gef(argv): def reset_all_caches(): """Free all caches. If an object is cached, it will have a callable attribute `cache_clear` which will be invoked to purge the function cache.""" + global __gef_default_main_arena__ for mod in dir(sys.modules["__main__"]): obj = getattr(sys.modules["__main__"], mod) if hasattr(obj, "cache_clear"): obj.cache_clear() + + __gef_default_main_arena__ = "main_arena" return