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.
DEBUG_STACK_r({
regmatch_state *cur = st;
regmatch_state *curyes = yes_state;
- int curd = depth;
+ U32 i;
regmatch_slab *slab = PL_regmatch_slab;
- for (;curd > -1 && (depth-curd < 3);cur--,curd--) {
+ for (i = 0; i < 3 && i <= depth; cur--,i++) {
if (cur < SLAB_FIRST(slab)) {
slab = slab->prev;
cur = SLAB_LAST(slab);
}
- Perl_re_exec_indentf( aTHX_ "#%-3d %-10s %s\n",
+ Perl_re_exec_indentf( aTHX_ "%4s #%-3d %-10s %s\n",
depth,
- curd, PL_reg_name[cur->resume_state],
+ i ? " " : "push",
+ depth - i, PL_reg_name[cur->resume_state],
(curyes == cur) ? "yes" : ""
);
if (curyes == cur)