From b37a57cbafe620601102dab278d6e3e11dcb2b81 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Wed, 8 Aug 2018 14:33:50 -0700 Subject: [PATCH] Add jump/hbreak test. --- debug/gdbserver.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/debug/gdbserver.py b/debug/gdbserver.py index bd9babc..4eb6038 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -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): -- 2.30.2