Debugger

Created Wednesday 20 August 2014

http://perldoc.perl.org/perldebtut.html

Launch

perl -d program

Quit

q

Help

Summary

h

Pipe through pager

|h

The entire help screen

h h

Loaded modules

M

Show methods

m

Show subroutines (by pattern)

S str

Show variables (by package scope)

Using 'X' and alike requires not to use the type identifiers ($@%), just the 'name'
X ~err

View code

In the current position

v
Type 'v' again to scroll the code

Jump to line number

l 5

Reset the view to the line we're about to execute

.
The line shown is the one that is about to be executed next

Step through the next executable statement

s

Print variable

p $somevar

Dump hash/object

x %hash
x \%hash

Enter the debugger without a file + create and print object etc..

perl -de 0
$obj = bless({'unique_id'=>'123', 'attr'=> \
cont: {'col' => 'black', 'things' => [qw(this that etc]}}, 'MY_class')
x $obj
@data = qw(this that the other leather theory scythe)
p 'saw -> '.($cnt += map { print "\t:\t$_\n" } grep(/the/, sort @data))

See the command History

H

Repeat any previous command

!4

Set a breakpoint

b [line] [condition]

Proceed to the breakpoint

c

Set a breakpoint in the code

http://stackoverflow.com/questions/4489269/in-perl-what-is-the-difference-between-dbsingle-1-and-2
$DB::single = 1; - 's' command (into)
$DB::single = 2; - 'n' command (over)

See the set breakpoints

L

Delete a breakpoint

B

Return out of a sub

r



Backlinks: