Check all PCs after reset.
[riscv-tests.git] / debug / gdbserver.py
index 37fd698d58bd74a2e9f174e813230f75ffa3d56f..f6c61c3eae7877d9fa99062ebbf947c238832e54 100755 (executable)
@@ -205,7 +205,16 @@ class MemTestBlock(GdbTest):
 
 class InstantHaltTest(GdbTest):
     def test(self):
-        assertEqual(self.target.reset_vector, self.gdb.p("$pc"))
+        """Assert that reset is really resetting what it should."""
+        self.gdb.command("monitor reset halt")
+        self.gdb.command("flushregs")
+        threads = self.gdb.threads()
+        pcs = []
+        for t in threads:
+            self.gdb.thread(t)
+            pcs.append(self.gdb.p("$pc"))
+        for pc in pcs:
+            assertEqual(self.target.reset_vector, pc)
         # mcycle and minstret have no defined reset value.
         mstatus = self.gdb.p("$mstatus")
         assertEqual(mstatus & (MSTATUS_MIE | MSTATUS_MPRV |
@@ -215,6 +224,8 @@ class InstantChangePc(GdbTest):
     def test(self):
         """Change the PC right as we come out of reset."""
         # 0x13 is nop
+        self.gdb.command("monitor reset halt")
+        self.gdb.command("flushregs")
         self.gdb.command("p *((int*) 0x%x)=0x13" % self.target.ram)
         self.gdb.command("p *((int*) 0x%x)=0x13" % (self.target.ram + 4))
         self.gdb.command("p *((int*) 0x%x)=0x13" % (self.target.ram + 8))