diff options
author | Tim Newsome <tim@sifive.com> | 2017-09-29 13:20:30 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2017-09-29 13:20:30 -0700 |
commit | 49fc83aa23045abee5d396ef5a9d96b80c03178d (patch) | |
tree | ed08e848af4aa837d690860b7e87fe3000b69891 /debug/gdbserver.py | |
parent | b9957ef9690dc83c684e113294b068fe676b468a (diff) | |
download | riscv-tests-49fc83aa23045abee5d396ef5a9d96b80c03178d.zip riscv-tests-49fc83aa23045abee5d396ef5a9d96b80c03178d.tar.gz riscv-tests-49fc83aa23045abee5d396ef5a9d96b80c03178d.tar.bz2 |
Fix tests to work in multi-gdb mode.
The Gdb class now can handle connecting to more than one gdb. It
enumerates the harts across all connections, and when asked to select a
hart, it transparently sends future gdb commands to the correct
instance.
Multicore tests still have to be aware of some differences. The main one
is that when executing 'c' in RTOS mode, all harts resume, while in
multi-gdb mode only the current one resumes. Additionally, gdb doesn't
set breakpoints until 'c' is issued, so the hart where breakpoints are
set needs to be resumed before other harts might see them.
Diffstat (limited to 'debug/gdbserver.py')
-rwxr-xr-x | debug/gdbserver.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py index 135dab8..924f42a 100755 --- a/debug/gdbserver.py +++ b/debug/gdbserver.py @@ -363,7 +363,7 @@ class Hwbp2(DebugTest): self.exit() class TooManyHwbp(DebugTest): - def run(self): + def test(self): for i in range(30): self.gdb.hbreak("*rot13 + %d" % (i * 4)) @@ -476,21 +476,27 @@ class MulticoreRegTest(GdbTest): def test(self): # Run to main + # Hart 0 is the first to be resumed, so we have to set the breakpoint + # there. gdb won't actually set the breakpoint until we tell it to + # resume. + self.gdb.select_hart(self.target.harts[0]) self.gdb.b("main") - self.gdb.c() - for t in self.gdb.threads(): - assertIn("main", t.frame) + self.gdb.c_all() + for hart in self.target.harts: + self.gdb.select_hart(hart) + assertIn("main", self.gdb.where()) + self.gdb.select_hart(self.target.harts[0]) self.gdb.command("delete breakpoints") # Run through the entire loop. self.gdb.b("main_end") - self.gdb.c() + self.gdb.c_all() hart_ids = [] - for t in self.gdb.threads(): - assertIn("main_end", t.frame) + for hart in self.target.harts: + self.gdb.select_hart(hart) + assertIn("main_end", self.gdb.where()) # Check register values. - self.gdb.thread(t) hart_id = self.gdb.p("$x1") assertNotIn(hart_id, hart_ids) hart_ids.append(hart_id) @@ -505,12 +511,11 @@ class MulticoreRegTest(GdbTest): self.gdb.select_hart(hart) self.gdb.p("$x1=0x%x" % (hart.index * 0x800)) self.gdb.p("$pc=main_post_csrr") - self.gdb.c() - for t in self.gdb.threads(): - assertIn("main_end", t.frame) + self.gdb.c_all() for hart in self.target.harts: - # Check register values. self.gdb.select_hart(hart) + assertIn("main", self.gdb.where()) + # Check register values. for n in range(1, 32): value = self.gdb.p("$x%d" % n) assertEqual(value, hart.index * 0x800 + n - 1) |