Add hwbp test (currently doesn't pass).
[riscv-tests.git] / debug / testlib.py
index f654d437d0cb0655458ef983b6a44290545cc51a..f8c8062f2b9c05d9416d90099d3e84611924b2d8 100644 (file)
@@ -42,13 +42,15 @@ def unused_port():
     return port
 
 class Spike(object):
-    def __init__(self, cmd, binary=None, halted=False, with_gdb=True, timeout=None):
+    def __init__(self, cmd, binary=None, halted=False, with_gdb=True, timeout=None,
+            xlen=64):
         """Launch spike. Return tuple of its process and the port it's running on."""
         if cmd:
             cmd = shlex.split(cmd)
         else:
             cmd = ["spike"]
-        cmd.append("-l")    #<<<
+        if (xlen == 32):
+            cmd += ["--isa", "RV32"]
 
         if timeout:
             cmd = ["timeout", str(timeout)] + cmd
@@ -105,6 +107,7 @@ class Gdb(object):
         self.child = pexpect.spawn(path)
         self.child.logfile = file("gdb.log", "w")
         self.wait()
+        self.command("set confirm off")
         self.command("set width 0")
         self.command("set height 0")
         # Force consistency.
@@ -159,3 +162,9 @@ class Gdb(object):
         assert "not defined" not in output
         assert "Breakpoint" in output
         return output
+
+    def hbreak(self, location):
+        output = self.command("hbreak %s" % location)
+        assert "not defined" not in output
+        assert "Breakpoint" in output
+        return output