diff options
author | Tim Newsome <tim@sifive.com> | 2022-07-07 10:55:25 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2022-11-29 13:18:47 -0800 |
commit | ae6bc129ef362ce2ef7c9ec3865461ab3e9432d2 (patch) | |
tree | 71c34ebc7500a89eb69bd11151194d7feca276cf /debug/gdbserver.py | |
parent | 0786374794da5e33ad96f787d9918d368a54c012 (diff) | |
download | riscv-tests-ae6bc129ef362ce2ef7c9ec3865461ab3e9432d2.zip riscv-tests-ae6bc129ef362ce2ef7c9ec3865461ab3e9432d2.tar.gz riscv-tests-ae6bc129ef362ce2ef7c9ec3865461ab3e9432d2.tar.bz2 |
Check basic debugging still works in CeaseMulticeasetest2
Diffstat (limited to 'debug/gdbserver.py')
-rwxr-xr-x | debug/gdbserver.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 3cb7f32..8f72b35 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -1845,9 +1845,11 @@ class CeaseRunSingleTest(ProgramTest): except CouldNotReadRegisters: pass -class CeaseMultiTest(ProgramTest): +class CeaseMultiTest(GdbTest): """Test that we work correctly when a hart ceases to respond (e.g. because it's powered down).""" + compile_args = ("programs/counting_loop.c", "-DDEFINE_MALLOC", + "-DDEFINE_FREE") def early_applicable(self): return self.hart.support_cease and len(self.target.harts) > 1 @@ -1859,22 +1861,32 @@ class CeaseMultiTest(ProgramTest): def test(self): # Run all the way to the infinite loop in exit self.gdb.c(wait=False) - self.gdb.expect(r"Hart became unavailable.") + self.gdb.expect(r"became unavailable.") self.gdb.interrupt() for hart in self.target.harts: - # Try to read the PC on the ceased harts + # Try to select the ceased harts. if hart != self.hart: - self.gdb.select_hart(hart) try: - self.gdb.p("$misa") + self.gdb.select_hart(hart) assert False, "Shouldn't be able " \ "to access unavailable hart." - except (testlib.CouldNotFetch, testlib.CouldNotReadRegisters): + except testlib.UnknownThread: pass + # Check that the main hart can still be debugged. self.gdb.select_hart(self.hart) + main_addr = self.gdb.p("$pc=main") self.gdb.stepi() + # Assume the first instruction of main is not a jump. + pc = self.gdb.p("$pc") + assertGreater(pc, main_addr) + assertLess(pc, main_addr + 8) + + self.gdb.p("$pc=_start") + self.gdb.stepi() #<<< + self.gdb.stepi() #<<< + self.exit() class FreeRtosTest(GdbTest): def early_applicable(self): |