arch.py: fix arch detection for riscv (#1962)

* arch.py: fix arch detection for riscv again

* arch.py: fix arch detection for riscv again

* arch.py: fix lint
pull/1969/head
patryk4815 2 years ago committed by GitHub
parent fb2777c065
commit 1507888a1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,7 +9,20 @@ from pwndbg.lib.arch import Arch
# TODO: x86-64 needs to come before i386 in the current implementation, make
# this order-independent
ARCHS = ("x86-64", "i386", "aarch64", "mips", "powerpc", "sparc", "arm", "armcm", "rv32", "rv64")
ARCHS = (
"x86-64",
"i386",
"aarch64",
"mips",
"powerpc",
"sparc",
"arm",
"armcm",
"riscv:rv32",
"riscv:rv64",
"riscv",
)
# mapping between gdb and pwntools arch names
pwnlib_archs_mapping = {
@ -49,6 +62,10 @@ def _get_arch(ptrsize: int):
# Distinguish between Cortex-M and other ARM
if match == "arm" and "-m" in arch:
match = "armcm"
elif match.startswith("riscv:"):
match = match[6:]
elif match == "riscv":
match = "rv64"
return match, ptrsize, endian
if not_exactly_arch:

Loading…
Cancel
Save