diff options
author | Greg Savin <greg.savin@sifive.com> | 2022-02-09 10:04:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-09 10:04:52 -0800 |
commit | f0c75d35e585147043f3b1d879a24e42f4f50c03 (patch) | |
tree | 20c865d728afac56fb0d9d001c3c8a797e5f7d85 /debug/gdbserver.py | |
parent | cf04274f50621fd9ef9147793cca6dd1657985c7 (diff) | |
download | riscv-tests-f0c75d35e585147043f3b1d879a24e42f4f50c03.zip riscv-tests-f0c75d35e585147043f3b1d879a24e42f4f50c03.tar.gz riscv-tests-f0c75d35e585147043f3b1d879a24e42f4f50c03.tar.bz2 |
Debug test to check that stepping doesn't inappropriately switch to Thread 1 (#369)
Diffstat (limited to 'debug/gdbserver.py')
-rwxr-xr-x | debug/gdbserver.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py index e75cbdf..5cf9b8e 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -1788,6 +1788,27 @@ class FreeRtosTest(GdbTest): self.gdb.thread(thread) assertEqual(self.gdb.p("$s11"), values[thread.id] ^ int(thread.id)) +class StepThread2Test(GdbTest): + # Check that we can do stepi on thread 2 without GDB switching to thread 1. + # There was a bug where this could happen, because OpenOCD was mistakenly + # omitting a thread ID in its stop reply. This was addressed in OpenOCD, + # but if there is a regression in the future, this test should catch it) + + def early_applicable(self): + return len(self.target.harts) > 1 + + def test(self): + output = self.gdb.command("thread 2") + if "Unknown thread" in output: + raise TestNotApplicable + before = self.gdb.command("thread") + self.gdb.stepi() + after = self.gdb.command("thread") + # make sure that single-step doesn't alter + # GDB's conception of the current thread + assertEqual(before, after) + + parsed = None def main(): parser = argparse.ArgumentParser( |