Python Single Step debugging tool PDB

Source: Internet
Author: User
Method One: Run python-m pdb pythonname.py
(PDB) automatically stops at the first line and waits for debugging, so you can look at the Help
(Pdb) H
Description of these key commands

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

> Operation
(PDB) n #单步运行
(PDB) s #细点运行 is the next, method
(PDB) C #跳到下个断点
> View
(Pdb) p param #查看当前 Variable value
(PDB) L #查看运行到某处代码
(PDB) A #查看全部栈内变量

If you want to start one step at a code point, you can write it as follows:

Import PDB

Pdb.set_trace ()

Can be, the following code:



Variable _DEBUG for debug switches

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.