/usr/bin/python -m pdb /usr/bin/cinder-api --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/api.log
> /usr/bin/cinder-api(18)<module>()
-> """Starter script for Cinder OS API."""
(Pdb)
(Pdb) n 执行下一行(next)
> /usr/bin/cinder-api(20)<module>()
-> import eventlet
(Pdb) b 30 在30行设置断点
Breakpoint 1 at /usr/bin/cinder-api:30
(Pdb) b 查询断点 (break)
Num Type Disp Enb Where
1 breakpoint keep yes at /usr/bin/cinder-api:30
(Pdb)
Num Type Disp Enb Where
1 breakpoint keep yes at /usr/bin/cinder-api:30
(Pdb) n
> /usr/bin/cinder-api(21)<module>()
-> eventlet.monkey_patch()
(Pdb)
> /usr/bin/cinder-api(23)<module>()
-> import os
(Pdb) l 查看当前行的代码段(list)
18 """Starter script for Cinder OS API."""
19
20 import eventlet
21 eventlet.monkey_patch()
22
23 -> import os
24 import sys
25
26 from oslo.config import cfg
27
28 possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
(Pdb) s 进入函数单步执行(step)
> /usr/bin/cinder-api(24)<module>()
-> import sys
(Pdb)
> /usr/bin/cinder-api(26)<module>()
-> from oslo.config import cfg
(Pdb)
--Call--
> /usr/lib/python2.6/site-packages/oslo/config/__init__.py(1)<module>()
-> # vim: tabstop=4 shiftwidth=4 softtabstop=4
(Pdb)
> /usr/lib/python2.6/site-packages/oslo/config/__init__.py(1)<module>()
-> # vim: tabstop=4 shiftwidth=4 softtabstop=4
(Pdb)
--Return--
> /usr/lib/python2.6/site-packages/oslo/config/__init__.py(1)<module>()->None
-> # vim: tabstop=4 shiftwidth=4 softtabstop=4
(Pdb)
--Call--
> /usr/lib/python2.6/site-packages/oslo/config/cfg.py(261)<module>()
-> """
(Pdb)
> /usr/lib/python2.6/site-packages/oslo/config/cfg.py(261)<module>()
-> """
(Pdb)
> /usr/lib/python2.6/site-packages/oslo/config/cfg.py(263)<module>()
-> import argparse
(Pdb)
--Call--
> /usr/lib/python2.6/site-packages/argparse.py(62)<module>()
-> """
(Pdb)
> /usr/lib/python2.6/site-packages/argparse.py(62)<module>()
-> """
(Pdb)
> /usr/lib/python2.6/site-packages/argparse.py(64)<module>()
-> __version__ = '1.2.1'
(Pdb)c 继续一直执行(continue)
> /usr/bin/cinder-api(51)<module>()
-> version=version.version_string())
(Pdb)
> /usr/bin/cinder-api(52)<module>()
-> logging.setup("cinder")
(Pdb) p version 打印变量值
<module 'cinder.version' from '/usr/lib/python2.6/site-packages/cinder/version.pyc'>
(Pdb) pp version
<module 'cinder.version' from '/usr/lib/python2.6/site-packages/cinder/version.pyc'>
(Pdb)d linenumber 删除指定断点
(Pdb)r 跳到下一个断点处
(Pdb)h 帮助