<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Using_the_Python_Debugger_%28pdb%29</id>
	<title>Using the Python Debugger (pdb) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Using_the_Python_Debugger_%28pdb%29"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Using_the_Python_Debugger_(pdb)&amp;action=history"/>
	<updated>2026-05-14T01:01:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Using_the_Python_Debugger_(pdb)&amp;diff=9265&amp;oldid=prev</id>
		<title>Kristian Rother: /* Tips */</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Using_the_Python_Debugger_(pdb)&amp;diff=9265&amp;oldid=prev"/>
		<updated>2013-02-08T00:03:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Tips&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|Python Reference}}&lt;br /&gt;
{{Python Links}}&lt;br /&gt;
&lt;br /&gt;
== Interrupting program execution ==&lt;br /&gt;
You can interrupt the program execution and start the debugger by inserting these commands at any point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import pdb&lt;br /&gt;
pdb.set_trace()&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The debugger shows a shell that works like the normal Python command line, but with some extra commands:&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039; (next) – execute next statement.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;s&amp;#039;&amp;#039;&amp;#039; (step) – execute next statement, and descend into functions.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;l&amp;#039;&amp;#039;&amp;#039; (list) – show source code.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;c&amp;#039;&amp;#039;&amp;#039; (continue) – continue execution until the next breakpoint.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;help&amp;#039;&amp;#039;&amp;#039; – print help message.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;q&amp;#039;&amp;#039;&amp;#039; (quit) – abort the program.&lt;br /&gt;
&lt;br /&gt;
== Breakpoints ==&lt;br /&gt;
* The command &amp;#039;&amp;#039;&amp;#039;&amp;#039;b &amp;lt;line number&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039; sets a breakpoint at the given line&lt;br /&gt;
* The command &amp;#039;&amp;#039;&amp;#039;&amp;#039;b&amp;#039;&amp;#039;&amp;#039;&amp;#039; displays all breakpoints set&lt;br /&gt;
== Tips ==&lt;br /&gt;
* A valuable diagnostic tool is to use the debugger for manipulate variable values. e.g.:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; a = 1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Most IDE&amp;#039;s are supporting the debugger. It is much more comfortable to control the program from there.&lt;br /&gt;
* In the debugger command line you can get help on any command by typing &amp;#039;&amp;#039;&amp;#039;&amp;#039;help &amp;lt;command&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;.&lt;/div&gt;</summary>
		<author><name>Kristian Rother</name></author>
	</entry>
</feed>