The Built-in Debugger


Beginning | Previous | Next

Invoking The Debugger

To debug a program, you would do something like this: perl -d [other_switches] your_script [your_script_switches]

Once there, you can type "h" to get the help screen which looks like this (on NT anyway):

DB<1> h T Stack trace. s Single step. n Next, steps over subroutine calls. r Return from current subroutine. c [line] Continue; optionally inserts a one-time-only breakpoint at the specified line. <CR> Repeat last n or s. l min+incr List incr+1 lines starting at min. l min-max List lines. l line List line; l List next window. - List previous window. w line List window around line. l subname List subroutine. f filename Switch to filename. /pattern/ Search forwards for pattern; final / is optional. ?pattern? Search backwards for pattern. L List breakpoints and actions. S List subroutine names. t Toggle trace mode. b [line] [condition] Set breakpoint; line defaults to the current execution line; condition breaks if it evaluates to true, defaults to '1'. b subname [condition] Set breakpoint at first line of subroutine. d [line] Delete breakpoint. D Delete all breakpoints. a [line] command Set an action to be done before the line is executed. Sequence is: check for breakpoint, print line if necessary, do action, prompt user if breakpoint or step, evaluate line. A Delete all actions. V [pkg [vars]] List some (default all) variables in package (default current). X [vars] Same as "V currentpackage [vars]". < command Define command before prompt. > command Define command after prompt. ! number Redo command (default previous command). ! -number Redo number'th to last command. H -number Display last number commands (default all). q or ^D Quit. p expr Same as "print DB::OUT expr" in current package. = [alias value] Define a command alias, or list current aliases. command Execute as a perl statement in current package. DB<1>

Use The Debugger

Beginning | Previous | Next
Last Modified: $Date: 1997/05/02 07:17:38 $