mirror of https://github.com/pwndbg/pwndbg.git
Backport use of `pwndbg.aglib.arch.update()` to current upstream (#2373)
parent
9361759620
commit
76eba80747
@ -0,0 +1,4 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from pwndbg.aglib import arch as arch_mod
|
||||||
|
from pwndbg.aglib.arch import arch as arch
|
||||||
@ -1,15 +1,42 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pwndbg
|
import pwndbg
|
||||||
|
from pwndbg.lib.arch import Arch
|
||||||
|
|
||||||
# We will optimize this module in the future, by having it work in the same
|
ARCHS = (
|
||||||
# way the `gdblib` version of it works, and that will come at the same
|
"x86-64",
|
||||||
# time this module gets expanded to have the full feature set of its `gdlib`
|
"i386",
|
||||||
# coutnerpart. For now, though, this should be good enough.
|
"aarch64",
|
||||||
|
"mips",
|
||||||
|
"powerpc",
|
||||||
|
"sparc",
|
||||||
|
"arm",
|
||||||
|
"armcm",
|
||||||
|
"riscv:rv32",
|
||||||
|
"riscv:rv64",
|
||||||
|
"riscv",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def __getattr__(name):
|
# mapping between gdb and pwntools arch names
|
||||||
if name == "endian":
|
pwnlib_archs_mapping = {
|
||||||
return pwndbg.dbg.selected_inferior().arch().endian
|
"x86-64": "amd64",
|
||||||
elif name == "ptrsize":
|
"i386": "i386",
|
||||||
return pwndbg.dbg.selected_inferior().arch().ptrsize
|
"aarch64": "aarch64",
|
||||||
|
"mips": "mips",
|
||||||
|
"powerpc": "powerpc",
|
||||||
|
"sparc": "sparc",
|
||||||
|
"arm": "arm",
|
||||||
|
"iwmmxt": "arm",
|
||||||
|
"armcm": "thumb",
|
||||||
|
"rv32": "riscv32",
|
||||||
|
"rv64": "riscv64",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
arch: Arch = Arch("i386", 4, "little")
|
||||||
|
|
||||||
|
|
||||||
|
def update() -> None:
|
||||||
|
a = pwndbg.dbg.selected_inferior().arch()
|
||||||
|
arch.update(a.name, a.ptrsize, a.endian)
|
||||||
|
|||||||
Loading…
Reference in new issue