From d326a75e6ae359b7d547c08987dd9939df794d14 Mon Sep 17 00:00:00 2001 From: Gulshan Singh Date: Fri, 3 Jun 2016 16:04:24 -0700 Subject: [PATCH] Don't run prompt_hook_on_stop if binary is not running (#39) --- pwndbg/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py index 8e7074ba8..3f5aae973 100755 --- a/pwndbg/__init__.py +++ b/pwndbg/__init__.py @@ -14,10 +14,10 @@ import pwndbg.disasm.sparc import pwndbg.disasm.x86 try: - import unicorn - import pwndbg.emu + import unicorn + import pwndbg.emu except: - pass + pass import pwndbg.vmmap import pwndbg.dt @@ -124,7 +124,7 @@ handle SIGSEGV stop print nopass """.strip() % prompt for line in pre_commands.strip().splitlines(): - gdb.execute(line) + gdb.execute(line) msg = "Loaded %i commands. Type pwndbg for a list." % len(pwndbg.commands._Command.commands) print(pwndbg.color.red(msg)) @@ -139,7 +139,9 @@ def prompt_hook(*a): pwndbg.events.after_reload() cur = new - prompt_hook_on_stop(*a) + if pwndbg.proc.alive: + prompt_hook_on_stop(*a) + @pwndbg.memoize.reset_on_stop def prompt_hook_on_stop(*a):