Test step over invalid instruction.
authorTim Newsome <tim@sifive.com>
Wed, 22 Jun 2016 02:20:27 +0000 (19:20 -0700)
committerTim Newsome <tim@sifive.com>
Tue, 19 Jul 2016 01:51:54 +0000 (18:51 -0700)
debug/gdbserver.py
debug/programs/step.S

index 030b6a17aba70386b8a77fc220a5bcf4e843ef19..f7d8d2ebfb6a83cfed233870b00b34eb25b1f097 100755 (executable)
@@ -302,10 +302,10 @@ class StepTest(DeleteServer):
 
     def test_step(self):
         main = self.gdb.p("$pc")
-        for expected in (4, 0xc, 0x10, 0x18, 0x14, 0x14):
+        for expected in (4, 8, 0xc, 0x10, 0x18, 0x1c, 0x28, 0x20, 0x2c, 0x2c):
             self.gdb.stepi()
             pc = self.gdb.p("$pc")
-            self.assertEqual(pc - main, expected)
+            self.assertEqual("%x" % pc, "%x" % (expected + main))
 
 class RegsTest(DeleteServer):
     def setUp(self):
index 49f82d69ded2e894957d064fad468bb0e06f1302..6601548a5614fe158693dbbb3464a6f1b0dd9fc7 100644 (file)
@@ -3,15 +3,22 @@
         .global main
 
 main:
-        li      t0, 5                   // 0
-        beq     zero, zero, one         // 0x4
-        nop                             // 0x8
+        la      t0, trap_entry          // 0, 4
+        csrw    mtvec, t0               // 0x8
+
+        li      t0, 5                   // 0xc
+        beq     zero, zero, one         // 0x10
+        nop                             // 0x14
 one:
-        beq     zero, t0, one           // 0xc
-        jal     two                     // 0x10
+        beq     zero, t0, one           // 0x18
+        jal     two                     // 0x1c
 
 three:
-        j       three                   // 0x14
+        .word   0                       // 0x20
+        nop                             // 0x24
 
 two:
-        ret                             // 0x18
+        ret                             // 0x28
+
+trap_entry:
+        j       trap_entry              // 0x2c