gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-771


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-771-g20d333a
Date: Tue, 24 Nov 2015 20:59:43 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.1-stable has been updated
       via  20d333afbaadde8a8daa4091e22cf549c6954a6a (commit)
      from  0300d4581c543ddbd2f307782650a0978ff6bdd8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=20d333afbaadde8a8daa4091e22cf549c6954a6a

commit 20d333afbaadde8a8daa4091e22cf549c6954a6a
Author: Arnold D. Robbins <address@hidden>
Date:   Tue Nov 24 22:59:21 2015 +0200

    Make watchpoints fire before breakpoints in the debugger.

diff --git a/ChangeLog b/ChangeLog
index 1e5b3d0..0d0f613 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-24         Arnold D. Robbins     <address@hidden>
+
+       * debug.c (debug_pre_execute): Fix to check watchpoints before
+       checking breakpoints. Gives more natural behavior for the user.
+       * NEWS: Document this.
+
 2015-10-28         Arnold D. Robbins     <address@hidden>
 
        * awkgram.y (nextc): Don't allow '\0' even if check_for_bad
diff --git a/NEWS b/NEWS
index 6cc254a..ccc28a3 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ Changes from 4.1.3 to 4.1.x
 
 2. z/OS support updated.
 
+3. At the beginning of each statement, the debugger now checks and
+   reports watchpoints that have fired before checking for breakpoints.
+   This gives more natural behavior to the user.
+
 Changes from 4.1.2 to 4.1.3
 ---------------------------
 
diff --git a/debug.c b/debug.c
index 5d7db01..7699924 100644
--- a/debug.c
+++ b/debug.c
@@ -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)
diff --git a/test/ChangeLog b/test/ChangeLog
index 83174b0..cc709b5 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-24         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (watchpoint1): New test.
+       * watchpoint1.awk, watchpoint1.in, watchpoint1.ok,
+       watchpoint1.script: New files.
+
 2015-10-28         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (nulinsrc): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 97cf8d5..779a106 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -987,6 +987,10 @@ EXTRA_DIST = \
        uparrfs.awk \
        uparrfs.in \
        uparrfs.ok \
+       watchpoint1.awk \
+       watchpoint1.in \
+       watchpoint1.ok \
+       watchpoint1.script \
        wideidx.awk \
        wideidx.in \
        wideidx.ok \
@@ -1084,7 +1088,8 @@ GAWK_EXT_TESTS = \
        rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \
        splitarg4 strftime \
        strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \
-       symtab7 symtab8 symtab9
+       symtab7 symtab8 symtab9 \
+       watchpoint1
 
 EXTRA_TESTS = inftest regtest
 
@@ -2101,6 +2106,11 @@ muldimposix::
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden --posix >_$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+watchpoint1:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -D -f address@hidden address@hidden < 
address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 # Targets generated for other tests:
 include Maketests
 
diff --git a/test/Makefile.in b/test/Makefile.in
index 90b994c..eb7748a 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1244,6 +1244,10 @@ EXTRA_DIST = \
        uparrfs.awk \
        uparrfs.in \
        uparrfs.ok \
+       watchpoint1.awk \
+       watchpoint1.in \
+       watchpoint1.ok \
+       watchpoint1.script \
        wideidx.awk \
        wideidx.in \
        wideidx.ok \
@@ -1340,7 +1344,8 @@ GAWK_EXT_TESTS = \
        rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \
        splitarg4 strftime \
        strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \
-       symtab7 symtab8 symtab9
+       symtab7 symtab8 symtab9 \
+       watchpoint1
 
 EXTRA_TESTS = inftest regtest
 INET_TESTS = inetdayu inetdayt inetechu inetecht
@@ -2539,6 +2544,11 @@ muldimposix::
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden --posix >_$@ 2>&1 || echo 
EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+watchpoint1:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -D -f address@hidden address@hidden < 
address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 Gt-dummy:
 # file Maketests, generated from Makefile.am by the Gentests program
 addcomma:
diff --git a/test/watchpoint1.awk b/test/watchpoint1.awk
new file mode 100644
index 0000000..5e7e941
--- /dev/null
+++ b/test/watchpoint1.awk
@@ -0,0 +1,14 @@
+#! /usr/bin/gawk -f
+BEGIN {
+     c = 0
+}
+
+/apple/ {
+     nr = NR
+     c++
+     # printf "[c, NR] = [%s, %s]\n", c, NR
+}
+
+END {
+    print c
+}
diff --git a/test/watchpoint1.in b/test/watchpoint1.in
new file mode 100644
index 0000000..83ac6f4
--- /dev/null
+++ b/test/watchpoint1.in
@@ -0,0 +1,8 @@
+1 1 pear
+2 1 apple 4
+3 2 pear
+4 3 apple 9
+5 8 pear
+6 9 apple
+7 10 pear
+8 12 apple
diff --git a/test/watchpoint1.ok b/test/watchpoint1.ok
new file mode 100644
index 0000000..b1e7e53
--- /dev/null
+++ b/test/watchpoint1.ok
@@ -0,0 +1,65 @@
+1       #! /usr/bin/gawk -f
+2       BEGIN {
+3            c = 0
+4       }
+5       
+6       /apple/ {
+7            nr = NR
+8            c++
+9            # printf "[c, NR] = [%s, %s]\n", c, NR
+10      }
+11      
+12      END {
+13          print c
+14      }
+Watchpoint 1: c
+1: c = untyped variable
+2: nr = untyped variable
+3: NR = 0
+Breakpoint 2 set at file `watchpoint1.awk', line 6
+Starting program: 
+Stopping in Rule ...
+Watchpoint 1: c
+  Old value: untyped variable
+  New value: 0
+main() at `watchpoint1.awk':6
+6       /apple/ {
+1: c = 0
+2: nr = untyped variable
+3: NR = 1
+Breakpoint 2, main() at `watchpoint1.awk':6
+6       /apple/ {
+1: c = 0
+2: nr = untyped variable
+3: NR = 1
+Breakpoint 2, main() at `watchpoint1.awk':6
+6       /apple/ {
+1: c = 0
+2: nr = untyped variable
+3: NR = 2
+Watchpoint 1: c
+  Old value: 0
+  New value: 1
+main() at `watchpoint1.awk':6
+6       /apple/ {
+1: c = 1
+2: nr = 2
+3: NR = 3
+Breakpoint 2, main() at `watchpoint1.awk':6
+6       /apple/ {
+1: c = 1
+2: nr = 2
+3: NR = 3
+Breakpoint 2, main() at `watchpoint1.awk':6
+6       /apple/ {
+1: c = 1
+2: nr = 2
+3: NR = 4
+Watchpoint 1: c
+  Old value: 1
+  New value: 2
+main() at `watchpoint1.awk':6
+6       /apple/ {
+1: c = 2
+2: nr = 4
+3: NR = 5
diff --git a/test/watchpoint1.script b/test/watchpoint1.script
new file mode 100644
index 0000000..94897d1
--- /dev/null
+++ b/test/watchpoint1.script
@@ -0,0 +1,14 @@
+list
+watch c
+display c
+display nr
+display NR
+break 6
+run
+continue
+continue
+continue
+continue
+continue
+continue
+quit

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |    6 ++++
 NEWS                    |    4 +++
 debug.c                 |   16 ++++++++++-
 test/ChangeLog          |    6 ++++
 test/Makefile.am        |   12 ++++++++-
 test/Makefile.in        |   12 ++++++++-
 test/watchpoint1.awk    |   14 ++++++++++
 test/watchpoint1.in     |    8 ++++++
 test/watchpoint1.ok     |   65 +++++++++++++++++++++++++++++++++++++++++++++++
 test/watchpoint1.script |   14 ++++++++++
 10 files changed, 153 insertions(+), 4 deletions(-)
 create mode 100644 test/watchpoint1.awk
 create mode 100644 test/watchpoint1.in
 create mode 100644 test/watchpoint1.ok
 create mode 100644 test/watchpoint1.script


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]