Perl -d 调试perl程序

Perl -d 调试perl程序,第1张

概述在控制台输入perldoc perldebug即可如何得到如何调试perl程序的文档。 其中重要的命令如下: p expr      Same as "print {$DB::OUT} expr" in the current package. In                 particular, because this is just Perl's own "print"       

在控制台输入perldoc perldeBUG即可如何得到如何调试perl程序的文档。


其中重要的命令如下:


p expr      Same as "print {$DB::OUT} expr" in the current package. In
                particular,because this is just Perl's own "print"
                function,this means that nested data structures and objects
                are not dumped,unlike with the "x" command.

           

x [maxdepth] expr
                Evaluates its Expression in List context and dumps out the
                result in a pretty-printed fashion.


T           Produce a stack backtrace. See below for details on its
                output.


s [expr]    Single step. Executes until the beginning of another
                statement,descending into subroutine calls. If an
                Expression is supplIEd that includes function calls,it too
                will be single-stepped.

n [expr]    Next. Executes over subroutine calls,until the beginning of
                the next statement. If an Expression is supplIEd that
                includes function calls,those functions will be executed
                with stops before each statement.

r           Continue until the return from the current subroutine. Dump
                the return value if the "PrintRet" option is set (default).


<CR>        Repeat last "n" or "s" command.


L [abw]     List (default all) actions,breakpoints and watch
                Expressions


l           List next window of lines.

l line      List a single line.

    l subname   List first window of lines from subroutine. *subname* may be
                a variable that contains a code reference.


b           Sets breakpoint on current line

b [line] [condition]
                Set a breakpoint before the given line. If a condition is
                specifIEd,it's evaluated each time the statement is
                reached: 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 "if":

                    b 237 $x > 30
                    b 237 ++$count237 < 11
                    b 33 /pattern/i

b subname [condition]
                Set a breakpoint before the first line of the named
                subroutine. *subname* may be a variable containing a code
                reference (in this case *condition* is not supported).

c [line|sub]
                Continue,optionally inserting a one-time-only breakpoint at
                the specifIEd line or subroutine.


q or ^D     Quit. ("quit" doesn't work for this,unless you've made an
                alias) This is the only supported way to exit the deBUGger,
                though tyPing "exit" twice might work.

                Set the "inhibit_exit" option to 0 if you want to be able to
                step off the end the script. You may also need to set
                $finished to 0 if you want to step through global
                destruction.

R           Restart the deBUGger by "exec()"ing a new session. We try to
                maintain your history across this,but internal settings and
                command-line options may be lost.

                The following setting are currently preserved: history,
                breakpoints,actions,deBUGger options,and the Perl
                command-line options -w,-I,and -e.


w expr      Add a global watch-Expression. Whenever a watched global                 changes the deBUGger will stop and display the old and new                 values. W expr      Delete watch-Expression W *         Delete all watch-Expressions.

总结

以上是内存溢出为你收集整理的Perl -d 调试perl程序全部内容,希望文章能够帮你解决Perl -d 调试perl程序所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/langs/1286370.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存