X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=debug%2Ftestlib.py;h=6adc43ad6586ad8e11f14fb9e7d549e2d8f21cf0;hb=4dddbc79ada7f0a836cf538676c57c8df103ccf6;hp=1d46b6c4a59cd93279595bba63a8115b780007d9;hpb=3e972b3d78bc62914d6920c06cc9e99ef82ed492;p=riscv-tests.git diff --git a/debug/testlib.py b/debug/testlib.py index 1d46b6c..6adc43a 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -552,6 +552,18 @@ class Gdb(object): value = shlex.split(output.split('=')[-1].strip())[1] return value + def info_registers(self, group): + output = self.command("info registers %s" % group) + result = {} + for line in output.splitlines(): + if "Could not fetch" in line: + name, value = line.split(None, 1) + else: + name, hex_value, _ = line.split(None, 2) + value = int(hex_value, 0) + result[name] = value + return result + def stepi(self): output = self.command("stepi", ops=10) return output