From ea5b409feeab4fb1045212dd5c205a14ec334b3a Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Thu, 21 Apr 2016 14:12:03 -0700 Subject: [PATCH] Add proc.tid --- pwndbg/proc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pwndbg/proc.py b/pwndbg/proc.py index 643442b5e..fb9c66fdc 100644 --- a/pwndbg/proc.py +++ b/pwndbg/proc.py @@ -26,6 +26,17 @@ class module(ModuleType): return i.pid return 0 + @property + def tid(self): + if pwndbg.qemu.is_qemu_usermode(): + return pwndbg.qemu.pid() + + i = gdb.selected_thread() + if i is not None: + return i.ptid[1] + + return self.pid + @property def alive(self): return gdb.selected_thread() is not None