aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-11-24 23:04:32 +0200
committerArnold D. Robbins <arnold@skeeve.com>2015-11-24 23:04:32 +0200
commitced373985f55a20cc43370801647f33474530a9a (patch)
treec792d8ece43cd410e321d73ce2e35d4604d660c7 /debug.c
parentc5ebd2f5f3b286d2c95895239c3f0861c75b7b5f (diff)
parent4ab2029a091a88a3b1968c55468b8c91ae1e6a2d (diff)
downloadegawk-ced373985f55a20cc43370801647f33474530a9a.tar.gz
egawk-ced373985f55a20cc43370801647f33474530a9a.tar.bz2
egawk-ced373985f55a20cc43370801647f33474530a9a.zip
Merge branch 'master' into feature/cmake
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/debug.c b/debug.c
index 2bb6e53a..01e30ee3 100644
--- a/debug.c
+++ b/debug.c
@@ -3658,8 +3658,20 @@ debug_pre_execute(INSTRUCTION **pi)
assert(sourceline > 0);
- if (check_breakpoint(pi)
- || check_watchpoint()
+ /*
+ * 11/2015: This used to check breakpoints first, but that could
+ * produce strange behavior, where a watchpoint doesn't print until
+ * some time after the data changed. This reworks things so that
+ * watchpoints are checked first. It's a bit of a hack, but
+ * the behavior for the user is more logical.
+ */
+ if (check_watchpoint()) {
+ next_command(); /* return to debugger interface */
+ if (stop.command == D_return)
+ *pi = stop.pc; /* jump to this instruction */
+ else if (cur_pc->opcode == Op_breakpoint)
+ cur_pc = cur_pc->nexti; /* skip past the breakpoint instruction */
+ } else if (check_breakpoint(pi)
|| (stop.check_func && stop.check_func(pi))) {
next_command(); /* return to debugger interface */
if (stop.command == D_return)