aboutsummaryrefslogtreecommitdiff
path: root/debug
diff options
context:
space:
mode:
Diffstat (limited to 'debug')
-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