+class InstantHaltTest(unittest.TestCase):
+ def setUp(self):
+ self.binary = testlib.compile("debug.c")
+ self.spike, self.port = testlib.spike(self.binary, halted=True)
+ self.gdb = testlib.Gdb()
+ self.gdb.command("file %s" % self.binary)
+ self.gdb.command("target extended-remote localhost:%d" % self.port)
+
+ def tearDown(self):
+ self.spike.kill()
+ self.spike.wait()
+
+ def test_instant_halt(self):
+ self.assertEqual(0x1000, self.gdb.p("$pc"))
+ # For some reason instret resets to 0.
+ self.assertLess(self.gdb.p("$instret"), 8)
+ self.gdb.command("stepi")
+ self.assertNotEqual(0x1000, self.gdb.p("$pc"))
+