SlideShare a Scribd company logo
http://www.skillbrew.com
/Skillbrew
Talent brewed by the industry itself
pdb – The interactive Debugger
Pavan Verma
@YinYangPavan
Founder, P3 InfoTech Solutions Pvt. Ltd.
1
Python Programming Essentials
© SkillBrew http://skillbrew.com
Content
 Python debugger introduction
 Enter into debugger via command line
 pdb commands
2
© SkillBrew http://skillbrew.com
PDB - The Python Debugger
1. pdb implements an interactive debugging
environment for Python programs
2. It lest you do a the following :
1. Pause your program
2. Look at the values of variables
3. Program execution step-by-step
4. Step up and down the call stack
3
© SkillBrew http://skillbrew.com
Enter into Debugger via command line
python –m pdb filename
Running the debugger from the command line causes it to
load your source file and stop execution on the first
statement it finds
4
© SkillBrew http://skillbrew.com
Enter into Debugger from within program (1)
import pdb
pdb.set_trace()
Use pdb.set_trace()in the program where
ever you want the program to enter into the
debugger
5
© SkillBrew http://skillbrew.com
pdb commands
list or l
Using list with a single
numerical argument lists 11
lines around that line
instead of the current line
6
© SkillBrew http://skillbrew.com
pdb commands (2)
where
At any point while the
debugger is running
you can use where
(abbreviated w) to find
out exactly what line is
being executed and
where on the call stack
you are
7
© SkillBrew http://skillbrew.com
pdb commands (3)
step
Use step to execute the
current line and then stop
at the next execution
point – either the first
statement inside a
function being called or
the next line of the
current function
8
© SkillBrew http://skillbrew.com
pdb commands (4)
next or n:
The next command is like
step, but does not enter
functions called from the
statement being executed. In
effect, it steps all the way
through the function call to
the next statement in the
current function in a single
operation.
9
© SkillBrew http://skillbrew.com
pdb commands (5)
up (u) and down (d)
• Move between frames
within the current call stack
using up and down
• up (abbreviated u) moves
towards older frames on
the stack
• down (abbreviated d)
moves towards newer
frames
10
© SkillBrew http://skillbrew.com
Resources
 http://docs.python.org/2/library/pdb.html
11
12

More Related Content

What's hot (20)

PPT
Rifartek Robot Training Course - How to use ClientRobot
Tsai Tsung-Yi
 
PPT
What do you mean it needs to be Java based? How jython saved the day.
Mark Rees
 
PPT
Presentation_C++UnitTest
Raihan Masud
 
PPTX
Python Programming Essentials - M19 - Namespaces, Global Variables and Docstr...
P3 InfoTech Solutions Pvt. Ltd.
 
PPT
Communication between Java and Python
Andreas Schreiber
 
PPTX
Python Programming Essentials - M9 - String Formatting
P3 InfoTech Solutions Pvt. Ltd.
 
PPT
Google C++ Testing Framework in Visual Studio 2008
Andrea Francia
 
PPTX
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
Taeyeop Kim
 
PDF
Firefox Easily Analyzed by PVS-Studio Standalone
Andrey Karpov
 
ODP
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
David Glick
 
PPT
Perl Modules
stn_tkiller
 
ODP
Testing Toolbox
Michael Peters
 
PPTX
Oop object oriented programing topics
(•̮̮̃•̃) Prince Do Not Work
 
PDF
Codeception: introduction to php testing (v2 - Aberdeen php)
Engineor
 
PDF
Analysis of merge requests in GitLab using PVS-Studio for C#
Andrey Karpov
 
PPTX
Command line arguments
Ashok Raj
 
PDF
Karma - JS Test Runner
Sebastiano Armeli
 
PPTX
Preprocessor
Võ Hòa
 
PPTX
Dead-Simple Async Control Flow with Coroutines
Travis Kaufman
 
Rifartek Robot Training Course - How to use ClientRobot
Tsai Tsung-Yi
 
What do you mean it needs to be Java based? How jython saved the day.
Mark Rees
 
Presentation_C++UnitTest
Raihan Masud
 
Python Programming Essentials - M19 - Namespaces, Global Variables and Docstr...
P3 InfoTech Solutions Pvt. Ltd.
 
Communication between Java and Python
Andreas Schreiber
 
Python Programming Essentials - M9 - String Formatting
P3 InfoTech Solutions Pvt. Ltd.
 
Google C++ Testing Framework in Visual Studio 2008
Andrea Francia
 
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
Taeyeop Kim
 
Firefox Easily Analyzed by PVS-Studio Standalone
Andrey Karpov
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
David Glick
 
Perl Modules
stn_tkiller
 
Testing Toolbox
Michael Peters
 
Oop object oriented programing topics
(•̮̮̃•̃) Prince Do Not Work
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Engineor
 
Analysis of merge requests in GitLab using PVS-Studio for C#
Andrey Karpov
 
Command line arguments
Ashok Raj
 
Karma - JS Test Runner
Sebastiano Armeli
 
Preprocessor
Võ Hòa
 
Dead-Simple Async Control Flow with Coroutines
Travis Kaufman
 

Viewers also liked (17)

PPTX
Python Programming Essentials - M40 - Invoking External Programs
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M31 - PEP 8
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M44 - Overview of Web Development
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M35 - Iterators & Generators
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M39 - Unit Testing
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M4 - Editors and IDEs
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M10 - Numbers and Artihmetic Operators
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M8 - String Methods
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M23 - datetime module
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M21 - Exception Handling
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M1 - Course Introduction
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M25 - os and sys modules
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M29 - Python Interpreter and Files
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M34 - List Comprehensions
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M5 - Variables
P3 InfoTech Solutions Pvt. Ltd.
 
ODP
Introduction To Django
Tuan Anh Tran
 
PPTX
Python Programming Essentials - M15 - References
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M40 - Invoking External Programs
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M31 - PEP 8
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M44 - Overview of Web Development
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M35 - Iterators & Generators
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M39 - Unit Testing
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M4 - Editors and IDEs
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M10 - Numbers and Artihmetic Operators
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M8 - String Methods
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M23 - datetime module
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M21 - Exception Handling
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M1 - Course Introduction
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M25 - os and sys modules
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M29 - Python Interpreter and Files
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M34 - List Comprehensions
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M5 - Variables
P3 InfoTech Solutions Pvt. Ltd.
 
Introduction To Django
Tuan Anh Tran
 
Python Programming Essentials - M15 - References
P3 InfoTech Solutions Pvt. Ltd.
 
Ad

Similar to Python Programming Essentials - M28 - Debugging with pdb (20)

PDF
Open Dayligth usando SDN-NFV
Open Networking Perú (Opennetsoft)
 
PPT
gdb.ppt
LavishGupta22
 
PDF
OpenPOWER Application Optimization
Ganesan Narayanasamy
 
PPTX
Openshift Presentation ppt compare with VM
shubhamage1
 
PPTX
Debugging Modern C++ Application with Gdb
SenthilKumar Selvaraj
 
PDF
Python debuggers slides
mattboehm
 
PDF
Buffer overflow tutorial
hughpearse
 
DOCX
Python introduction
Learnbay Datascience
 
PPT
ES-CH5.ppt
alaakaraja1
 
PDF
Reverse engineering – debugging fundamentals
Eran Goldstein
 
PDF
ECET 360 help A Guide to career/Snaptutorial
pinck2380
 
PDF
ECET 360 help A Guide to career/Snaptutorial
pinck200
 
PDF
Make your application expressive
Christian Varela
 
PDF
Becoming A Plumber: Building Deployment Pipelines - LISA17
Daniel Barker
 
PPTX
assisgnment 2 python.pptx important questions
palak1710yadav
 
PPTX
Wavedigitech gdb
Wave Digitech
 
PDF
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
Pixie Labs
 
PDF
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
Zain Asgar
 
DOCX
Debugger & Profiler in NetBeans
Huu Bang Le Phan
 
PDF
Architecting the Future: Abstractions and Metadata - KCDC
Daniel Barker
 
Open Dayligth usando SDN-NFV
Open Networking Perú (Opennetsoft)
 
gdb.ppt
LavishGupta22
 
OpenPOWER Application Optimization
Ganesan Narayanasamy
 
Openshift Presentation ppt compare with VM
shubhamage1
 
Debugging Modern C++ Application with Gdb
SenthilKumar Selvaraj
 
Python debuggers slides
mattboehm
 
Buffer overflow tutorial
hughpearse
 
Python introduction
Learnbay Datascience
 
ES-CH5.ppt
alaakaraja1
 
Reverse engineering – debugging fundamentals
Eran Goldstein
 
ECET 360 help A Guide to career/Snaptutorial
pinck2380
 
ECET 360 help A Guide to career/Snaptutorial
pinck200
 
Make your application expressive
Christian Varela
 
Becoming A Plumber: Building Deployment Pipelines - LISA17
Daniel Barker
 
assisgnment 2 python.pptx important questions
palak1710yadav
 
Wavedigitech gdb
Wave Digitech
 
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
Pixie Labs
 
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
Zain Asgar
 
Debugger & Profiler in NetBeans
Huu Bang Le Phan
 
Architecting the Future: Abstractions and Metadata - KCDC
Daniel Barker
 
Ad

More from P3 InfoTech Solutions Pvt. Ltd. (9)

PPTX
Python Programming Essentials - M24 - math module
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M22 - File Operations
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M20 - Classes and Objects
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M17 - Functions
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M16 - Control Flow Statements and Loops
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M14 - Dictionaries
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M13 - Tuples
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M12 - Lists
P3 InfoTech Solutions Pvt. Ltd.
 
PPTX
Python Programming Essentials - M11 - Comparison and Logical Operators
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M24 - math module
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M22 - File Operations
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M20 - Classes and Objects
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M17 - Functions
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M16 - Control Flow Statements and Loops
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M14 - Dictionaries
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M13 - Tuples
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M12 - Lists
P3 InfoTech Solutions Pvt. Ltd.
 
Python Programming Essentials - M11 - Comparison and Logical Operators
P3 InfoTech Solutions Pvt. Ltd.
 

Python Programming Essentials - M28 - Debugging with pdb