From 9f7936389cf8df15e8459d38639ac715128ace3e Mon Sep 17 00:00:00 2001 From: Grazfather Date: Wed, 16 Aug 2023 12:54:59 -0400 Subject: [PATCH] Fix context regs regression that broke reg order (#993) Fixes a bug I added in #972 which lost the order of registers Fixes #986 --- gef.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gef.py b/gef.py index 023881259..5435c79e6 100644 --- a/gef.py +++ b/gef.py @@ -6772,11 +6772,9 @@ def do_invoke(self, _: List[str], **kwargs: Any) -> None: args : argparse.Namespace = kwargs["arguments"] if args.registers and args.registers[0]: - requested_regs = set(args.registers) - valid_regs = set(gef.arch.all_registers) & requested_regs - if valid_regs: - regs = valid_regs - invalid_regs = requested_regs - valid_regs + all_regs = set(gef.arch.all_registers) + regs = [reg for reg in args.registers if reg in all_regs] + invalid_regs = [reg for reg in args.registers if reg not in all_regs] if invalid_regs: err(f"invalid registers for architecture: {', '.join(invalid_regs)}") @@ -7356,9 +7354,10 @@ def context_regs(self) -> None: self.context_title("registers") ignored_registers = set(self["ignore_registers"].split()) + # Defer to DetailRegisters by default if self["show_registers_raw"] is False: - regs = set(gef.arch.all_registers) - printable_registers = " ".join(regs - ignored_registers) + regs = [reg for reg in gef.arch.all_registers if reg not in ignored_registers] + printable_registers = " ".join(regs) gdb.execute(f"registers {printable_registers}") return