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 c362e1dc03dea441af582c093cbf490eba36101e..1d58f769c2dbe0718cd691e210d6ca0537611aec 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 6adc43ad6586ad8e11f14fb9e7d549e2d8f21cf0..59440b361330cbf472be506cfc6bfa83c2ec3797 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):