Fix CustomRegisterTest.
authorTim Newsome <tim@sifive.com>
Fri, 31 Aug 2018 19:53:25 +0000 (12:53 -0700)
committerTim Newsome <tim@sifive.com>
Fri, 31 Aug 2018 19:53:25 +0000 (12:53 -0700)
gdb in riscv-tools doesn't automatically create a "custom" group like
mainline gdb does.

debug/gdbserver.py
debug/testlib.py

index c362e1d..1d58f76 100755 (executable)
@@ -142,7 +142,8 @@ class CustomRegisterTest(SimpleRegisterTest):
         return self.target.implements_custom_test
 
     def check_custom(self, magic):
-        regs = self.gdb.info_registers("custom")
+        regs = {k: v for k, v in self.gdb.info_registers("all").iteritems()
+                if k.startswith("custom")}
         assertEqual(set(regs.keys()),
                 set(("custom1",
                     "custom12345",
index 6adc43a..59440b3 100644 (file)
@@ -556,12 +556,12 @@ class Gdb(object):
         output = self.command("info registers %s" % group)
         result = {}
         for line in output.splitlines():
+            parts = line.split()
+            name = parts[0]
             if "Could not fetch" in line:
-                name, value = line.split(None, 1)
+                result[name] = " ".join(parts[1:])
             else:
-                name, hex_value, _ = line.split(None, 2)
-                value = int(hex_value, 0)
-            result[name] = value
+                result[name] = int(parts[1], 0)
         return result
 
     def stepi(self):