Fix OnlyWithArch invocations (cymbol command) (#1574)

pull/1575/head
Disconnect3d 3 years ago committed by GitHub
parent 606ad31300
commit 3ee589062c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -265,6 +265,11 @@ def OnlyWhenQemuKernel(function):
def OnlyWithArch(arch_names: List[str]):
"""Decorates function to work only with the specified archictectures."""
for arch in arch_names:
if arch not in pwndbg.gdblib.arch_mod.ARCHS:
raise ValueError(
f"OnlyWithArch used with unsupported arch={arch}. Must be one of {', '.join(arch_names)}"
)
def decorator(function):
@functools.wraps(function)

@ -249,7 +249,7 @@ parser.add_argument(
@pwndbg.commands.ArgparsedCommand(parser)
@pwndbg.commands.OnlyWithArch(["x86_64"])
@pwndbg.commands.OnlyWithArch(["x86-64"])
@pwndbg.commands.OnlyWhenRunning
def cymbol(add, remove, edit, load, show) -> None:
if add:

@ -7,7 +7,7 @@ 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")
ARCHS = ("x86-64", "i386", "aarch64", "mips", "powerpc", "sparc", "arm", "armcm")
# mapping between gdb and pwntools arch names
pwnlib_archs_mapping = {

Loading…
Cancel
Save