Skip to content

Commit

Permalink
Debugger fix (#32)
Browse files Browse the repository at this point in the history
fixed an issue where debugger had an error when trying to dump registers. It tried to use get() method instead of get_f() method. Also changed format of floating point registers to show up as floats instead of Hex.
  • Loading branch information
KGrykiel authored Jul 12, 2023
1 parent 07265f2 commit 3b89387
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions riscemu/registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def dump_reg_a(self):
)

def _reg_repr(self, reg: str, name_len=4, fmt="08X"):
txt = "{:{}}=0x{:{}}".format(reg, name_len, self.get(reg, False), fmt)
if reg in self.float_regs:
txt = "{:{}}={: .3e}".format(reg, name_len, self.get_f(reg, False))
else:
txt = "{:{}}=0x{:{}}".format(reg, name_len, self.get(reg, False), fmt)
if reg == "fp":
reg = "s0"
if reg == self.last_set:
Expand All @@ -156,7 +159,13 @@ def _reg_repr(self, reg: str, name_len=4, fmt="08X"):
return FMT_ORANGE + FMT_UNDERLINE + txt + FMT_NONE
if reg == "zero":
return txt
if self.get(reg, False) == 0 and reg not in Registers.named_registers():
should_grayscale_int = (
reg in self.valid_regs
and self.get(reg, False) == 0
and reg not in Registers.named_registers()
)
should_grayscale_float = reg in self.float_regs and self.get_f(reg, False) == 0
if should_grayscale_int or should_grayscale_float:
return FMT_GRAY + txt + FMT_NONE
return txt

Expand Down

0 comments on commit 3b89387

Please sign in to comment.