首页IT科技pdb常用命令(python中pdb有哪些调试命令)

pdb常用命令(python中pdb有哪些调试命令)

时间2025-08-02 08:53:24分类IT科技浏览5056
导读:1、next执行下一条语句,如果本句是函数调用,则执行函数,接着执行当前执行语句的下一条。 defstop_here(self,frame :...

1               、next执行下一条语句                ,如果本句是函数调用                      ,则执行函数        ,接着执行当前执行语句的下一条               。

defstop_here(self,frame): ... #如果frame还没跳出stopframe            ,永远返回true ifframeisself.stopframe: ifself.stoplineno==-1: returnFalse returnframe.f_lineno>=self.stoplineno #如果frame跳出了stopframe                      ,进入下一个frame            ,则执行不会中断        ,一直到跳出到stopframe #还有一种情况                      ,如果在return事件中断执行了next                ,下一次跟踪在上一级frame中    ,此时上一级frame能跟踪到botframe                      ,中断 whileframeisnotNoneandframeisnotself.stopframe: ifframeisself.botframe: returnTrue frame=frame.f_back returnFalse

2                        、step执行下一条命令                   ,如果本句是函数调用,则s会执行到函数的第一句                        。

defstop_here(self,frame): ... #stopframe为None ifframeisself.stopframe: ... #当前frame一定会追溯到botframe                   ,返回true whileframeisnotNoneandframeisnotself.stopframe: ifframeisself.botframe: returnTrue frame=frame.f_back returnFalse

3       、return执行当前运行函数到结束       。

defstop_here(self,frame): ... #如果当前帧代码顺序执行                      ,下一个frame的lineno==stoplineno #如果执行到for循环的最后一行    ,下一个frame(for循环第一行)的lineno<stoplineno                ,不会中断           。直到for循环执行结束                      ,紧接着的下一行的lineno==stoplineno        ,执行中断 ifframeisself.stopframe: ifself.stoplineno==-1: returnFalse returnframe.f_lineno>=self.stoplineno #如果在非botframe中            ,会先追溯到stopframe                      ,返回false            ,同next whileframeisnotNoneandframeisnotself.stopframe: ifframeisself.botframe: returnTrue frame=frame.f_back returnFalse

以上就是python中pdb调试命令的介绍        ,希望对大家有所帮助                        。更多Python学习指路:Python基础教程

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
提高写作技能英文翻译(提升英语写作能力的万能句型) 域名后面com和cn的区别(域名cn和com哪一个好 com与cn的域名有什么区别(域名com跟cn的区别))