home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Magazin: Amiga-CD 1996 July
/
AMIGA_1996_7.BIN
/
ausgabe_7_96
/
pd-programmierung
/
perl5_002bin.lha
/
man
/
catp
/
perldebug.0
< prev
next >
Wrap
Text File
|
1996-03-02
|
11KB
|
265 lines
PERLDEBUG(1) User Contributed Perl Documentation PERLDEBUG(1)
NNNNAAAAMMMMEEEE
perldebug - Perl debugging
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
First of all, have you tried using the ----wwww switch?
DDDDeeeebbbbuuuuggggggggiiiinnnngggg
If you invoke Perl with a ----dddd switch, your script will be
run under the debugger. However, the Perl debugger is not
a separate program as it is in a C environment. Instead,
the ----dddd flag tells the compiler to insert source
information into the pseudocode it's about to hand to the
interpreter. (That means your code must compile correctly
for the debugger to work on it.) Then when the
interpreter starts up, it pre-loads a Perl library file
containing the debugger itself. The program will halt
before the first executable statement (but see below) and
ask you for one of the following commands:
h Prints out a help message.
T Stack trace. If you do bizarre things to your
@@@@____ arguments in a subroutine, the stack
backtrace will not always show the original
values.
s Single step. Executes until it reaches the
beginning of another statement.
n Next. Executes over subroutine calls, until
it reaches the beginning of the next
statement.
f Finish. Executes statements until it has
finished the current subroutine.
c Continue. Executes until the next breakpoint
is reached.
c line Continue to the specified line. 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. If min is
omitted, starts where last listing left off.
If incr is omitted, previous value of incr is
used.
l min-max List lines in the indicated range.
18/Oct/94 perl 5.002 with 1
PERLDEBUG(1) User Contributed Perl Documentation PERLDEBUG(1)
l line List just the indicated line.
l List next window.
- List previous window.
w line List window (a few lines worth of code) around
line.
l subname List subroutine. If it's a long subroutine it
just lists the beginning. Use "l" to list
more.
/pattern/ Regular expression search forward in the
source code for pattern; the final / is
optional.
?pattern? Regular expression search backward in the
source code for pattern; the final ? is
optional.
L List lines that have breakpoints or actions.
S Lists the names of all subroutines.
t Toggle trace mode on or off.
b line [ condition ]
Set a breakpoint. If line is omitted, sets a
breakpoint on the line that is about to be
executed. If a condition is specified, it is
evaluated each time the statement is reached
and a breakpoint is taken only if the
condition is true. Breakpoints may only be
set on lines that begin an executable
statement. Conditions don't use iiiiffff:
bbbb 222233337777 $$$$xxxx >>>> 33330000
bbbb 33333333 ////ppppaaaatttttttteeeerrrrnnnn////iiii
b subname [ condition ]
Set breakpoint at first executable line of
subroutine.
d line Delete breakpoint. If line is omitted,
deletes the breakpoint on the line that is
about to be executed.
D Delete all breakpoints.
a line command
Set an action for line. A multiline command
may be entered by backslashing the newlines.
18/Oct/94 perl 5.002 with 2
PERLDEBUG(1) User Contributed Perl Documentation PERLDEBUG(1)
This command is Perl code, not another
debugger command.
A Delete all line actions.
< command Set an action to happen before every debugger
prompt. A multiline command may be entered by
backslashing the newlines.
> command Set an action to happen after the prompt when
you've just given a command to return to
executing the script. A multiline command may
be entered by backslashing the newlines.
V package [symbols]
Display all (or some) variables in package
(defaulting to the mmmmaaaaiiiinnnn package) using a data
pretty-printer (hashes show their keys and
values so you see what's what, control
characters are made printable, etc.). Make
sure you don't put the type specifier (like $)
there, just the symbol names, like this:
VVVV DDDDBBBB ffffiiiilllleeeennnnaaaammmmeeee lllliiiinnnneeee
X [symbols] Same as as "V" command, but within the current
package.
! number Redo a debugging command. If number is
omitted, redoes the previous command.
! -number Redo the command that was that many commands
ago.
H -number Display last n commands. Only commands longer
than one character are listed. If number is
omitted, lists them all.
q or ^D Quit. ("quit" doesn't work for this.)
command Execute command as a Perl statement. A
missing semicolon will be supplied.
p expr Same as pppprrrriiiinnnntttt DDDDBBBB::::::::OOOOUUUUTTTT eeeexxxxpppprrrr. The DB::OUT
filehandle is opened to /dev/tty, regardless
of where STDOUT may be redirected to.
Any command you type in that isn't recognized by the
debugger will be directly executed (eeeevvvvaaaallll'd) as Perl code.
Leading white space will cause the debugger to think it's
NNNNOOOOTTTT a debugger command.
If you have any compile-time executable statements (code
18/Oct/94 perl 5.002 with 3
PERLDEBUG(1) User Contributed Perl Documentation PERLDEBUG(1)
within a BEGIN block or a uuuusssseeee statement), these will _N_O_T
be stopped by debugger, although rrrreeeeqqqquuuuiiiirrrreeees will. From your
own code, however, you can transfer control back to the
debugger using the following statement, which is harmless
if the debugger is not running:
$$$$DDDDBBBB::::::::ssssiiiinnnngggglllleeee ==== 1111;;;;
CCCCuuuussssttttoooommmmiiiizzzzaaaattttiiiioooonnnn
If you want to modify the debugger, copy _p_e_r_l_5_d_b_._p_l from
the Perl library to another name and modify it as
necessary. You'll also want to set environment variable
PERL5DB to say something like this:
BBBBEEEEGGGGIIIINNNN {{{{ rrrreeeeqqqquuuuiiiirrrreeee """"mmmmyyyyppppeeeerrrrllll5555ddddbbbb....ppppllll"""" }}}}
You can do some customization by setting up a _._p_e_r_l_d_b file
which contains initialization code. For instance, you
could make aliases like these (the last one in particular
most people seem to expect to be there):
$$$$DDDDBBBB::::::::aaaalllliiiiaaaassss{{{{''''lllleeeennnn''''}}}} ==== ''''ssss////^^^^lllleeeennnn((((....****))))////pppp lllleeeennnnggggtttthhhh(((($$$$1111))))////'''';;;;
$$$$DDDDBBBB::::::::aaaalllliiiiaaaassss{{{{''''ssssttttoooopppp''''}}}} ==== ''''ssss////^^^^ssssttttoooopppp ((((aaaatttt||||iiiinnnn))))////bbbb////'''';;;;
$$$$DDDDBBBB::::::::aaaalllliiiiaaaassss{{{{''''....''''}}}} ==== ''''ssss////^^^^\\\\....////pppp ''''
.... ''''""""\\\\$$$$DDDDBBBB::::::::ssssuuuubbbb((((\\\\$$$$DDDDBBBB::::::::ffffiiiilllleeeennnnaaaammmmeeee::::\\\\$$$$DDDDBBBB::::::::lllliiiinnnneeee))))::::\\\\tttt""""''''
.... '''',,,,\\\\$$$$DDDDBBBB::::::::ddddbbbblllliiiinnnneeee[[[[\\\\$$$$DDDDBBBB::::::::lllliiiinnnneeee]]]]////'''' ;;;;
OOOOtttthhhheeeerrrr rrrreeeessssoooouuuurrrrcccceeeessss
You did try the ----wwww switch, didn't you?
BBBBUUUUGGGGSSSS
If your program _e_x_i_t_(_)s or _d_i_e_(_)s, so does the debugger.
There's no builtin way to restart the debugger without
exiting and coming back into it. You could use an alias
like this:
$$$$DDDDBBBB::::::::aaaalllliiiiaaaassss{{{{''''rrrreeeerrrruuuunnnn''''}}}} ==== ''''eeeexxxxeeeecccc """"ppppeeeerrrrllll ----dddd $$$$DDDDBBBB::::::::ffffiiiilllleeeennnnaaaammmmeeee""""'''';;;;
But you'd lose any pending breakpoint information, and
that might not be the right path, etc.
18/Oct/94 perl 5.002 with 4