Delete dead code in regs.py (#779)

I believe the `arch_to_regs[pwndbg.arch.current][item]` is a dead code.

I stumbled upon this during debugging one of other issues and:
* The `arch_to_regs` is a dict mapping str -> RegisterSet objects
* So `arch_to_regs[pwndbg.arch.current]` gets a `RegisterSet`
* Now, the `RegisterSet` doesn't have a subscription (the `__getitem__` magic method)

This can also be seen below:
```
>>> pwndbg.regs.arch_to_regs
{'i386': <pwndbg.regs.RegisterSet object at 0x7f931020b048>, 'x86-64': <pwndbg.regs.RegisterSet object at 0x7f931020b080>, 'mips': <pwndbg.regs.RegisterSet object at 0x7f9310212f98>, 'sparc': <pwndbg.regs.RegisterSet object at 0x7f9310212b38>, 'arm': <pwndbg.regs.RegisterSet object at 0x7f930ee7a6a0>, 'armcm': <pwndbg.regs.RegisterSet object at 0x7f930ee7aba8>, 'aarch64': <pwndbg.regs.RegisterSet object at 0x7f931020b0b8>, 'powerpc': <pwndbg.regs.RegisterSet object at 0x7f9310212518>}
>>> pwndbg.arch.current
'x86-64'
>>> pwndbg.regs.arch_to_regs[pwndbg.arch.current]
<pwndbg.regs.RegisterSet object at 0x7f931020b080>
>>> pwndbg.regs.arch_to_regs[pwndbg.arch.current]['$rax']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'RegisterSet' object is not subscriptable
>>> pwndbg.regs.arch_to_regs[pwndbg.arch.current][0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'RegisterSet' object does not support indexing
>>>
```
pull/783/head
Disconnect3d 6 years ago committed by GitHub
parent 7bad305626
commit 970ac229a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -304,9 +304,6 @@ class module(ModuleType):
@pwndbg.memoize.reset_on_stop
@pwndbg.memoize.reset_on_prompt
def __getitem__(self, item):
if isinstance(item, six.integer_types):
return arch_to_regs[pwndbg.arch.current][item]
if not isinstance(item, six.string_types):
print("Unknown register type: %r" % (item))
import pdb, traceback

Loading…
Cancel
Save