aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2017-07-31 13:49:34 -0700
committerTim Newsome <tim@sifive.com>2017-07-31 13:49:34 -0700
commitea9e37ff1411a8648710b5539b0971bb5ae9571f (patch)
tree272c3236d5a03123ff705a914f16bdb81805ea12
parentccdbc82219827853a4152ff37fc1eab6602bf83e (diff)
downloadriscv-tests-ea9e37ff1411a8648710b5539b0971bb5ae9571f.zip
riscv-tests-ea9e37ff1411a8648710b5539b0971bb5ae9571f.tar.gz
riscv-tests-ea9e37ff1411a8648710b5539b0971bb5ae9571f.tar.bz2
Fix the end of MulticoreTest.
Now it actually confirms that we're talking to two different cores which have different values in their registers. Previously it could have been fooled if eg. the thread command was a nop.
-rwxr-xr-xdebug/gdbserver.py52
1 files changed, 22 insertions, 30 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py
index 80985fd..dea9990 100755
--- a/debug/gdbserver.py
+++ b/debug/gdbserver.py
@@ -421,29 +421,27 @@ class MulticoreTest(GdbTest):
def setup(self):
self.gdb.load()
- self.gdb.b("main")
- self.gdb.b("main_end")
- self.gdb.command("set non-stop on")
- self.gdb.c()
def test(self):
threads = self.gdb.threads()
if len(threads) < 2:
return 'not_applicable'
- # Run through the entire loop.
+
for t in threads:
self.gdb.thread(t)
self.gdb.p("$pc=_start")
+
# Run to main
- for t in threads:
- self.gdb.thread(t)
- self.gdb.c()
+ self.gdb.b("main")
+ self.gdb.c()
for t in self.gdb.threads():
assertIn("main", t.frame)
- # Run to end
- for t in threads:
- self.gdb.thread(t)
- self.gdb.c()
+ self.gdb.command("delete breakpoints")
+
+ # Run through the entire loop.
+ self.gdb.b("main_end")
+ self.gdb.c()
+
hart_ids = []
for t in self.gdb.threads():
assertIn("main_end", t.frame)
@@ -459,24 +457,18 @@ class MulticoreTest(GdbTest):
# Confirmed that we read different register values for different harts.
# Write a new value to x1, and run through the add sequence again.
- # This part isn't working right, because gdb doesn't resume Thread 2
- # when asked. I don't know the root cause for that, but up to this
- # point the test is still useful.
-
-# for t in threads:
-# self.gdb.thread(t)
-# self.gdb.p("$x1=0x%x" % (int(t.id) + 0x800))
-# self.gdb.p("$pc=main_post_csrr")
-# for t in threads:
-# self.gdb.thread(t)
-# self.gdb.c()
-# for t in self.gdb.threads():
-# assertIn("main_end", t.frame)
-# # Check register values.
-# self.gdb.thread(t)
-# for n in range(1, 32):
-# value = self.gdb.p("$x%d" % n)
-# assertEqual(value, int(t.id) + 0x800 + n - 1)
+ for t in threads:
+ self.gdb.thread(t)
+ self.gdb.p("$x1=0x%x" % (int(t.id) * 0x800))
+ self.gdb.p("$pc=main_post_csrr")
+ self.gdb.c()
+ for t in self.gdb.threads():
+ assertIn("main_end", t.frame)
+ # Check register values.
+ self.gdb.thread(t)
+ for n in range(1, 32):
+ value = self.gdb.p("$x%d" % n)
+ assertEqual(value, int(t.id) * 0x800 + n - 1)
class StepTest(GdbTest):
compile_args = ("programs/step.S", )