Python pdb Lib

Source: Internet
Author: User
Tags pprint

Use the PDB module in Python to debug
Import PDB
Pdb.set_trace ()

You can also use the python-m pdb mysqcript.py this way

(PDB) will automatically stop in the first line, waiting for debugging, you can see the Help
(Pdb) H #说明下这几个关键 command

> Breakpoint Settings
(Pdb) B #断点设置在本py的第10行
or (Pdb) b ots.py:20 #断点设置到 ots.py line 20th
Delete Breakpoint (Pdb) b #查看断点编号
(PDB) CL 2 #删除第2个断点

> Operation
(PDB) n #单步运行
(PDB) s #细点运行 that's going down, method
(PDB) C #执行到下个断点
R #执行到函数返回
> View
(Pdb) p param #查看当前变量值
(PDB) L #查看运行到某处代码
(PDB) A #查看参数
(PDB) W lists the layers in the current call stack.
(Pdb) d moves down one layer in the call stack
(Pdb) u move up one layer in the call stack. If you press n after a layer has been moved up, the next narrative will be performed at the level after the move up, and the previous function call will automatically return.
(PDB) CL clears the specified breakpoint. If no parameters are taken, all breakpoints are cleared.
(Pdb) Disable the ability to cancel all breakpoints, but still retain those breakpoints.
(PDB) enable the ability to restore breakpoints.
(PDB) Ignore sets the number of times the breakpoint is ignored. If count is not specified, it is initially 0. When Count is 0 o'clock, the breakpoint will act normally. If count is specified, the count is less than 1, until the count is 0, each time the interrupt is performed.
(Pdb) condition Bpnumber [condition]
(PDB) J (UMP) Lineno. Jumps to a row to execute. It only works at the bottom of the call stack.
(PDB) L lists the location in the current file. The continuous l command is always listed at the end of the file and can be printed using the specified number of rows or ranges.
(Pdb) the PP and P commands are similar, but use the Pprint module (Pprint for details, refer to Python libraryreference).
(PDB) alias takes an "alias" instead of "a bunch of debug commands," Something like the macro for C/s + + (refer to pythonlibrary Reference for details).
(PDB) Unalias cancels an alias.
(PDB) [!] Statement the narrative in the current environment (context).
BT View Call Stack

Python pdb Lib

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.