September 2016 Archives

Short presentation of The new Perl debugger

The link of the project

You may Download presentation or view short video

The main feature of new debugger is debugging debugger commands. Yes you may debug itself (reentrance is not limited). This mean you may extend debugger easily. That is possible because of state of each debugger "copy" is saved in special array accessible through $DB::state

To enable debugger debugging (dd) you turn on this state then run command, you want to debug, after that. Example how to enable debugging debugger command 'step over' (n):

DB::state( 'dd', 1 );
n

Besides new debugger you get the new method to debug scripts and may forget about debugging by 'print' statements.

Now you just put special comment: #DBG: EXPR #

my $x =  { a =>  7 };

for( 1 .. 3 ) {
  #DBG:iter $_ #
  $x->{ a }++;
}

#DBG: e $x #

and get extended output while running script under debugger like this:

$ perl -d:DebugHooks::KillPrint            t.pl

1
2
3
{ a => 10 }

You may also limit output by writing the name of expression you are interested in:

$ perl -d:DebugHooks::KillPrint=iter       t.pl

1
2
3

About KES

user-pic I blog about Perl.