6 require Config; import Config;
7 if ($Config{'extensions'} !~ /\bPeek\b/) {
8 print "1..0 # Skip: Devel::Peek was not built\n";
18 open(SAVERR, ">&STDERR") or die "Can't dup STDERR: $!";
22 if (open(OUT,">peek$$")) {
23 open(STDERR, ">&OUT") or die "Can't dup OUT: $!";
25 open(STDERR, ">&SAVERR") or die "Can't restore STDERR: $!";
27 if (open(IN, "peek$$")) {
29 $pattern =~ s/\$ADDR/0x[[:xdigit:]]+/g;
30 print $pattern, "\n" if $DEBUG;
32 print $dump, "\n" if $DEBUG;
33 print "[$dump] vs [$pattern]\nnot " unless $dump =~ /$pattern/ms;
38 die "$0: failed to open peek$$: !\n";
41 die "$0: failed to create peek$$: $!\n";
52 'SV = PV\\($ADDR\\) at $ADDR
54 FLAGS = \\(POK,pPOK\\)
62 'SV = PV\\($ADDR\\) at $ADDR
64 FLAGS = \\(.*POK,READONLY,pPOK\\)
71 'SV = IV\\($ADDR\\) at $ADDR
73 FLAGS = \\(IOK,pIOK\\)
78 'SV = IV\\($ADDR\\) at $ADDR
80 FLAGS = \\(.*IOK,READONLY,pIOK\\)
85 'SV = IV\\($ADDR\\) at $ADDR
87 FLAGS = \\(PADBUSY,PADMY,IOK,pIOK\\)
90 # If perl is built with PERL_PRESERVE_IVUV then maths is done as integers
91 # where possible and this scalar will be an IV. If NO_PERL_PRESERVE_IVUV then
92 # maths is done in floating point always, and this scalar will be an NV.
93 # ([NI]) captures the type, referred to by \1 in this regexp and $type for
94 # building subsequent regexps.
95 my $type = do_test( 6,
97 'SV = ([NI])V\\($ADDR\\) at $ADDR
99 FLAGS = \\(PADTMP,\1OK,p\1OK\\)
106 'SV = PVNV\\($ADDR\\) at $ADDR
108 FLAGS = \\(NOK,pNOK\\)
110 NV = 789\\.(?:1(?:000+\d+)?|0999+\d+)
117 'SV = IV\\($ADDR\\) at $ADDR
119 FLAGS = \\(.*IOK,READONLY,pIOK\\)
124 'SV = NULL\\(0x0\\) at $ADDR
130 'SV = RV\\($ADDR\\) at $ADDR
134 SV = PV\\($ADDR\\) at $ADDR
136 FLAGS = \\(POK,pPOK\\)
144 SV = PVNV\\($ADDR\\) at $ADDR
146 FLAGS = \\(IOK,NOK,pIOK,pNOK\\)
152 SV = IV\\($ADDR\\) at $ADDR
154 FLAGS = \\(IOK,pIOK\\)
159 'SV = RV\\($ADDR\\) at $ADDR
163 SV = PVAV\\($ADDR\\) at $ADDR
174 SV = IV\\($ADDR\\) at $ADDR
176 FLAGS = \\(IOK,pIOK\\)
178 Elt No. 1' . $c_pattern);
182 'SV = RV\\($ADDR\\) at $ADDR
186 SV = PVHV\\($ADDR\\) at $ADDR
188 FLAGS = \\(SHAREKEYS\\)
191 ARRAY = $ADDR \\(0:7, 1:1\\)
192 hash quality = 100.0%
198 Elt "123" HASH = $ADDR' . $c_pattern);
202 'SV = RV\\($ADDR\\) at $ADDR
206 SV = PVCV\\($ADDR\\) at $ADDR
208 FLAGS = \\(PADBUSY,PADMY,POK,pPOK,ANON\\)
212 COMP_STASH = $ADDR\\t"main"
213 START = $ADDR ===> \\d+
217 GVGV::GV = $ADDR\\t"main" :: "__ANON__[^"]*"
218 FILE = ".*\\b(?i:peek\\.t)"
224 OUTSIDE = $ADDR \\(MAIN\\)');
228 'SV = RV\\($ADDR\\) at $ADDR
232 SV = PVCV\\($ADDR\\) at $ADDR
237 COMP_STASH = $ADDR\\t"main"
238 START = $ADDR ===> \\d+
242 GVGV::GV = $ADDR\\t"main" :: "do_test"
243 FILE = ".*\\b(?i:peek\\.t)"
249 \\d+\\. $ADDR \\("\\$pattern" \\d+-\\d+\\)
250 \\d+\\. $ADDR \\(FAKE "\\$DEBUG" 0-\\d+\\)
251 \\d+\\. $ADDR \\("\\$dump" \\d+-\\d+\\)
252 OUTSIDE = $ADDR \\(MAIN\\)');
256 'SV = RV\\($ADDR\\) at $ADDR
260 SV = PVMG\\($ADDR\\) at $ADDR
262 FLAGS = \\(OBJECT,RMG\\)
268 MG_TYPE = PERL_MAGIC_qr\(r\)
270 STASH = $ADDR\\t"Regexp"');
274 'SV = RV\\($ADDR\\) at $ADDR
278 SV = PVHV\\($ADDR\\) at $ADDR
280 FLAGS = \\(OBJECT,SHAREKEYS\\)
283 STASH = $ADDR\\t"Tac"
293 'SV = PVGV\\($ADDR\\) at $ADDR
295 FLAGS = \\(GMG,SMG,MULTI(?:,IN_PAD)?\\)
299 MG_VIRTUAL = &PL_vtbl_glob
300 MG_TYPE = PERL_MAGIC_glob\(\*\)
304 GvSTASH = $ADDR\\t"main"
316 FILE = ".*\\b(?i:peek\\.t)"
320 if (ord('A') == 193) {
322 chr(256).chr(0).chr(512),
323 'SV = PV\\($ADDR\\) at $ADDR
325 FLAGS = \\((?:PADBUSY,PADTMP,)?POK,READONLY,pPOK,UTF8\\)
326 PV = $ADDR "\\\214\\\101\\\0\\\235\\\101"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
331 chr(256).chr(0).chr(512),
332 'SV = PV\\($ADDR\\) at $ADDR
334 FLAGS = \\((?:PADBUSY,PADTMP,)?POK,READONLY,pPOK,UTF8\\)
335 PV = $ADDR "\\\304\\\200\\\0\\\310\\\200"\\\0 \[UTF8 "\\\x\{100\}\\\x\{0\}\\\x\{200\}"\]
340 if (ord('A') == 193) {
342 {chr(256)=>chr(512)},
343 'SV = RV\\($ADDR\\) at $ADDR
347 SV = PVHV\\($ADDR\\) at $ADDR
349 FLAGS = \\(SHAREKEYS\\)
352 ARRAY = $ADDR \\(0:7, 1:1\\)
353 hash quality = 100.0%
359 Elt "\\\241\\\101" \[UTF8 "\\\x\{100\}"\] HASH = $ADDR
360 SV = PV\\($ADDR\\) at $ADDR
362 FLAGS = \\(POK,pPOK,UTF8\\)
363 PV = $ADDR "\\\235\\\101"\\\0 \[UTF8 "\\\x\{200\}"\]
368 {chr(256)=>chr(512)},
369 'SV = RV\\($ADDR\\) at $ADDR
373 SV = PVHV\\($ADDR\\) at $ADDR
375 FLAGS = \\(SHAREKEYS\\)
378 ARRAY = $ADDR \\(0:7, 1:1\\)
379 hash quality = 100.0%
385 Elt "\\\304\\\200" \[UTF8 "\\\x\{100\}"\] HASH = $ADDR
386 SV = PV\\($ADDR\\) at $ADDR
388 FLAGS = \\(POK,pPOK,UTF8\\)
389 PV = $ADDR "\\\310\\\200"\\\0 \[UTF8 "\\\x\{200\}"\]
395 1 while unlink("peek$$");