From 7a52425eb01c058bf259727024cd874cb1ccc76a Mon Sep 17 00:00:00 2001 From: Sudhakar Verma Date: Fri, 4 Jan 2019 16:40:45 +0530 Subject: [PATCH] Only get pc for r2 when the process is running --- pwndbg/commands/radare2.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pwndbg/commands/radare2.py b/pwndbg/commands/radare2.py index 37392dbe5d..a87ea6e755 100644 --- a/pwndbg/commands/radare2.py +++ b/pwndbg/commands/radare2.py @@ -25,11 +25,12 @@ def r2(arguments, no_seek=False): # Build up the command line to run cmd = ['radare2', filename] - addr = pwndbg.regs.pc - if pwndbg.elf.get_elf_info(filename).is_pie: - addr -= pwndbg.elf.exe().address - if not no_seek and pwndbg.proc.alive: - cmd.extend(['-s', hex(addr)]) + if pwndbg.proc.alive: + addr = pwndbg.regs.pc + if pwndbg.elf.get_elf_info(filename).is_pie: + addr -= pwndbg.elf.exe().address + if not no_seek: + cmd.extend(['-s', hex(addr)]) cmd += arguments try: