[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] 'watch' in gawk debugger gives wrong NR
From: |
Joep van Delft |
Subject: |
Re: [bug-gawk] 'watch' in gawk debugger gives wrong NR |
Date: |
Thu, 10 Dec 2015 00:39:54 +0100 |
User-agent: |
XS4ALL Webmail |
Hi Arnold,
Only found time to look at what was committed now; sorry for bringing
this to your attention again after such a long time.
Aharon Robbins schreef op 2015-11-28 22:26:
The strange ordering you're seeing is the result of breakpoints being
checked before watchpoints. I have changed the code to check
watchpoints
first. If you can build from the git repo, you will see behavior that
makes more sense.
This has not been the problem that I am having. Frankly, and with all
respect, I believe that the watchpoint1 test in its current form is
wrong.
If the watchpoint on c triggers, I would assert that nr and NR have the
same values, which currently is not the case.
I believe that this is basically the same issue as Hermann had reported
in "gawk debugger omits watchpoint".
Below you can find a `really_ok` file that might show what I
am after. To generate it, I took a similar approach as Herman: Put a
bogus
statement at the end of the action block (line 9), which magically
convinces
the watchpoint to trigger at a more apt moment.
Comparing the output of the debugger with `trace on` leads me to suspect
that if the watchpoint trigger could somehow be hooked into Op_no_op,
this
minor issue could be resolved.
Kind regards,
Joep
% cat watchpoint1.really_ok
1 #! /usr/bin/gawk -f
2 BEGIN {
3 c = 0
4 }
5
6 /apple/ {
7 nr = NR
8 c++
9 1+1 # <-- New statement added to watchpoint1.awk
10 # printf "[c, NR] = [%s, %s]\n", c, NR
11 }
12
13 END {
14 print c
15 }
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':9
9 1+1
1: c = 1
2: nr = 2
3: NR = 2
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':9
9 1+1
1: c = 2
2: nr = 4
3: NR = 4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [bug-gawk] 'watch' in gawk debugger gives wrong NR,
Joep van Delft <=