Test resuming from a trigger.
authorTim Newsome <tim@sifive.com>
Fri, 9 Feb 2018 16:54:59 +0000 (08:54 -0800)
committerTim Newsome <tim@sifive.com>
Fri, 9 Feb 2018 16:54:59 +0000 (08:54 -0800)
debug/gdbserver.py
debug/programs/trigger.S
debug/testlib.py

index 8c500bcf80109b8f051d32d1130e0f4fcdebe5d6..f0385d568441b3eeb8d1d73dc5f71b19b2a7d221 100755 (executable)
@@ -660,12 +660,17 @@ class TriggerLoadAddressInstant(TriggerTest):
         self.gdb.command("b just_before_read_loop")
         self.gdb.c()
         read_loop = self.gdb.p("&read_loop")
+        read_again = self.gdb.p("&read_again")
         self.gdb.command("rwatch data")
         self.gdb.c()
         # Accept hitting the breakpoint before or after the load instruction.
         assertIn(self.gdb.p("$pc"), [read_loop, read_loop + 4])
         assertEqual(self.gdb.p("$a0"), self.gdb.p("&data"))
 
+        self.gdb.c()
+        assertIn(self.gdb.p("$pc"), [read_again, read_again + 4])
+        assertEqual(self.gdb.p("$a0"), self.gdb.p("&data"))
+
 # FIXME: Triggers aren't quite working yet
 #class TriggerStoreAddress(TriggerTest):
 #    def test(self):
index 3d502dc45887e4fdcf56b8857b0a680283d8d789..13f044978c830ecf31e72dfecc14503ccf4ef7db 100644 (file)
@@ -8,16 +8,6 @@
 # define LREG lw
 # define SREG sw
 # define REGBYTES 4
-#endif
-
-#undef MCONTROL_TYPE
-#undef MCONTROL_DMODE
-#if __riscv_xlen == 64
-# define MCONTROL_TYPE    (0xf<<(64-4))
-# define MCONTROL_DMODE   (1<<(64-5))
-#else
-# define MCONTROL_TYPE    (0xf<<(32-4))
-# define MCONTROL_DMODE   (1<<(32-5))
 #endif
 
         .global         main
@@ -31,7 +21,10 @@ just_before_read_loop:
         li      t2, 16
 read_loop:
         lw      t1, 0(a0)
+        addi    t1, t1, 1
         addi    t0, t0, 1
+read_again:
+        lw      t1, 0(a0)
         addi    a0, a0, 4
         blt     t0, t2, read_loop
 
index 7727f10d5af2947b8b2ec3de39fd74d5f3185a45..3aaa542a5c76dce60bf92ca485119e2045b3dbe0 100644 (file)
@@ -835,6 +835,7 @@ class GdbTest(BaseTest):
         if not self.gdb:
             return
         self.gdb.interrupt()
+        self.gdb.command("disassemble")
         self.gdb.command("info registers all", timeout=10)
 
     def classTeardown(self):