4 require Config; import Config;
5 if ($Config{'extensions'} !~ /\bDevel\/Peek\b/) {
6 print "1..0 # Skip: Devel::Peek was not built\n";
16 open(SAVERR, ">&STDERR") or die "Can't dup STDERR: $!";
18 # If I reference any lexicals in this, I get the entire outer subroutine (or
19 # MAIN) dumped too, which isn't really what I want, as it's a lot of faff to
28 use constant thr => $Config{useithreads};
32 my $repeat_todo = $_[4];
34 if (open(OUT,">peek$$")) {
35 open(STDERR, ">&OUT") or die "Can't dup OUT: $!";
37 print STDERR "*****\n";
38 Dump($_[1]); # second dump to compare with the first to make sure nothing changed.
39 open(STDERR, ">&SAVERR") or die "Can't restore STDERR: $!";
41 if (open(IN, "peek$$")) {
43 $pattern =~ s/\$ADDR/0x[[:xdigit:]]+/g;
44 $pattern =~ s/\$FLOAT/(?:\\d*\\.\\d+(?:e[-+]\\d+)?|\\d+)/g;
45 # handle DEBUG_LEAKING_SCALARS prefix
46 $pattern =~ s/^(\s*)(SV =.* at )/(?:$1ALLOCATED at .*?\n)?$1$2/mg;
48 # Need some clear generic mechanism to eliminate (or add) lines
49 # of dump output dependant on perl version. The (previous) use of
50 # things like $IVNV gave the illusion that the string passed in was
51 # a regexp into which variables were interpolated, but this wasn't
52 # actually true as those 'variables' actually also ate the
53 # whitespace on the line. So it seems better to mark lines that
54 # need to be eliminated. I considered (?# ... ) and (?{ ... }),
55 # but whilst embedded code or comment syntax would keep it as a
56 # legitimate regexp, it still isn't true. Seems easier and clearer
57 # things that look like comments.
59 # Could do this is in a s///mge but seems clearer like this:
60 $pattern = join '', map {
61 # If we identify the version condition, take *it* out whatever
64 : $_ # Didn't match, so this line is in
65 } split /^/, $pattern;
67 $pattern =~ s/\$PADMY/
68 ($] < 5.009) ? 'PADBUSY,PADMY' : 'PADMY';
70 $pattern =~ s/\$PADTMP/
71 ($] < 5.009) ? 'PADBUSY,PADTMP' : 'PADTMP';
74 ($] < 5.011) ? 'RV' : 'IV';
77 print $pattern, "\n" if $DEBUG;
78 my ($dump, $dump2) = split m/\*\*\*\*\*\n/, scalar <IN>;
79 print $dump, "\n" if $DEBUG;
80 like( $dump, qr/\A$pattern\Z/ms, $_[0])
81 or note("line " . (caller)[2]);
83 local $TODO = $repeat_todo;
84 is($dump2, $dump, "$_[0] (unchanged by dump)")
85 or note("line " . (caller)[2]);
91 die "$0: failed to open peek$$: !\n";
94 die "$0: failed to create peek$$: $!\n";
104 1 while unlink("peek$$");
107 do_test('assignment of immediate constant (string)',
109 'SV = PV\\($ADDR\\) at $ADDR
111 FLAGS = \\(POK,pPOK\\)
117 do_test('immediate constant (string)',
119 'SV = PV\\($ADDR\\) at $ADDR
121 FLAGS = \\(.*POK,READONLY,pPOK\\)
126 do_test('assignment of immediate constant (integer)',
128 'SV = IV\\($ADDR\\) at $ADDR
130 FLAGS = \\(IOK,pIOK\\)
133 do_test('immediate constant (integer)',
135 'SV = IV\\($ADDR\\) at $ADDR
137 FLAGS = \\(.*IOK,READONLY,pIOK\\)
140 do_test('assignment of immediate constant (integer)',
142 'SV = IV\\($ADDR\\) at $ADDR
144 FLAGS = \\($PADMY,IOK,pIOK\\)
147 # If perl is built with PERL_PRESERVE_IVUV then maths is done as integers
148 # where possible and this scalar will be an IV. If NO_PERL_PRESERVE_IVUV then
149 # maths is done in floating point always, and this scalar will be an NV.
150 # ([NI]) captures the type, referred to by \1 in this regexp and $type for
151 # building subsequent regexps.
152 my $type = do_test('result of addition',
154 'SV = ([NI])V\\($ADDR\\) at $ADDR
156 FLAGS = \\(PADTMP,\1OK,p\1OK\\) # $] < 5.019003
157 FLAGS = \\(\1OK,p\1OK\\) # $] >=5.019003
162 do_test('floating point value',
164 'SV = PVNV\\($ADDR\\) at $ADDR
166 FLAGS = \\(NOK,pNOK\\)
168 NV = 789\\.(?:1(?:000+\d+)?|0999+\d+)
173 do_test('integer constant',
175 'SV = IV\\($ADDR\\) at $ADDR
177 FLAGS = \\(.*IOK,READONLY,pIOK\\)
182 'SV = NULL\\(0x0\\) at $ADDR
186 do_test('reference to scalar',
188 'SV = $RV\\($ADDR\\) at $ADDR
192 SV = PV\\($ADDR\\) at $ADDR
194 FLAGS = \\(POK,pPOK\\)
202 SV = PVNV\\($ADDR\\) at $ADDR
204 FLAGS = \\(IOK,NOK,pIOK,pNOK\\)
210 SV = IV\\($ADDR\\) at $ADDR
212 FLAGS = \\(IOK,pIOK\\)
215 do_test('reference to array',
217 'SV = $RV\\($ADDR\\) at $ADDR
221 SV = PVAV\\($ADDR\\) at $ADDR
232 SV = IV\\($ADDR\\) at $ADDR
234 FLAGS = \\(IOK,pIOK\\)
236 Elt No. 1' . $c_pattern);
238 do_test('reference to hash',
240 'SV = $RV\\($ADDR\\) at $ADDR
244 SV = PVHV\\($ADDR\\) at $ADDR
246 FLAGS = \\(SHAREKEYS\\)
248 NV = $FLOAT # $] < 5.009
249 ARRAY = $ADDR \\(0:7, 1:1\\)
250 hash quality = 100.0%
254 Elt "123" HASH = $ADDR' . $c_pattern,
256 $] > 5.009 && $] < 5.015
257 && 'The hash iterator used in dump.c sets the OOK flag');
259 do_test('reference to anon sub with empty prototype',
261 'SV = $RV\\($ADDR\\) at $ADDR
265 SV = PVCV\\($ADDR\\) at $ADDR
267 FLAGS = \\($PADMY,POK,pPOK,ANON,WEAKOUTSIDE,CVGV_RC\\) # $] < 5.015 || !thr
268 FLAGS = \\($PADMY,POK,pPOK,ANON,WEAKOUTSIDE,CVGV_RC,DYNFILE\\) # $] >= 5.015 && thr
272 COMP_STASH = $ADDR\\t"main"
273 START = $ADDR ===> \\d+
275 XSUB = 0x0 # $] < 5.009
276 XSUBANY = 0 # $] < 5.009
277 GVGV::GV = $ADDR\\t"main" :: "__ANON__[^"]*"
278 FILE = ".*\\b(?i:peek\\.t)"
282 FLAGS = 0x404 # $] < 5.009
283 FLAGS = 0x490 # $] >= 5.009 && ($] < 5.015 || !thr)
284 FLAGS = 0x1490 # $] >= 5.015 && thr
287 PADNAME = $ADDR\\($ADDR\\) PAD = $ADDR\\($ADDR\\)
288 OUTSIDE = $ADDR \\(MAIN\\)');
290 do_test('reference to named subroutine without prototype',
292 'SV = $RV\\($ADDR\\) at $ADDR
296 SV = PVCV\\($ADDR\\) at $ADDR
298 FLAGS = \\((?:HASEVAL)?\\) # $] < 5.015 || !thr
299 FLAGS = \\(DYNFILE(?:,HASEVAL)?\\) # $] >= 5.015 && thr
302 COMP_STASH = $ADDR\\t"main"
303 START = $ADDR ===> \\d+
305 XSUB = 0x0 # $] < 5.009
306 XSUBANY = 0 # $] < 5.009
307 GVGV::GV = $ADDR\\t"main" :: "do_test"
308 FILE = ".*\\b(?i:peek\\.t)"
312 FLAGS = 0x(?:400)?0 # $] < 5.015 || !thr
313 FLAGS = 0x[145]000 # $] >= 5.015 && thr
316 PADNAME = $ADDR\\($ADDR\\) PAD = $ADDR\\($ADDR\\)
317 \\d+\\. $ADDR<\\d+> \\(\\d+,\\d+\\) "\\$todo"
318 \\d+\\. $ADDR<\\d+> \\(\\d+,\\d+\\) "\\$repeat_todo"
319 \\d+\\. $ADDR<\\d+> \\(\\d+,\\d+\\) "\\$pattern"
320 \\d+\\. $ADDR<\\d+> FAKE "\\$DEBUG" # $] < 5.009
321 \\d+\\. $ADDR<\\d+> FAKE "\\$DEBUG" flags=0x0 index=0 # $] >= 5.009
322 \\d+\\. $ADDR<\\d+> \\(\\d+,\\d+\\) "\\$dump"
323 \\d+\\. $ADDR<\\d+> \\(\\d+,\\d+\\) "\\$dump2"
324 OUTSIDE = $ADDR \\(MAIN\\)');
327 do_test('reference to regexp',
329 'SV = $RV\\($ADDR\\) at $ADDR
333 SV = REGEXP\\($ADDR\\) at $ADDR
335 FLAGS = \\(OBJECT,POK,FAKE,pPOK\\) # $] < 5.017006
336 FLAGS = \\(OBJECT,FAKE\\) # $] >= 5.017006
337 PV = $ADDR "\\(\\?\\^:tic\\)"
339 LEN = 0 # $] < 5.017006
340 STASH = $ADDR\\t"Regexp"'
344 EXTFLAGS = 0x680000 \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\)
367 do_test('reference to regexp',
369 'SV = $RV\\($ADDR\\) at $ADDR
373 SV = PVMG\\($ADDR\\) at $ADDR
375 FLAGS = \\(OBJECT,SMG\\)
381 MG_TYPE = PERL_MAGIC_qr\(r\)
383 PAT = "\(\?^:tic\)" # $] >= 5.009
384 REFCNT = 2 # $] >= 5.009
385 STASH = $ADDR\\t"Regexp"');
388 do_test('reference to blessed hash',
390 'SV = $RV\\($ADDR\\) at $ADDR
394 SV = PVHV\\($ADDR\\) at $ADDR
396 FLAGS = \\(OBJECT,SHAREKEYS\\)
399 STASH = $ADDR\\t"Tac"
407 : 'The hash iterator used in dump.c sets the OOK flag'
408 : "Something causes the HV's array to become allocated");
412 'SV = PVGV\\($ADDR\\) at $ADDR
414 FLAGS = \\(MULTI(?:,IN_PAD)?\\) # $] >= 5.009
415 FLAGS = \\(GMG,SMG,MULTI(?:,IN_PAD)?\\) # $] < 5.009
419 MAGIC = $ADDR # $] < 5.009
420 MG_VIRTUAL = &PL_vtbl_glob # $] < 5.009
421 MG_TYPE = PERL_MAGIC_glob\(\*\) # $] < 5.009
422 MG_OBJ = $ADDR # $] < 5.009
425 GvSTASH = $ADDR\\t"main"
435 GPFLAGS = 0x0 # $] < 5.009
437 FILE = ".*\\b(?i:peek\\.t)"
441 if (ord('A') == 193) {
442 do_test('string with Unicode',
443 chr(256).chr(0).chr(512),
444 'SV = PV\\($ADDR\\) at $ADDR
446 FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019003
447 FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019003
448 PV = $ADDR "\\\214\\\101\\\0\\\235\\\101"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
452 do_test('string with Unicode',
453 chr(256).chr(0).chr(512),
454 'SV = PV\\($ADDR\\) at $ADDR
456 FLAGS = \\((?:$PADTMP,)?POK,READONLY,pPOK,UTF8\\) # $] < 5.019003
457 FLAGS = \\((?:$PADTMP,)?POK,pPOK,UTF8\\) # $] >=5.019003
458 PV = $ADDR "\\\304\\\200\\\0\\\310\\\200"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
463 if (ord('A') == 193) {
464 do_test('reference to hash containing Unicode',
465 {chr(256)=>chr(512)},
466 'SV = $RV\\($ADDR\\) at $ADDR
470 SV = PVHV\\($ADDR\\) at $ADDR
472 FLAGS = \\(SHAREKEYS,HASKFLAGS\\)
474 NV = $FLOAT # $] < 5.009
475 ARRAY = $ADDR \\(0:7, 1:1\\)
476 hash quality = 100.0%
480 Elt "\\\214\\\101" \[UTF8 "\\\x\{100\}"\] HASH = $ADDR
481 SV = PV\\($ADDR\\) at $ADDR
483 FLAGS = \\(POK,pPOK,UTF8\\)
484 PV = $ADDR "\\\235\\\101"\\\0 \[UTF8 "\\\x\{200\}"\]
490 : 'The hash iterator used in dump.c sets the OOK flag'
491 : 'sv_length has been called on the element, and cached the result in MAGIC');
493 do_test('reference to hash containing Unicode',
494 {chr(256)=>chr(512)},
495 'SV = $RV\\($ADDR\\) at $ADDR
499 SV = PVHV\\($ADDR\\) at $ADDR
501 FLAGS = \\(SHAREKEYS,HASKFLAGS\\)
504 ARRAY = $ADDR \\(0:7, 1:1\\)
505 hash quality = 100.0%
509 Elt "\\\304\\\200" \[UTF8 "\\\x\{100\}"\] HASH = $ADDR
510 SV = PV\\($ADDR\\) at $ADDR
512 FLAGS = \\(POK,pPOK,UTF8\\)
513 PV = $ADDR "\\\310\\\200"\\\0 \[UTF8 "\\\x\{200\}"\]
519 : 'The hash iterator used in dump.c sets the OOK flag'
520 : 'sv_length has been called on the element, and cached the result in MAGIC');
525 do_test('scalar with pos magic',
527 'SV = PVMG\\($ADDR\\) at $ADDR
529 FLAGS = \\($PADMY,SMG,POK,(?:IsCOW,)?pPOK\\)
537 MG_VIRTUAL = &PL_vtbl_mglob
538 MG_TYPE = PERL_MAGIC_regex_global\\(g\\)
543 # TAINTEDDIR is not set on: OS2, AMIGAOS, WIN32, MSDOS
544 # environment variables may be invisibly case-forced, hence the (?i:PATH)
545 # C<scalar(@ARGV)> is turned into an IV on VMS hence the (?:IV)?
546 # Perl 5.18 ensures all env vars end up as strings only, hence the (?:,pIOK)?
547 # Perl 5.18 ensures even magic vars have public OK, hence the (?:,POK)?
548 # VMS is setting FAKE and READONLY flags. What VMS uses for storing
549 # ENV hashes is also not always null terminated.
552 do_test('tainted value in %ENV',
553 $ENV{PATH}=@ARGV, # scalar(@ARGV) is a handy known tainted value
554 'SV = PVMG\\($ADDR\\) at $ADDR
556 FLAGS = \\(GMG,SMG,RMG(?:,POK)?(?:,pIOK)?,pPOK\\)
563 MG_VIRTUAL = &PL_vtbl_envelem
564 MG_TYPE = PERL_MAGIC_envelem\\(e\\)
568 MG_PTR = $ADDR (?:"(?i:PATH)"|=> HEf_SVKEY
569 SV = PV(?:IV)?\\($ADDR\\) at $ADDR
571 FLAGS = \\(TEMP,POK,(?:FAKE,READONLY,)?pPOK\\)
573 )? PV = $ADDR "(?i:PATH)"(?:\\\0)?
577 MG_VIRTUAL = &PL_vtbl_taint
578 MG_TYPE = PERL_MAGIC_taint\\(t\\)');
581 do_test('blessed reference',
582 bless(\\undef, 'Foobar'),
583 'SV = $RV\\($ADDR\\) at $ADDR
587 SV = PVMG\\($ADDR\\) at $ADDR
589 FLAGS = \\(OBJECT,ROK\\)
593 SV = NULL\\(0x0\\) at $ADDR
595 FLAGS = \\(READONLY\\)
599 STASH = $ADDR\s+"Foobar"');
605 do_test('constant subroutine',
607 'SV = $RV\\($ADDR\\) at $ADDR
611 SV = PVCV\\($ADDR\\) at $ADDR
613 FLAGS = \\(POK,pPOK,CONST,ISXSUB\\) # $] < 5.015
614 FLAGS = \\(POK,pPOK,CONST,DYNFILE,ISXSUB\\) # $] >= 5.015
619 ROOT = 0x0 # $] < 5.009
621 XSUBANY = $ADDR \\(CONST SV\\)
622 SV = PV\\($ADDR\\) at $ADDR
624 FLAGS = \\(.*POK,READONLY,pPOK\\)
625 PV = $ADDR "Perl rules"\\\0
628 GVGV::GV = $ADDR\\t"main" :: "const"
629 FILE = ".*\\b(?i:peek\\.t)"
633 FLAGS = 0x200 # $] < 5.009
634 FLAGS = 0xc00 # $] >= 5.009 && $] < 5.013
635 FLAGS = 0xc # $] >= 5.013 && $] < 5.015
636 FLAGS = 0x100c # $] >= 5.015
639 OUTSIDE = 0x0 \\(null\\)');
641 do_test('isUV should show on PVMG',
642 do { my $v = $1; $v = ~0; $v },
643 'SV = PVMG\\($ADDR\\) at $ADDR
645 FLAGS = \\(IOK,pIOK,IsUV\\)
652 'SV = $RV\\($ADDR\\) at $ADDR
656 SV = PVIO\\($ADDR\\) at $ADDR
661 STASH = $ADDR\s+"IO::File"
672 SUBPROCESS = 0 # $] < 5.009
678 'SV = $RV\\($ADDR\\) at $ADDR
682 SV = PVFM\\($ADDR\\) at $ADDR
684 FLAGS = \\(\\) # $] < 5.015 || !thr
685 FLAGS = \\(DYNFILE\\) # $] >= 5.015 && thr
690 START = $ADDR ===> \\d+
692 XSUB = 0x0 # $] < 5.009
693 XSUBANY = 0 # $] < 5.009
694 GVGV::GV = $ADDR\\t"main" :: "PIE"
695 FILE = ".*\\b(?i:peek\\.t)"(?:
699 FLAGS = 0x0 # $] < 5.015 || !thr
700 FLAGS = 0x1000 # $] >= 5.015 && thr
702 LINES = 0 # $] < 5.017_003
704 PADNAME = $ADDR\\($ADDR\\) PAD = $ADDR\\($ADDR\\)
705 OUTSIDE = $ADDR \\(MAIN\\)');
707 do_test('blessing to a class with embedded NUL characters',
708 (bless {}, "\0::foo::\n::baz::\t::\0"),
709 'SV = $RV\\($ADDR\\) at $ADDR
713 SV = PVHV\\($ADDR\\) at $ADDR
715 FLAGS = \\(OBJECT,SHAREKEYS\\)
718 STASH = $ADDR\\t"\\\\0::foo::\\\\n::baz::\\\\t::\\\\0"
726 : 'The hash iterator used in dump.c sets the OOK flag'
727 : "Something causes the HV's array to become allocated");
729 do_test('ENAME on a stash',
731 'SV = $RV\\($ADDR\\) at $ADDR
735 SV = PVHV\\($ADDR\\) at $ADDR
737 FLAGS = \\(OOK,SHAREKEYS\\)
739 NV = $FLOAT # $] < 5.009
742 FILL = 0 \(cached = 0\)
748 ENAME = "RWOM" # $] > 5.012
753 do_test('ENAMEs on a stash',
755 'SV = $RV\\($ADDR\\) at $ADDR
759 SV = PVHV\\($ADDR\\) at $ADDR
761 FLAGS = \\(OOK,SHAREKEYS\\)
763 NV = $FLOAT # $] < 5.009
766 FILL = 0 \(cached = 0\)
772 NAMECOUNT = 2 # $] > 5.012
773 ENAME = "RWOM", "KLANK" # $] > 5.012
778 do_test('ENAMEs on a stash with no NAME',
780 'SV = $RV\\($ADDR\\) at $ADDR
784 SV = PVHV\\($ADDR\\) at $ADDR
786 FLAGS = \\(OOK,SHAREKEYS\\) # $] < 5.017
787 FLAGS = \\(OOK,OVERLOAD,SHAREKEYS\\) # $] >=5.017
789 NV = $FLOAT # $] < 5.009
792 FILL = 0 \(cached = 0\)
797 NAMECOUNT = -3 # $] > 5.012
798 ENAME = "RWOM", "KLANK" # $] > 5.012
801 my %small = ("Perl", "Rules", "Beer", "Foamy");
803 do_test('small hash',
805 'SV = $RV\\($ADDR\\) at $ADDR
809 SV = PVHV\\($ADDR\\) at $ADDR
811 FLAGS = \\(PADMY,SHAREKEYS\\)
813 NV = $FLOAT # $] < 5.009
814 ARRAY = $ADDR \\(0:[67],.*\\)
815 hash quality = [0-9.]+%
819 (?: Elt "(?:Perl|Beer)" HASH = $ADDR
820 SV = PV\\($ADDR\\) at $ADDR
822 FLAGS = \\(POK,pPOK\\)
823 PV = $ADDR "(?:Rules|Foamy)"\\\0
830 do_test('small hash after keys',
832 'SV = $RV\\($ADDR\\) at $ADDR
836 SV = PVHV\\($ADDR\\) at $ADDR
838 FLAGS = \\(PADMY,OOK,SHAREKEYS\\)
840 NV = $FLOAT # $] < 5.009
841 ARRAY = $ADDR \\(0:[67],.*\\)
842 hash quality = [0-9.]+%
844 FILL = [12] \\(cached = 0\\)
849 (?: Elt "(?:Perl|Beer)" HASH = $ADDR
850 SV = PV\\($ADDR\\) at $ADDR
852 FLAGS = \\(POK,pPOK\\)
853 PV = $ADDR "(?:Rules|Foamy)"\\\0
860 do_test('small hash after keys and scalar',
862 'SV = $RV\\($ADDR\\) at $ADDR
866 SV = PVHV\\($ADDR\\) at $ADDR
868 FLAGS = \\(PADMY,OOK,SHAREKEYS\\)
870 NV = $FLOAT # $] < 5.009
871 ARRAY = $ADDR \\(0:[67],.*\\)
872 hash quality = [0-9.]+%
874 FILL = ([12]) \\(cached = \1\\)
879 (?: Elt "(?:Perl|Beer)" HASH = $ADDR
880 SV = PV\\($ADDR\\) at $ADDR
882 FLAGS = \\(POK,pPOK\\)
883 PV = $ADDR "(?:Rules|Foamy)"\\\0
888 # This should immediately start with the FILL cached correctly.
889 my %large = (0..1999);
891 do_test('large hash',
893 'SV = $RV\\($ADDR\\) at $ADDR
897 SV = PVHV\\($ADDR\\) at $ADDR
899 FLAGS = \\(PADMY,OOK,SHAREKEYS\\)
901 NV = $FLOAT # $] < 5.009
902 ARRAY = $ADDR \\(0:\d+,.*\\)
903 hash quality = \d+\\.\d+%
905 FILL = (\d+) \\(cached = \1\\)
914 skip "Not built with usemymalloc", 1
915 unless $Config{usemymalloc} eq 'y';
917 ok eval { fill_mstats($x); 1 }, 'fill_mstats on COW scalar'
921 # This is more a test of fbm_compile/pp_study (non) interaction than dumping
922 # prowess, but short of duplicating all the gubbins of this file, I can't see
923 # a way to make a better place for it:
930 unless ($Config{useithreads}) {
931 # These end up as copies in pads under ithreads, which rather defeats the
932 # the point of what we're trying to test here.
934 do_test('regular string constant', perl,
935 'SV = PV\\($ADDR\\) at $ADDR
937 FLAGS = \\(PADMY,POK,READONLY,pPOK\\)
938 PV = $ADDR "rules"\\\0
943 eval 'index "", perl';
945 # FIXME - really this shouldn't say EVALED. It's a false posistive on
946 # 0x40000000 being used for several things, not a flag for "I'm in a string
949 do_test('string constant now an FBM', perl,
950 'SV = PVMG\\($ADDR\\) at $ADDR
952 FLAGS = \\(PADMY,SMG,POK,READONLY,pPOK,VALID,EVALED\\)
953 PV = $ADDR "rules"\\\0
957 MG_VIRTUAL = &PL_vtbl_regexp
958 MG_TYPE = PERL_MAGIC_bm\\(B\\)
960 MG_PTR = $ADDR "(?:\\\\\d){256}"
961 RARE = \d+ # $] < 5.019002
962 PREVIOUS = 1 # $] < 5.019002
966 is(study perl, '', "Not allowed to study an FBM");
968 do_test('string constant still an FBM', perl,
969 'SV = PVMG\\($ADDR\\) at $ADDR
971 FLAGS = \\(PADMY,SMG,POK,READONLY,pPOK,VALID,EVALED\\)
972 PV = $ADDR "rules"\\\0
976 MG_VIRTUAL = &PL_vtbl_regexp
977 MG_TYPE = PERL_MAGIC_bm\\(B\\)
979 MG_PTR = $ADDR "(?:\\\\\d){256}"
980 RARE = \d+ # $] < 5.019002
981 PREVIOUS = 1 # $] < 5.019002
985 do_test('regular string constant', beer,
986 'SV = PV\\($ADDR\\) at $ADDR
988 FLAGS = \\(PADMY,POK,READONLY,pPOK\\)
989 PV = $ADDR "foamy"\\\0
994 is(study beer, 1, "Our studies were successful");
996 do_test('string constant quite unaffected', beer, 'SV = PV\\($ADDR\\) at $ADDR
998 FLAGS = \\(PADMY,POK,READONLY,pPOK\\)
999 PV = $ADDR "foamy"\\\0
1004 my $want = 'SV = PVMG\\($ADDR\\) at $ADDR
1006 FLAGS = \\(PADMY,SMG,POK,READONLY,pPOK,VALID,EVALED\\)
1007 PV = $ADDR "foamy"\\\0
1011 MG_VIRTUAL = &PL_vtbl_regexp
1012 MG_TYPE = PERL_MAGIC_bm\\(B\\)
1014 MG_PTR = $ADDR "(?:\\\\\d){256}"
1015 RARE = \d+ # $] < 5.019002
1016 PREVIOUS = \d+ # $] < 5.019002
1020 is (eval 'index "not too foamy", beer', 8, 'correct index');
1022 do_test('string constant now FBMed', beer, $want);
1026 is(study $pie, 1, "Our studies were successful");
1028 do_test('string constant still FBMed', beer, $want);
1030 do_test('second string also unaffected', $pie, 'SV = PV\\($ADDR\\) at $ADDR
1032 FLAGS = \\(PADMY,POK,pPOK\\)
1033 PV = $ADDR "good"\\\0
1039 # (One block of study tests removed when study was made a no-op.)
1042 open(OUT,">peek$$") or die "Failed to open peek $$: $!";
1043 open(STDERR, ">&OUT") or die "Can't dup OUT: $!";
1045 open(STDERR, ">&SAVERR") or die "Can't restore STDERR: $!";
1046 pass "no crash with DeadCode";
1050 do_test('UTF-8 in a regular expression',
1052 'SV = IV\($ADDR\) at $ADDR
1056 SV = REGEXP\($ADDR\) at $ADDR
1058 FLAGS = \(OBJECT,FAKE,UTF8\)
1059 PV = $ADDR "\(\?\^u:\\\\\\\\x\{100\}\)" \[UTF8 "\(\?\^u:\\\\\\\\x\{100\}\)"\]
1061 STASH = $ADDR "Regexp"
1062 COMPFLAGS = 0x0 \(\)
1063 EXTFLAGS = 0x680040 \(CHECK_ALL,USE_INTUIT_NOML,USE_INTUIT_ML\)
1086 { # perl #117793: Extend SvREFCNT* to work on any perl variable type
1088 my $base_count = Devel::Peek::SvREFCNT(%hash);
1090 is(Devel::Peek::SvREFCNT(%hash), $base_count + 1, "SvREFCNT on non-scalar");