3 use B qw(peekop class walkoptree walkoptree_exec
4 main_start main_root cstring sv_undef);
5 use B::Asmdata qw(@specialsv_name);
11 printf <<'EOT', class($op), $$op, ${$op->next}, ${$op->sibling}, $op->ppaddr, $op->targ, $op->type, $op->seq, $op->flags, $op->private;
27 printf "\top_first\t0x%x\n", ${$op->first};
32 $op->B::UNOP::debug();
33 printf "\top_last\t\t0x%x\n", ${$op->last};
38 $op->B::UNOP::debug();
39 printf "\top_other\t0x%x\n", ${$op->other};
42 sub B::LISTOP::debug {
44 $op->B::BINOP::debug();
45 printf "\top_children\t%d\n", $op->children;
50 $op->B::LISTOP::debug();
51 printf "\top_pmreplroot\t0x%x\n", ${$op->pmreplroot};
52 printf "\top_pmreplstart\t0x%x\n", ${$op->pmreplstart};
53 printf "\top_pmnext\t0x%x\n", ${$op->pmnext};
54 printf "\top_pmregexp->precomp\t%s\n", cstring($op->precomp);
55 printf "\top_pmflags\t0x%x\n", $op->pmflags;
57 $op->pmreplroot->debug;
63 printf <<'EOT', $op->label, $op->stashpv, $op->file, $op->seq, $op->arybase, $op->line, ${$op->warnings};
77 printf "\top_sv\t\t0x%x\n", ${$op->sv};
84 printf "\top_pv\t\t0x%x\n", $op->pv;
90 printf "\top_padix\t\t%ld\n", $op->padix;
96 printf "\top_cv\t\t0x%x\n", ${$op->cv};
101 if ($$sv == ${sv_undef()}) {
104 printf "NULL (0x%x)\n", $$sv;
111 print class($sv), " = NULL\n";
114 printf <<'EOT', class($sv), $$sv, $sv->REFCNT, $sv->FLAGS;
125 printf <<'EOT', cstring($pv), length($pv);
134 printf "\txiv_iv\t\t%d\n", $sv->IV;
140 printf "\txnv_nv\t\t%s\n", $sv->NV;
146 printf "\txiv_iv\t\t%d\n", $sv->IV;
151 $sv->B::PVIV::debug();
152 printf "\txnv_nv\t\t%s\n", $sv->NV;
157 $sv->B::PVNV::debug();
158 printf "\txlv_targoff\t%d\n", $sv->TARGOFF;
159 printf "\txlv_targlen\t%u\n", $sv->TARGLEN;
160 printf "\txlv_type\t%s\n", cstring(chr($sv->TYPE));
165 $sv->B::PVNV::debug();
166 printf "\txbm_useful\t%d\n", $sv->USEFUL;
167 printf "\txbm_previous\t%u\n", $sv->PREVIOUS;
168 printf "\txbm_rare\t%s\n", cstring(chr($sv->RARE));
173 $sv->B::PVNV::debug();
174 my ($stash) = $sv->STASH;
175 my ($start) = $sv->START;
176 my ($root) = $sv->ROOT;
177 my ($padlist) = $sv->PADLIST;
178 my ($file) = $sv->FILE;
180 printf <<'EOT', $$stash, $$start, $$root, $$gv, $file, $sv->DEPTH, $padlist, ${$sv->OUTSIDE};
190 $start->debug if $start;
191 $root->debug if $root;
193 $padlist->debug if $padlist;
199 my(@array) = $av->ARRAY;
200 print "\tARRAY\t\t(", join(", ", map("0x" . $$_, @array)), ")\n";
201 printf <<'EOT', scalar(@array), $av->MAX, $av->OFF, $av->AvFLAGS;
211 if ($done_gv{$$gv}++) {
212 printf "GV %s::%s\n", $gv->STASH->NAME, $gv->NAME;
219 printf <<'EOT', $gv->NAME, $gv->STASH->NAME, $gv->STASH, $$sv, $gv->GvREFCNT, $gv->FORM, $$av, ${$gv->HV}, ${$gv->EGV}, $$cv, $gv->CVGEN, $gv->LINE, $gv->FILE, $gv->GvFLAGS;
239 sub B::SPECIAL::debug {
241 print $specialsv_name[$$sv], "\n";
247 if ($order && $order eq "exec") {
248 return sub { walkoptree_exec(main_start, "debug") }
250 return sub { walkoptree(main_root, "debug") }
260 B::Debug - Walk Perl syntax tree, printing debug info about ops
264 perl -MO=Debug[,OPTIONS] foo.pl
272 Malcolm Beattie, C<mbeattie@sable.ox.ac.uk>