self.assertIn("Breakpoint", output)
self.assertIn("_exit", output)
+ def test_execute_immediate(self):
+ """Test an execute breakpoint on the first instruction executed out of
+ debug mode."""
+ main = self.gdb.p("$pc")
+ self.gdb.command("hbreak *0x%x" % (main + 4))
+ self.gdb.c()
+ self.assertEqual(self.gdb.p("$pc"), main+4)
+
def test_load_address(self):
self.gdb.command("rwatch *((&data)+1)");
output = self.gdb.c()
self.gdb.p("(&data)+1"))
self.exit()
+ def test_load_address_immediate(self):
+ """Test a load address breakpoint on the first instruction executed out
+ of debug mode."""
+ write_loop = self.gdb.p("&write_loop")
+ self.gdb.command("rwatch data");
+ self.gdb.c()
+ self.assertEqual(self.gdb.p("$pc"), write_loop)
+ self.assertEqual(self.gdb.p("$a0"), self.gdb.p("(&data)+1"))
+
def test_store_address(self):
self.gdb.command("watch *((&data)+3)");
output = self.gdb.c()
#undef MCONTROL_TYPE
#undef MCONTROL_DMODE
#ifdef __riscv64
-# define MCONTROL_TYPE (0xfU<<((64)-4))
-# define MCONTROL_DMODE (1U<<((64)-5))
+# define MCONTROL_TYPE (0xf<<(64-4))
+# define MCONTROL_DMODE (1<<(64-5))
#else
-# define MCONTROL_TYPE (0xfU<<((32)-4))
-# define MCONTROL_DMODE (1U<<((32)-5))
+# define MCONTROL_TYPE (0xf<<(32-4))
+# define MCONTROL_DMODE (1<<(32-5))
#endif
.global main
blt t0, t2, read_loop
la a0, data
- li t0, 0
+ li t0, 1
write_loop:
- addi t0, t0, 1
sw t0, 0(a0)
+ addi t0, t0, 1
addi a0, a0, 4
blt t0, t2, write_loop