X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FB%2FB%2FConcise.pm;h=80459b4cdb73cfb515f9fe988092cadb276c37f3;hb=e69a2255d0db4d110e403864fcb97407ce8e4ff9;hp=46a8cfebbe736c63f464aa627866daf4434f51ad;hpb=213a1a263469325697166cf306c9ca76600e54dd;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 46a8cfe..80459b4 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -530,9 +530,13 @@ sub tree { # If either of the marked numbers there aren't 1, it means you need to # update the corresponding magic number in the next two lines. -# Reember, these need to stay the last things in the module. -$cop_seq_base = svref_2object(eval 'sub{0;}')->START->cop_seq + 11; -$seq_base = svref_2object(eval 'sub{}')->START->seq + 84; +# Remember, these need to stay the last things in the module. + +# Why these are different for MacOS? Does it matter? +my $cop_seq_mnum = $^O eq 'MacOS' ? 12 : 11; +my $seq_mnum = $^O eq 'MacOS' ? 100 : 84; +$cop_seq_base = svref_2object(eval 'sub{0;}')->START->cop_seq + $cop_seq_mnum; +$seq_base = svref_2object(eval 'sub{}')->START->seq + $seq_mnum; 1; @@ -559,6 +563,44 @@ information displyed is customizable. Its function is similar to that of perl's B<-Dx> debugging flag or the B module, but it is more sophisticated and flexible. +=head1 EXAMPLE + +Here's is a short example of output, using the default formatting +conventions : + + % perl -MO=Concise -e '$a = $b + 42' + 8 <@> leave[t1] vKP/REFC ->(end) + 1 <0> enter ->2 + 2 <;> nextstate(main 1 -e:1) v ->3 + 7 <2> sassign vKS/2 ->8 + 5 <2> add[t1] sK/2 ->6 + - <1> ex-rv2sv sK/1 ->4 + 3 <$> gvsv(*b) s ->4 + 4 <$> const(IV 42) s ->5 + - <1> ex-rv2sv sKRM*/1 ->7 + 6 <$> gvsv(*a) s ->7 + +Each line corresponds to an operator. Null ops appear as C, +where I is the op that has been optimized away by perl. + +The number on the first row indicates the op's sequence number. It's +given in base 36 by default. + +The symbol between angle brackets indicates the op's type : for example, +<2> is a BINOP, <@> a LISTOP, etc. (see L). + +The opname may be followed by op-specific information in parentheses +(e.g. C), and by targ information in brackets (e.g. +C). + +Next come the op flags. The common flags are listed below +(L). The private flags follow, separated +by a slash. For example, C means that the leave op has +public flags OPf_WANT_VOID, OPf_KIDS, and OPf_PARENS, and the private +flag OPpREFCOUNTED. + +Finally an arrow points to the sequence number of the next op. + =head1 OPTIONS Arguments that don't start with a hyphen are taken to be the names of @@ -730,7 +772,7 @@ non-local exit pointers for a LOOP, etc.) enclosed in paretheses. The B-determined class of the OP, in all caps. -=item B<#classym> +=item B<#classsym> A single symbol abbreviating the class of the OP. @@ -758,7 +800,7 @@ The OP's flags, abbreviated as a series of symbols. The numeric value of the OP's flags. -=item B<#hyphenseq> +=item B<#hyphseq> The sequence number of the OP, or a hyphen if it doesn't have one.