aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2018-10-05 12:28:32 -0700
committerTim Newsome <tim@sifive.com>2018-10-05 12:28:32 -0700
commitacc87e14d9a6e4e6c3f019e79cb5c047162228c1 (patch)
tree9e3b5594e6f7b09422c39222842eb7029542be51
parent6ac2c6350757a07b4469f37eca61bf44854f41c6 (diff)
downloadriscv-tests-acc87e14d9a6e4e6c3f019e79cb5c047162228c1.zip
riscv-tests-acc87e14d9a6e4e6c3f019e79cb5c047162228c1.tar.gz
riscv-tests-acc87e14d9a6e4e6c3f019e79cb5c047162228c1.tar.bz2
Make HwWatchpoint test fail on incorrect result.hw_watchpoint
Also tiny cleanups, making pylint happy.
-rwxr-xr-xdebug/gdbserver.py13
-rw-r--r--debug/programs/counting_loop.c2
-rw-r--r--debug/testlib.py2
3 files changed, 10 insertions, 7 deletions
diff --git a/debug/gdbserver.py b/debug/gdbserver.py
index eaf390f..e17cf8d 100755
--- a/debug/gdbserver.py
+++ b/debug/gdbserver.py
@@ -306,7 +306,8 @@ class InstantChangePc(GdbTest):
class ProgramTest(GdbSingleHartTest):
# Include malloc so that gdb can make function calls. I suspect this malloc
# will silently blow through the memory set aside for it, so be careful.
- compile_args = ("programs/counting_loop.c", "-DDEFINE_MALLOC", "-DDEFINE_FREE")
+ compile_args = ("programs/counting_loop.c", "-DDEFINE_MALLOC",
+ "-DDEFINE_FREE")
def setup(self):
self.gdb.load()
@@ -325,10 +326,12 @@ class ProgramHwWatchpoint(ProgramTest):
assertIn("Breakpoint", output)
assertIn("main", output)
self.gdb.watch("counter == 5")
- # Currently the watchpoint is generating a trap at init and all updates
- for _ in range(11):
- output = self.gdb.c()
- assertIn("Trace/breakpoint trap", output)
+ # Watchpoint hits when counter becomes 5.
+ output = self.gdb.c()
+ assertEqual(self.gdb.p("counter"), 5)
+ # Watchpoint hits when counter no longer is 5.
+ output = self.gdb.c()
+ assertEqual(self.gdb.p("counter"), 6)
# The watchpoint is going out of scope
output = self.gdb.c()
assertIn("Watchpoint", output)
diff --git a/debug/programs/counting_loop.c b/debug/programs/counting_loop.c
index 2116e52..7c7d600 100644
--- a/debug/programs/counting_loop.c
+++ b/debug/programs/counting_loop.c
@@ -5,7 +5,7 @@
int main()
{
- int sum = 0;
+ int sum = 0;
int counter = 0;
while (counter < 10) {
diff --git a/debug/testlib.py b/debug/testlib.py
index 76f09f9..d278692 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -594,7 +594,7 @@ class Gdb(object):
return output
def swatch(self, expr):
- hstate = self.command("show can-use-hw-watchpoints")
+ self.command("show can-use-hw-watchpoints")
self.command("set can-use-hw-watchpoints 0")
output = self.command("watch %s" % expr, ops=5)
assert "not defined" not in output