python的pdb有什么调试命令?python的pdb调试命令介绍

星之卡比猫 百科知识评论阅读模式

python的pdb调试命令介绍

1、next执行下一条语句,如果本句是函数调用,则执行函数,接着执行当前执行语句的下一条。文章源自设计学徒自学网-http://www.sx1c.com/26971.html

def stop_here(self, frame):         ...         # 如果frame还没跳出stopframe,永远返回true         if frame is self.stopframe:             if self.stoplineno == -1:                 return False             return frame.f_lineno >= self.stoplineno             # 如果frame跳出了stopframe,进入下一个frame,则执行不会中断,一直到跳出到stopframe         # 还有一种情况,如果在return事件中断执行了next,下一次跟踪在上一级frame中,此时上一级frame能跟踪到botframe,中断         while frame is not None and frame is not self.stopframe:             if frame is self.botframe:                 return True             frame = frame.f_back         return False
2、step执行下一条命令,如果本句是函数调用,则s会执行到函数的第一句。文章源自设计学徒自学网-http://www.sx1c.com/26971.html

def stop_here(self, frame):         ...         # stopframe为None         if frame is self.stopframe:             ...         # 当前frame一定会追溯到botframe,返回true         while frame is not None and frame is not self.stopframe:             if frame is self.botframe:                 return True             frame = frame.f_back         return False
3、return执行当前运行函数到结束。文章源自设计学徒自学网-http://www.sx1c.com/26971.html

def stop_here(self, frame):         ...         # 如果当前帧代码顺序执行,下一个frame的lineno==stoplineno         # 如果执行到for循环的最后一行,下一个frame(for循环第一行)的lineno<stoplineno,不会中断。直到for循环执行结束,紧接着的下一行的lineno==stoplineno,执行中断         if frame is self.stopframe:=""             if self.stoplineno ="= -1:"                 return false=""             return frame.f_lineno ="">= self.stoplineno             # 如果在非botframe中,会先追溯到stopframe,返回false,同next         while frame is not None and frame is not self.stopframe:             if frame is self.botframe:                 return True             frame = frame.f_back         return False
以上就是“python的pdb调试命令介绍”演示过程了,看完这个教程你学会了么。文章源自设计学徒自学网-http://www.sx1c.com/26971.html

</stoplineno,不会中断。直到for循环执行结束,紧接着的下一行的lineno==stoplineno,执行中断>文章源自设计学徒自学网-http://www.sx1c.com/26971.html 文章源自设计学徒自学网-http://www.sx1c.com/26971.html

继续阅读
我的微信
微信扫一扫
weinxin
我的微信
惠生活福利社
微信扫一扫
weinxin
我的公众号
 
星之卡比猫
  • 本文由 星之卡比猫 发表于 2023年6月29日09:54:31
  • 转载请务必保留本文链接:http://www.sx1c.com/26971.html
    本站展示的所有图文软件均来自于互联网,仅用于软件学习研究分享传递,请勿商用,本站如有侵权请联系客服删除。
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

拖动滑块以完成验证