This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Clean up -Dy debugging
authorKarl Williamson <khw@cpan.org>
Mon, 18 Nov 2019 21:28:30 +0000 (14:28 -0700)
committerKarl Williamson <khw@cpan.org>
Mon, 18 Nov 2019 21:39:42 +0000 (14:39 -0700)
Commit 5d7580af4b14229eafb27db9b7a34b8b918876b4 didn't have it quite
right.

doop.c
op.c

diff --git a/doop.c b/doop.c
index 1d761d5..2c85c83 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -105,7 +105,7 @@ S_do_trans_simple(pTHX_ SV * const sv, const OPtrans_map * const tbl)
        SvUTF8_on(sv);
        SvSETMAGIC(sv);
     }
-    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %" IVdf "\n",
+    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %zu\n",
                                           __FILE__, __LINE__, matches));
     DEBUG_y(sv_dump(sv));
     return matches;
@@ -159,7 +159,7 @@ S_do_trans_count(pTHX_ SV * const sv, const OPtrans_map * const tbl)
        }
     }
 
-    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: count returning %" IVdf "\n",
+    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: count returning %zu\n",
                                           __FILE__, __LINE__, matches));
     return matches;
 }
@@ -312,7 +312,7 @@ S_do_trans_complex(pTHX_ SV * const sv, const OPtrans_map * const tbl)
        SvUTF8_on(sv);
     }
     SvSETMAGIC(sv);
-    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %" IVdf "\n",
+    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %zu\n",
                                           __FILE__, __LINE__, matches));
     DEBUG_y(sv_dump(sv));
     return matches;
@@ -386,7 +386,7 @@ S_do_trans_count_invmap(pTHX_ SV * const sv, AV * const invmap)
         s += s_len;
     }
 
-    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %" IVdf "\n",
+    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %zu\n",
                                           __FILE__, __LINE__, matches));
     return matches;
 }
@@ -573,7 +573,7 @@ S_do_trans_invmap(pTHX_ SV * const sv, AV * const invmap)
     }
     SvSETMAGIC(sv);
 
-    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %" IVdf "\n",
+    DEBUG_y(PerlIO_printf(Perl_debug_log, "%s: %d: returning %zu\n",
                                           __FILE__, __LINE__, matches));
     DEBUG_y(sv_dump(sv));
     return matches;
diff --git a/op.c b/op.c
index 643db1a..66d773f 100644 (file)
--- a/op.c
+++ b/op.c
@@ -6927,10 +6927,9 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
         SV * inverted_tlist = _new_invlist(tlen);
         Size_t temp_len;
 
-        DEBUG_y(PerlIO_printf(Perl_debug_log, "%d: tstr=%s\n",
-                              __LINE__, _byte_dump_string(t, tend - t, 0)));
-        DEBUG_y(PerlIO_printf(Perl_debug_log, "rstr=%s\n",
-                                        _byte_dump_string(r, rend - r, 0)));
+        DEBUG_y(PerlIO_printf(Perl_debug_log,
+                    "%s: %d: tstr before inversion=\n%s\n",
+                    __FILE__, __LINE__, _byte_dump_string(t, tend - t, 0)));
 
         while (t < tend) {
 
@@ -6968,7 +6967,6 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
 
         /* The inversion list is done; now invert it */
         _invlist_invert(inverted_tlist);
-        DEBUG_y(sv_dump(inverted_tlist));
 
         /* Now go through the inverted list and create a new tstr for the rest
          * of the routine to use.  Since the UTF-8 version can have ranges, and
@@ -7642,9 +7640,9 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
                     r_map[i+2] = TR_UNLISTED;
                 }
                 DEBUG_yv(PerlIO_printf(Perl_debug_log,
-                            "After iteration: span=%" IVdf ", t_range_count=%"
-                            IVdf ", r_range_count=%" IVdf "\n",
-                            span, t_range_count, r_range_count));
+                          "After iteration: span=%" UVuf ", t_range_count=%"
+                          UVuf " r_range_count=%" UVuf "\n",
+                          span, t_range_count, r_range_count));
                 DEBUG_yv(invmap_dump(t_invlist, r_map));
             } /* End of this chunk needs to be processed */
 
@@ -7856,6 +7854,16 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
 
     }
 
+    DEBUG_y(PerlIO_printf(Perl_debug_log,
+            "/d=%d, /s=%d, /c=%d, identical=%d, grows=%d,"
+            " use_svop=%d, can_force_utf8=%d,\nexpansion=%g\n",
+            del, squash, complement,
+            cBOOL(o->op_private & OPpTRANS_IDENTICAL),
+            cBOOL(o->op_private & OPpTRANS_USE_SVOP),
+            cBOOL(o->op_private & OPpTRANS_GROWS),
+            cBOOL(o->op_private & OPpTRANS_CAN_FORCE_UTF8),
+            max_expansion));
+
     Safefree(r_map);
 
     if(del && rlen != 0 && r_count == t_count) {