python的pdb調試命令介紹
1、next執行下一條語句,如果本句是函數調用,則執行函數,接著執行當前執行語句的下一條。文章源自四五設計網-http://www.wasochina.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.wasochina.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.wasochina.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.wasochina.com/26971.html
</stoplineno,不會中斷。直到for循環執行結束,緊接著的下一行的lineno==stoplineno,執行中斷>文章源自四五設計網-http://www.wasochina.com/26971.html 文章源自四五設計網-http://www.wasochina.com/26971.html


評論