dump.c: Dump contents of regexps’ mother_re field
authorFather Chrysostomos <sprout@cpan.org>
Fri, 9 Aug 2013 19:56:03 +0000 (12:56 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 10 Aug 2013 02:28:34 +0000 (19:28 -0700)
This can make debugging easier if one needs to see the reference count
of the parent regular expression.

dump.c
ext/Devel-Peek/t/Peek.t

diff --git a/dump.c b/dump.c
index 1d24f35..6c4ae04 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -2187,6 +2187,9 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
                                PTR2UV(r->engine));
            Perl_dump_indent(aTHX_ level, file, "  MOTHER_RE = 0x%"UVxf"\n",
                                PTR2UV(r->mother_re));
+           if (nest < maxnest && r->mother_re)
+               do_sv_dump(level+1, file, (SV *)r->mother_re, nest+1,
+                          maxnest, dumpops, pvlim);
            Perl_dump_indent(aTHX_ level, file, "  PAREN_NAMES = 0x%"UVxf"\n",
                                PTR2UV(r->paren_names));
            Perl_dump_indent(aTHX_ level, file, "  SUBSTRS = 0x%"UVxf"\n",
index 76a5c7a..32e6f1e 100644 (file)
@@ -355,7 +355,35 @@ do_test('reference to regexp',
     SUBCOFFSET = 0
     SUBBEG = 0x0
     ENGINE = $ADDR
-    MOTHER_RE = $ADDR
+    MOTHER_RE = $ADDR'
+. ($] < 5.019003 ? '' : '
+    SV = REGEXP\($ADDR\) at $ADDR
+      REFCNT = 2
+      FLAGS = \(\)
+      PV = $ADDR "\(\?\^:tic\)"
+      CUR = 8
+      COMPFLAGS = 0x0 \(\)
+      EXTFLAGS = 0x680000 \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\)
+      INTFLAGS = 0x0
+      NPARENS = 0
+      LASTPAREN = 0
+      LASTCLOSEPAREN = 0
+      MINLEN = 3
+      MINLENRET = 3
+      GOFS = 0
+      PRE_PREFIX = 4
+      SUBLEN = 0
+      SUBOFFSET = 0
+      SUBCOFFSET = 0
+      SUBBEG = 0x0
+      ENGINE = $ADDR
+      MOTHER_RE = 0x0
+      PAREN_NAMES = 0x0
+      SUBSTRS = $ADDR
+      PPRIVATE = $ADDR
+      OFFS = $ADDR
+      QR_ANONCV = 0x0(?:
+      SAVED_COPY = 0x0)?') . '
     PAREN_NAMES = 0x0
     SUBSTRS = $ADDR
     PPRIVATE = $ADDR
@@ -1074,7 +1102,35 @@ do_test('UTF-8 in a regular expression',
     SUBCOFFSET = 0
     SUBBEG = 0x0
     ENGINE = $ADDR
-    MOTHER_RE = $ADDR
+    MOTHER_RE = $ADDR'
+. ($] < 5.019003 ? '' : '
+    SV = REGEXP\($ADDR\) at $ADDR
+      REFCNT = 2
+      FLAGS = \(UTF8\)
+      PV = $ADDR "\(\?\^u:\\\\\\\\x\{100\}\)" \[UTF8 "\(\?\^u:\\\\\\\\x\{100\}\)"\]
+      CUR = 13
+      COMPFLAGS = 0x0 \(\)
+      EXTFLAGS = 0x680040 \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\)
+      INTFLAGS = 0x0
+      NPARENS = 0
+      LASTPAREN = 0
+      LASTCLOSEPAREN = 0
+      MINLEN = 1
+      MINLENRET = 1
+      GOFS = 0
+      PRE_PREFIX = 5
+      SUBLEN = 0
+      SUBOFFSET = 0
+      SUBCOFFSET = 0
+      SUBBEG = 0x0
+      ENGINE = $ADDR
+      MOTHER_RE = 0x0
+      PAREN_NAMES = 0x0
+      SUBSTRS = $ADDR
+      PPRIVATE = $ADDR
+      OFFS = $ADDR
+      QR_ANONCV = 0x0(?:
+      SAVED_COPY = 0x0)?') . '
     PAREN_NAMES = 0x0
     SUBSTRS = $ADDR
     PPRIVATE = $ADDR