Skip to content

Commit

Permalink
Fixed #559: ensure that __gef_default_main_arena__ restores its origi…
Browse files Browse the repository at this point in the history
…nal value when attaching to another process
  • Loading branch information
hugsy committed Aug 26, 2020
1 parent 5d5efae commit e7e6296
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -7,4 +7,5 @@ tests/pylint.html
tests/pylint.txt
tests/pylint3.html
.vscode
_build
_build
debug.log
3 changes: 3 additions & 0 deletions gef.py
Expand Up @@ -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


Expand Down

0 comments on commit e7e6296

Please sign in to comment.