Summary of perl Debugging commands

Source: Internet
Author: User
Tags perl interpreter perl debugger

The default Perl debugger is the perl interpreter, and a GUI debugger.
Generally, telnet is used to access the server during development. This document describes the usage of the default command line debugger.

Start the Perl interpreter with the-d command line option, for example, the perl-dtest.pl enters the interaction interface of the Perl debugger.

DEBUG command list: (all commands are input at the top of the debug prompt, Which is case sensitive)
H: displays the help information of the debugger.
| H: displays the help information of the debugger in pages.
Hh: displays a compressed help information.
H debugging command: displays the help of a debugging command.

In the usage of the Perl debugger, the p expression is used to display the values of variables or expressions. The embedded structure and data of complex variables are not displayed.

X expression: displays the value of a variable or expression. For more complex variables, the embedded structure and data are displayed in a readable form.

V package name variable name list: displays the values of all (or part) variables in the specified package. (The default package name is main)

X variable name list: displays the values of all (or part) variables in the current package.

Note: In Perl debugger usage, the list of variable names in the V and X commands is separated by spaces. Remove $, @, or % before the variable names.

T: The call stack of the program is rolled back to the first level.

S expression: One-step execution to go to the sub-function. (Stepinto) If an expression is provided and the expression contains a function call, it is entered into the function.

N expression: A single-step execution that goes beyond the subfunction. (Stepover)

C row number/function name: Execute to a certain row or function.

L: displays the unexecuted content of a window (one screen.

Lmin-max: displays the file content from min to max.

L row number: displays the content of a specified row.

L function name: displays the content of a window (screen) of a specified function.

W row number: displays the content of a window (one screen) around a row.

F file name: switch to another file.

/Mode: Search for matched strings in the current file (at the end of the file.

? Mode: Search for matched strings in the current file (the file header.

L: displays all breakpoints and additional operations.

S Mode: display matching (or not matching, add before mode !) Function name.

T: Switch the tracking mode.

T expression: trace the execution expression process.

Row B condition: a breakpoint is set for a row. When the program runs until the row is reached and the condition is met, an interruption occurs.

In the usage of the Perl debugger, the B function name condition: sets a breakpoint on a function. When the program executes the function and the condition is met, an interruption occurs.

Bload file name: Set a breakpoint on the first executable statement of a file.

D row number: Delete the breakpoint of a row.

D: delete all breakpoints.

Line a command: add an additional operation to a line of the program. Execute the additional operation before executing the statement for this row.

A: delete all installed additional operations.

W expression: Add a monitoring item.

W: delete all monitoring items.

O option name? : Query the optional values of the debugger.

O option name = option value: Set the option value of the debugger.

LtPerl statement: Set an operation to display the operation executed before the debugging prompt.

LtltPerl statement: adds an operation that is executed before the debug prompt.

GtPerl statement: Set an operation that is executed when the debug prompt is left (transferred to the running state.

GtgtPerl statement: adds an operation that is executed when you exit the debugging prompt (transfer to running state.

{DEBUG command: Set an operation to display the operation executed before the debug prompt.

{DEBUG command: Set an operation to display the operation executed before the debug prompt.

Note: In the usage of the Perl debugger, both the preceding Perl statements and Debugging commands can be entered in multiple lines, and the lines are escaped at the end of the line.

! Number: Re-execute the debugging command previously executed for the second time.

! -Number: Re-execute the debugging command that was previously executed number of times.

! Mode: Re-execute the previously executed DEBUG command that matches the mode.

!! Command: run a shell command without exiting the debugger.

H-number: displays the number of Debugging commands previously executed. If number is omitted, all executed
DEBUG command.

R: restart the program being debugged.

Q or ^ D: exit the debugger.

| Debugging command: display the output page of the debugging command.

| Debugging command: similar to | debugging command, suitable for Debugging commands with a large number of outputs, for example: | Vmain.

= Alias value: an alias for a debugging command, for example, = quitq. All unrecognized commands: run as a Perl statement inserted. (Use eval)

There are still many ways to use the Perl debugger. You can set many options to customize the debugger environment. It is also developed using Perl itself, and there are interfaces in the Perl release that allow you to develop other Perl debuggers.
If you want to use Perl to develop large projects, you need to learn these details in detail.
For examples of using the debugger and setting debugger options, see perldebug documentation in the Perl release.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.