From: Tobias Platen Date: Wed, 15 Apr 2020 16:38:00 +0000 (+0200) Subject: fix a bug in QemuController.get_register X-Git-Tag: div_pipeline~1435^2~4 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=87fe5d437b64cc1355bbc7a271bf7dab59d277e5;p=soc.git fix a bug in QemuController.get_register --- diff --git a/src/soc/simulator/qemu.py b/src/soc/simulator/qemu.py index 9eb103ba..1669dafe 100644 --- a/src/soc/simulator/qemu.py +++ b/src/soc/simulator/qemu.py @@ -32,10 +32,12 @@ class QemuController: return self.gdb.write('-data-list-register-values x') def get_register(self, num): - res = self.gdb.write('-data-list-register-values x {}'.format(num)) - assert 'register-values' in res[0]['payload'] - val = int(res[0]['payload']['register-values'][0]['value'], 0) - return val + res = self.gdb.write('-data-list-register-values x {}'.format(num),timeout_sec=1.0) # increase this timeout if needed + for x in res: + if(x["type"]=="result"): + assert 'register-values' in x['payload'] + return int(x['payload']['register-values'][0]['value'], 0) + return None def step(self): return self.gdb.write('-exec-next-instruction')