From 87fe5d437b64cc1355bbc7a271bf7dab59d277e5 Mon Sep 17 00:00:00 2001 From: Tobias Platen Date: Wed, 15 Apr 2020 18:38:00 +0200 Subject: [PATCH] fix a bug in QemuController.get_register --- src/soc/simulator/qemu.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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') -- 2.30.2