在pdb
、Sharma debugger>上,可以确定休息点。
b classname.methodname
after the class definition has been parsed.
例如,
% pdb ~/pybin/test.py
> /home/unutbu/pybin/test.py(4)<module>()
-> class Foo(object):
(Pdb) l
1 #!/usr/bin/env python
2 # coding: utf-8
3
4 -> class Foo(object):
5 def bar(self): pass
6
7 foo=Foo()
8 foo.bar()
[EOF]
在课堂上课前设置休息点失败:
(Pdb) b Foo.bar
*** The specified object Foo.bar is not a function
or was not found along sys.path.
but after parsing the class:
(Pdb) n
> /home/unutbu/pybin/test.py(7)<module>()
-> foo=Foo()
(Pdb) l
2 # coding: utf-8
3
4 class Foo(object):
5 def bar(self): pass
6
7 -> foo=Foo()
8 foo.bar()
[EOF]
规定休息点工作:
(Pdb) b Foo.bar
Breakpoint 1 at /home/unutbu/pybin/test.py:5
(Pdb)
(Pdb) r
> /home/unutbu/pybin/test.py(5)bar()
-> def bar(self): pass