From 68c253cead6d12aa52ab822f5e084dc26082db66 Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Sun, 14 Jun 2015 17:59:14 -0400 Subject: [PATCH] Fix case when there is no page known at the module address --- pwndbg/symbol.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pwndbg/symbol.py b/pwndbg/symbol.py index e358e0a36..faf383431 100644 --- a/pwndbg/symbol.py +++ b/pwndbg/symbol.py @@ -83,6 +83,14 @@ def add_main_exe_to_symbols(): exe = pwndbg.elf.exe() addr = exe.address - path = pwndbg.vmmap.find(addr).objfile - if addr and path: + + if not addr: + return + + mmap = pwndbg.vmmap.find(addr) + if not mmap: + return + + path = mmap.objfile + if path: gdb.execute('add-symbol-file %s %#x' % (path, addr), from_tty=False, to_string=True)