aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--symbol.c4
-rw-r--r--test/ChangeLog6
-rw-r--r--test/Makefile.am10
-rw-r--r--test/Makefile.in10
-rw-r--r--test/symtab10.awk1
-rw-r--r--test/symtab10.in4
-rw-r--r--test/symtab10.ok11
8 files changed, 50 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index bbc4c94d..922f4f06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * symbol.c (lookup): If got Node_val, it's a non-variable
+ in SYMTAB, return NULL. Can affect watchpoints in the debugger,
+ maybe other places. Thanks to Hermann Peifer for the
+ test case and report.
+
2016-06-05 Arnold D. Robbins <arnold@skeeve.com>
* dfa.c: Sync with GNU grep.
diff --git a/symbol.c b/symbol.c
index 84574e7b..8533fad6 100644
--- a/symbol.c
+++ b/symbol.c
@@ -117,7 +117,9 @@ lookup(const char *name)
}
unref(tmp);
- return n; /* NULL or new place */
+ if (n == NULL || n->type == Node_val) /* non-variable in SYMTAB */
+ return NULL;
+ return n; /* new place */
}
/* make_params --- allocate function parameters for the symbol table */
diff --git a/test/ChangeLog b/test/ChangeLog
index 02f083d6..83b45460 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * symtab10.awk, symtab10.in, symtab10.ok: New files.
+ * Makefile.am (symtab10): New test.
+ Thanks to Hermann Peifer for the report.
+
2016-06-01 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (hex2): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 7cd37fdd..1f1646e9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -986,6 +986,9 @@ EXTRA_DIST = \
symtab8.ok \
symtab9.awk \
symtab9.ok \
+ symtab10.awk \
+ symtab10.in \
+ symtab10.ok \
synerr1.awk \
synerr1.ok \
synerr2.awk \
@@ -1117,7 +1120,7 @@ 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 symtab10 \
watchpoint1
EXTRA_TESTS = inftest regtest
@@ -2159,6 +2162,11 @@ rscompat:
@AWKPATH="$(srcdir)" $(AWK) --traditional -f $@.awk "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+symtab10:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk < "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
# Targets generated for other tests:
include Maketests
diff --git a/test/Makefile.in b/test/Makefile.in
index 23f50afc..df874d1b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1243,6 +1243,9 @@ EXTRA_DIST = \
symtab8.ok \
symtab9.awk \
symtab9.ok \
+ symtab10.awk \
+ symtab10.in \
+ symtab10.ok \
synerr1.awk \
synerr1.ok \
synerr2.awk \
@@ -1373,7 +1376,7 @@ 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 symtab10 \
watchpoint1
EXTRA_TESTS = inftest regtest
@@ -2597,6 +2600,11 @@ rscompat:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) --traditional -f $@.awk "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+symtab10:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk < "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
Gt-dummy:
# file Maketests, generated from Makefile.am by the Gentests program
addcomma:
diff --git a/test/symtab10.awk b/test/symtab10.awk
new file mode 100644
index 00000000..6fbd3994
--- /dev/null
+++ b/test/symtab10.awk
@@ -0,0 +1 @@
+BEGIN { SYMTAB["x"] ; y=1 ; y++ }
diff --git a/test/symtab10.in b/test/symtab10.in
new file mode 100644
index 00000000..d9afcd66
--- /dev/null
+++ b/test/symtab10.in
@@ -0,0 +1,4 @@
+watch y
+run
+watch x
+continue
diff --git a/test/symtab10.ok b/test/symtab10.ok
new file mode 100644
index 00000000..b0cabd7c
--- /dev/null
+++ b/test/symtab10.ok
@@ -0,0 +1,11 @@
+Watchpoint 1: y
+Starting program:
+Stopping in BEGIN ...
+Watchpoint 1: y
+ Old value: untyped variable
+ New value: 1
+main() at `symtab10.awk':1
+1 BEGIN { SYMTAB["x"] ; y=1 ; y++ }
+no symbol `x' in current context
+Program exited normally with exit value: 0
+EXIT CODE: 2