From 5767fe30cb92b991e5f435ad95172dbbd515c34b Mon Sep 17 00:00:00 2001 From: Gulshan Singh Date: Wed, 4 Jan 2023 20:39:11 -0800 Subject: [PATCH] Implement __contains__ for reg module (#1504) --- pwndbg/gdblib/regs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pwndbg/gdblib/regs.py b/pwndbg/gdblib/regs.py index 6e97896e7..3ca63f170 100644 --- a/pwndbg/gdblib/regs.py +++ b/pwndbg/gdblib/regs.py @@ -94,6 +94,10 @@ class module(ModuleType): return item + def __contains__(self, reg): + regs = set(reg_sets[pwndbg.gdblib.arch.current]) | {"pc", "sp"} + return reg in regs + def __iter__(self): regs = set(reg_sets[pwndbg.gdblib.arch.current]) | {"pc", "sp"} for item in regs: