Re-enable name-defined type checks in auxv.py (#2058)

pull/2059/head
Gulshan Singh 2 years ago committed by GitHub
parent 5be38a5bf3
commit 037cb8a1f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,7 +2,6 @@ from __future__ import annotations
import os
import re
import sys
from typing import Dict
from typing import Optional
from typing import Union
@ -81,9 +80,7 @@ AT_CONSTANTS = {
37: "AT_L3_CACHESHAPE",
}
sys.modules[__name__].__dict__.update({v: k for k, v in AT_CONSTANTS.items()})
AT_NAMES = set(AT_CONSTANTS.values())
AT_CONSTANT_NAMES = {v: k for k, v in AT_CONSTANTS.items()}
class AUXV(Dict[str, Union[int, str]]):
@ -110,7 +107,7 @@ class AUXV(Dict[str, Union[int, str]]):
self[name] = value
def __getattr__(self, attr: str) -> Optional[Union[int, str]]:
if attr in AT_NAMES:
if attr in AT_CONSTANT_NAMES:
return self.get(attr)
raise AttributeError("%r object has no attribute %r" % (self.__class__.__name__, attr))
@ -236,7 +233,7 @@ def walk_stack2(offset: int = 0) -> AUXV:
# guaranteed to actually get us to AT_NULL, just to some
# consecutive NULLs. QEMU is pretty generous with NULLs.
for i in range(1024):
if p.dereference() == AT_BASE:
if p.dereference() == AT_CONSTANT_NAMES["AT_BASE"]:
break
p -= 2
else:
@ -255,7 +252,7 @@ def walk_stack2(offset: int = 0) -> AUXV:
const = int((p + 0).dereference()) & pwndbg.gdblib.arch.ptrmask
value = int((p + 1).dereference()) & pwndbg.gdblib.arch.ptrmask
if const == AT_NULL:
if const == AT_CONSTANT_NAMES["AT_NULL"]:
break
auxv.set(const, value)

@ -87,7 +87,6 @@ module = [
# Module fields
"pwndbg.gdblib.typeinfo",
"pwndbg.gdblib.elf",
"pwndbg.auxv",
]
disable_error_code = ["name-defined"]

Loading…
Cancel
Save