diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-11-24 22:59:21 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-11-24 22:59:21 +0200 |
commit | 20d333afbaadde8a8daa4091e22cf549c6954a6a (patch) | |
tree | b9c237acaaaa5ea430e08557b75734d6639c114e /debug.c | |
parent | 0300d4581c543ddbd2f307782650a0978ff6bdd8 (diff) | |
download | egawk-20d333afbaadde8a8daa4091e22cf549c6954a6a.tar.gz egawk-20d333afbaadde8a8daa4091e22cf549c6954a6a.tar.bz2 egawk-20d333afbaadde8a8daa4091e22cf549c6954a6a.zip |
Make watchpoints fire before breakpoints in the debugger.
Diffstat (limited to 'debug.c')
-rw-r--r-- | debug.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -3653,8 +3653,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) |