[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5439-gf48672bb
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5439-gf48672bb |
Date: |
Thu, 21 Dec 2023 12:56:59 -0500 (EST) |
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-5.3-stable has been updated
via f48672bba12d1abde280ba7eafc0dbdba7a7680a (commit)
from f346791bba5d53a516571e9826805d884097a1fa (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=f48672bba12d1abde280ba7eafc0dbdba7a7680a
commit f48672bba12d1abde280ba7eafc0dbdba7a7680a
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Dec 21 19:56:35 2023 +0200
Additional fix in printing arrays from the debugger.
diff --git a/ChangeLog b/ChangeLog
index 8b4a0125..1d7e0bfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-12-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ Fix multidimensional array printing in the debugger, again.
+ Thanks again to Hermann Peifer for the report.
+
+ * debug.c (print_array): Maintain a stack of array names
+ and indexes, and print it when printing the value.
+ (print_array_names): New function.
+
2023-12-21 Arnold D. Robbins <arnold@skeeve.com>
Try to close a race condition window on SIGPIPE. See the thread at
diff --git a/debug.c b/debug.c
index 028e2096..28211ab3 100644
--- a/debug.c
+++ b/debug.c
@@ -1084,6 +1084,18 @@ print_field(long field_num)
}
}
+/* print_array_names --- print the stack of array names */
+
+static void
+print_array_names(const char **names, size_t num_names, FILE *out_fp)
+{
+ size_t i;
+
+ gprintf(out_fp, "%s", names[0]);
+ for (i = 1; i < num_names; i++)
+ gprintf(out_fp, "[\"%s\"]", names[i]);
+}
+
/* print_array --- print the contents of an array */
static int
@@ -1096,7 +1108,18 @@ print_array(volatile NODE *arr, char *arr_name)
volatile NODE *r;
volatile int ret = 0;
volatile jmp_buf pager_quit_tag_stack;
- static int level = 0;
+
+ // manage a stack of names for printing deeply nested arrays
+ static const char **names = NULL;
+ static size_t cur_name = 0;
+ static size_t num_names = 0;
+#define INITIAL_NAME_COUNT 10
+
+ if (names == NULL) {
+ emalloc(names, const char **, INITIAL_NAME_COUNT * sizeof(char
*), "print_array");
+ memset(names, 0, INITIAL_NAME_COUNT * sizeof(char *));
+ num_names = INITIAL_NAME_COUNT;
+ }
if (assoc_empty((NODE *) arr)) {
gprintf(out_fp, _("array `%s' is empty\n"), arr_name);
@@ -1109,19 +1132,22 @@ print_array(volatile NODE *arr, char *arr_name)
list = assoc_list((NODE *) arr, "@ind_str_asc", SORTED_IN);
PUSH_BINDING(pager_quit_tag_stack, pager_quit_tag,
pager_quit_tag_valid);
- // level variable is so that we can print things like a[1][2][3] = 123
correctly.
if (setjmp(pager_quit_tag) == 0) {
- level++;
+ // push name onto stack
+ if (cur_name >= num_names) {
+ num_names *= 2;
+ erealloc(names, const char **, num_names * sizeof(char
*), "print_array");
+ }
+ names[cur_name++] = arr_name;
+
+ // and print the array
for (i = 0; ret == 0 && i < num_elems; i++) {
subs = list[i];
r = *assoc_lookup((NODE *) arr, subs);
- if (level == 1)
- gprintf(out_fp, "%s", arr_name);
if (r->type == Node_var_array) {
- if (level >= 1)
- gprintf(out_fp, "[\"%.*s\"]", (int)
subs->stlen, subs->stptr);
ret = print_array(r, r->vname);
} else {
+ print_array_names(names, cur_name, out_fp);
gprintf(out_fp, "[\"%.*s\"] = ", (int)
subs->stlen, subs->stptr);
valinfo((NODE *) r, gprintf, out_fp);
}
@@ -1130,11 +1156,11 @@ print_array(volatile NODE *arr, char *arr_name)
ret = 1;
POP_BINDING(pager_quit_tag_stack, pager_quit_tag, pager_quit_tag_valid);
+ cur_name--;
for (i = 0; i < num_elems; i++)
unref(list[i]);
efree(list);
- level--;
return ret;
}
diff --git a/pc/ChangeLog b/pc/ChangeLog
index fd3c949d..1f401126 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2023-12-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2023-12-12 Eli Zaretskii <eliz@gnu.org>
* gawkmisc.pc (optimal_bufsize): Return DEFBLKSIZE for directories
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index b3189394..bf993437 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -222,7 +222,7 @@ GAWK_EXT_TESTS = \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
typeof4 typeof5 typeof6 unicode1 watchpoint1 \
- re_test typeof7 typeof8 dbugarray1
+ re_test typeof7 typeof8 dbugarray1 dbugarray2
ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
@@ -244,7 +244,7 @@ SHLIB_TESTS = \
# List of the tests which should be run with --debug option:
NEED_DEBUG = dbugtypedre1 dbugtypedre2 dbugeval2 dbugeval3 dbugeval4 \
- dbugarray1
+ dbugarray1 dbugarray2
# List of the tests which should be run with --lint option:
@@ -3655,6 +3655,11 @@ dbugarray1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+dbugarray2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
double1:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/ChangeLog b/test/ChangeLog
index 706c2a40..6ce1077d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2023-12-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): New test: dbugarray2.
+ * dbugarray2.awk, dbugarray2.in, dbugarray2.ok: New files.
+
2023-12-02 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): New test: dbugarray1.
diff --git a/test/Makefile.am b/test/Makefile.am
index 6742022c..ee590467 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -247,6 +247,9 @@ EXTRA_DIST = \
dbugarray1.awk \
dbugarray1.in \
dbugarray1.ok \
+ dbugarray2.awk \
+ dbugarray2.in \
+ dbugarray2.ok \
dbugeval.in \
dbugeval.ok \
dbugeval2.awk \
@@ -1577,7 +1580,7 @@ GAWK_EXT_TESTS = \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
typeof4 typeof5 typeof6 unicode1 watchpoint1 \
- re_test typeof7 typeof8 dbugarray1
+ re_test typeof7 typeof8 dbugarray1 dbugarray2
ARRAYDEBUG_TESTS = arrdbg
@@ -1602,7 +1605,7 @@ SHLIB_TESTS = \
# List of the tests which should be run with --debug option:
NEED_DEBUG = dbugtypedre1 dbugtypedre2 dbugeval2 dbugeval3 dbugeval4 \
- dbugarray1
+ dbugarray1 dbugarray2
# List of the tests which should be run with --lint option:
NEED_LINT = \
diff --git a/test/Makefile.in b/test/Makefile.in
index 5c14be7d..9e421a35 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -511,6 +511,9 @@ EXTRA_DIST = \
dbugarray1.awk \
dbugarray1.in \
dbugarray1.ok \
+ dbugarray2.awk \
+ dbugarray2.in \
+ dbugarray2.ok \
dbugeval.in \
dbugeval.ok \
dbugeval2.awk \
@@ -1841,7 +1844,7 @@ GAWK_EXT_TESTS = \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
typeof4 typeof5 typeof6 unicode1 watchpoint1 \
- re_test typeof7 typeof8 dbugarray1
+ re_test typeof7 typeof8 dbugarray1 dbugarray2
ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
@@ -1863,7 +1866,7 @@ SHLIB_TESTS = \
# List of the tests which should be run with --debug option:
NEED_DEBUG = dbugtypedre1 dbugtypedre2 dbugeval2 dbugeval3 dbugeval4 \
- dbugarray1
+ dbugarray1 dbugarray2
# List of the tests which should be run with --lint option:
@@ -5451,6 +5454,11 @@ dbugarray1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+dbugarray2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
double1:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 9c2bf4f5..73be058a 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -2334,6 +2334,11 @@ dbugarray1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+dbugarray2:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
double1:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
diff --git a/test/dbugarray2.awk b/test/dbugarray2.awk
new file mode 100644
index 00000000..5af79228
--- /dev/null
+++ b/test/dbugarray2.awk
@@ -0,0 +1,4 @@
+BEGIN {
+ c[1][1] = 11
+ c[1][2] = 12
+}
diff --git a/test/dbugarray2.in b/test/dbugarray2.in
new file mode 100644
index 00000000..3050c914
--- /dev/null
+++ b/test/dbugarray2.in
@@ -0,0 +1,3 @@
+run
+print @c
+quit
diff --git a/test/dbugarray2.ok b/test/dbugarray2.ok
new file mode 100644
index 00000000..afa27fb0
--- /dev/null
+++ b/test/dbugarray2.ok
@@ -0,0 +1,4 @@
+Starting program:
+Program exited normally with exit value: 0
+c["1"]["1"] = 11
+c["1"]["2"] = 12
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 9 +++++++++
debug.c | 42 ++++++++++++++++++++++++++++++++++--------
pc/ChangeLog | 4 ++++
pc/Makefile.tst | 9 +++++++--
test/ChangeLog | 5 +++++
test/Makefile.am | 7 +++++--
test/Makefile.in | 12 ++++++++++--
test/Maketests | 5 +++++
test/dbugarray2.awk | 4 ++++
test/dbugarray2.in | 3 +++
test/dbugarray2.ok | 4 ++++
11 files changed, 90 insertions(+), 14 deletions(-)
create mode 100644 test/dbugarray2.awk
create mode 100644 test/dbugarray2.in
create mode 100644 test/dbugarray2.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5439-gf48672bb,
Arnold Robbins <=