aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-06-22 22:53:02 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-06-22 22:53:02 +0300
commitd43f951d4e8be461fd8be7182a4ff1b219fa8edd (patch)
tree07ed8d2b808e7553b25da7d0cf027a7b82d04458
parent9bf2c3a7bac4abe6c97af4efb2614575279e7b63 (diff)
downloadegawk-d43f951d4e8be461fd8be7182a4ff1b219fa8edd.tar.gz
egawk-d43f951d4e8be461fd8be7182a4ff1b219fa8edd.tar.bz2
egawk-d43f951d4e8be461fd8be7182a4ff1b219fa8edd.zip
Improve debugger support for typed regexps.
-rw-r--r--ChangeLog8
-rw-r--r--awkgram.c2
-rw-r--r--awkgram.y2
-rw-r--r--debug.c8
4 files changed, 20 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f27a324..84792446 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,14 @@
also.
* profile.c (pprint): Add Op_push_arg_untyped.
+ Improve debugger support for typed regexps.
+ Thanks to Hermann Peifer for the bug report.
+
+ * awkgram.y (valinfo): Add support for Node_typedregex.
+ * debug.c (watchpoint_triggerred): Handle Node_typedregex.
+ (initialize_watch_item): Ditto.
+ (print_memory): Ditto.
+
2015-06-21 Arnold D. Robbins <arnold@skeeve.com>
Fixes for typeof - Don't let typeof change an untyped variable
diff --git a/awkgram.c b/awkgram.c
index 6dc4b334..a1a055b6 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6895,6 +6895,8 @@ valinfo(NODE *n, Func_print print_func, FILE *fp)
{
if (n == Nnull_string)
print_func(fp, "uninitialized scalar\n");
+ else if (n->type == Node_typedregex)
+ print_func(fp, "@/%.*s/\n", n->re_exp->stlen, n->re_exp->stptr);
else if ((n->flags & STRING) != 0) {
pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
print_func(fp, "\n");
diff --git a/awkgram.y b/awkgram.y
index e9b66ba6..50fd90a0 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -4475,6 +4475,8 @@ valinfo(NODE *n, Func_print print_func, FILE *fp)
{
if (n == Nnull_string)
print_func(fp, "uninitialized scalar\n");
+ else if (n->type == Node_typedregex)
+ print_func(fp, "@/%.*s/\n", n->re_exp->stlen, n->re_exp->stptr);
else if ((n->flags & STRING) != 0) {
pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
print_func(fp, "\n");
diff --git a/debug.c b/debug.c
index 6aaba099..99106e55 100644
--- a/debug.c
+++ b/debug.c
@@ -1736,6 +1736,8 @@ watchpoint_triggered(struct list_item *w)
/* new != NULL */
if (t2->type == Node_val)
w->cur_value = dupnode(t2);
+ else if (t2->type == Node_typedregex)
+ w->cur_value = dupnode(t2);
else {
w->flags |= CUR_IS_ARRAY;
w->cur_size = (t2->type == Node_var_array) ? assoc_length(t2) : 0;
@@ -1748,6 +1750,7 @@ watchpoint_triggered(struct list_item *w)
w->flags |= CUR_IS_ARRAY;
w->cur_size = assoc_length(t2);
} else
+ /* works for Node_typedregex too */
w->cur_value = dupnode(t2);
}
@@ -1790,6 +1793,8 @@ initialize_watch_item(struct list_item *w)
} else if (symbol->type == Node_var_array) {
w->flags |= CUR_IS_ARRAY;
w->cur_size = assoc_length(symbol);
+ } else if (symbol->type == Node_typedregex) {
+ w->cur_value = dupnode(r);
} /* else
can't happen */
}
@@ -3703,6 +3708,9 @@ print_memory(NODE *m, NODE *func, Func_print print_func, FILE *fp)
print_func(fp, " [%s]", flags2str(m->flags));
break;
+ case Node_typedregex:
+ print_func(fp, "@");
+ /* fall through */
case Node_regex:
pp_string_fp(print_func, fp, m->re_exp->stptr, m->re_exp->stlen, '/', false);
break;