Skip to content

Commit

Permalink
Fix context regs regression that broke reg order (#993)
Browse files Browse the repository at this point in the history
Fixes a bug I added in #972 which lost the order of registers
Fixes #986
  • Loading branch information
Grazfather authored Aug 16, 2023
1 parent 67c363d commit 9f79363
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 9f79363

Please sign in to comment.