Add jump/hbreak test.
authorTim Newsome <tim@sifive.com>
Wed, 8 Aug 2018 21:33:50 +0000 (14:33 -0700)
committerTim Newsome <tim@sifive.com>
Mon, 13 Aug 2018 21:38:12 +0000 (14:38 -0700)
debug/gdbserver.py

index bd9babc717b5fabfdd2bc75870146de0f1bca37c..4eb6038668c430bcc0715b23be62ff325db76eda 100755 (executable)
@@ -652,6 +652,29 @@ class StepTest(GdbSingleHartTest):
             pc = self.gdb.p("$pc")
             assertEqual("%x" % (pc - main_address), "%x" % expected)
 
+class JumpHbreak(GdbSingleHartTest):
+    """'jump' resumes execution at location. Execution stops again immediately
+    if there is a breakpoint there.
+    That second line can be trouble."""
+    compile_args = ("programs/trigger.S", )
+
+    def early_applicable(self):
+        return self.hart.instruction_hardware_breakpoint_count >= 1
+
+    def setup(self):
+        self.gdb.load()
+        self.gdb.hbreak("main")
+        self.gdb.c()
+        self.gdb.command("delete 1")
+
+    def test(self):
+        self.gdb.b("read_loop")
+        self.gdb.command("hbreak just_before_read_loop")
+        output = self.gdb.command("jump just_before_read_loop")
+        assertRegexpMatches(output, r"Breakpoint \d, just_before_read_loop ")
+        output = self.gdb.c()
+        assertRegexpMatches(output, r"Breakpoint \d, read_loop ")
+
 class TriggerTest(GdbSingleHartTest):
     compile_args = ("programs/trigger.S", )
     def setup(self):