Skip to content

Commit f4197b8

Browse files
committed
-Mre=Debug,ALL: indicate regex state stack pushes
At this maximal level of debugging output, it displays the top 3 state stack entries each time it pushes, but with no obvious indication that a push is occurring. This commit changes this output: | 1| Setting an EVAL scope, savestack=9, | 2| #4 WHILEM_A_max | 2| #3 WHILEM_A_max | 2| #2 CURLYX_end yes 0 <abcdef> <g> | 2| 4:POSIXD[\w](5) to be this (which includes the word "push" and extra indentation for the stack dump): | 1| Setting an EVAL scope, savestack=9, | 2| push #4 WHILEM_A_max | 2| #3 WHILEM_A_max | 2| #2 CURLYX_end yes 0 <abcdef> <g> | 2| 4:POSIXD[\w](5) Also, replace curd (current depth) var with a positive integer offset (i) var, to avoid signed/unsigned mixing problems.
1 parent 4b9c7ca commit f4197b8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

regexec.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8520,16 +8520,17 @@ NULL
85208520
DEBUG_STACK_r({
85218521
regmatch_state *cur = st;
85228522
regmatch_state *curyes = yes_state;
8523-
int curd = depth;
8523+
U32 i;
85248524
regmatch_slab *slab = PL_regmatch_slab;
8525-
for (;curd > -1 && (depth-curd < 3);cur--,curd--) {
8525+
for (i = 0; i < 3 && i <= depth; cur--,i++) {
85268526
if (cur < SLAB_FIRST(slab)) {
85278527
slab = slab->prev;
85288528
cur = SLAB_LAST(slab);
85298529
}
8530-
Perl_re_exec_indentf( aTHX_ "#%-3d %-10s %s\n",
8530+
Perl_re_exec_indentf( aTHX_ "%4s #%-3d %-10s %s\n",
85318531
depth,
8532-
curd, PL_reg_name[cur->resume_state],
8532+
i ? " " : "push",
8533+
depth - i, PL_reg_name[cur->resume_state],
85338534
(curyes == cur) ? "yes" : ""
85348535
);
85358536
if (curyes == cur)

0 commit comments

Comments
 (0)