dev > perl > single-step_debugger
document updated 1 year, 5 months ago, on Nov 30, 2022

Perl debugging pro-tips

Insert $DB::single = 1; in your code at the point that you want to transfer control back to the debugger. This really helps avoid having to do a bunch of manual c commands at the debugger command line, and it allows you to have a conditional breakpoint that only triggers when the desired data is encountered.


You can add commands to your ~/.perldb to customize your debugger experience.

A very common thing that people add to their ~/.perldb is:

    sub afterinit {
        push @DB::typeahead, "b 45", "c init_everything";

This allows you to stuff specific debugger commands (not Perl commands) into the buffer, to be processed as soon as the debugger finishes initializing.

(or, you can use a slightly more elaborate setup to have a separate .rc file that contains debugger commands that should run at startup)