|
To aid debugging, the source file dump.c contains a number of functions which
produce formatted output of internal data structures.
The most commonly used of these functions is Perl_sv_dump; it's used for
dumping SVs, AVs, HVs, and CVs. The Devel::Peek module calls sv_dump
to produce debugging output from Perl-space, so users of that module should already be
familiar with its format.
Perl_op_dump can be used to dump an OP structure or any of its
derivatives, and produces output similar to perl -Dx; in fact, Perl_dump_eval
will dump the main root of the code being evaluated, exactly like -Dx.
Other useful functions are Perl_dump_sub, which turns a GV into
an op tree, Perl_dump_packsubs which calls Perl_dump_sub on all the
subroutines in a package like so: (Thankfully, these are all xsubs, so there is no op tree)
(gdb) print Perl_dump_packsubs(PL_defstash)
SUB attributes::bootstrap = (xsub 0x811fedc 0)
SUB UNIVERSAL::can = (xsub 0x811f50c 0)
SUB UNIVERSAL::isa = (xsub 0x811f304 0)
SUB UNIVERSAL::VERSION = (xsub 0x811f7ac 0)
SUB DynaLoader::boot_DynaLoader = (xsub 0x805b188 0)
|
|
and Perl_dump_all, which dumps all the subroutines in the stash and the op
tree of the main root.
|
|