Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
2017 - Peter Hadlaw - Intro to pdb
PyBay
August 13, 2017
Programming
0
71
2017 - Peter Hadlaw - Intro to pdb
PyBay
August 13, 2017
Tweet
Share
More Decks by PyBay
See All by PyBay
2017 - The Packaging Gradient
pybay
1
570
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
270
2017 - Bringing Python 3 to LinkedIn
pybay
0
350
2017 - Python Debugging with PUDB
pybay
0
330
2017 - Opening up to Open Source
pybay
0
95
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
100
2017 - Performant Asynchronous Programming at Quora
pybay
1
160
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
220
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
280
Other Decks in Programming
See All in Programming
Micro Frontends with Module Federation: Beyond the Basics
manfredsteyer
PRO
0
300
Securing Kafka Connect Pipelines with Client-Side Field Level Cryptography @ Kafka Summit London 2022
hpgrahsl
0
300
Node.js 最新動向 TFCon 2022
yosuke_furukawa
PRO
4
2.3k
書籍『良いコード/悪いコードで学ぶ設計入門』でエンジニアリングの当たり前を変える
minodriven
2
970
Enterprise Angular: Frontend Moduliths with Nx and Standalone Components @jax2022
manfredsteyer
PRO
0
260
CLIツールにSwift Concurrencyを適用させようとしている話
417_72ki
3
120
Groovy Roadmap
paulk
7
13k
Becoming an Android Librarian
skydoves
2
370
Modern Web Apps with Spring Boot, Angular & TypeScript
toedter
12
14k
あなたの会社の古いシステム、なんとかしませんか?~システム刷新から考えるDX化への道筋とバリエーション~/webinar20220420-systems
grapecity_dev
0
110
Blazor WebAssembly – Dynamische Formulare und Inhalte in Aktion
patrickjahr
0
150
Yumemi.apk #6 ~ゆめみのAndroidエンジニア 日頃の成果大発表会!~ Session 2
blendthink
1
200
Featured
See All Featured
Writing Fast Ruby
sferik
612
57k
For a Future-Friendly Web
brad_frost
164
7.4k
Adopting Sorbet at Scale
ufuk
63
7.5k
Done Done
chrislema
174
14k
The World Runs on Bad Software
bkeepers
PRO
56
5.2k
Visualization
eitanlees
124
11k
Designing with Data
zakiwarfel
91
3.8k
From Idea to $5000 a Month in 5 Months
shpigford
372
44k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
119
28k
Practical Orchestrator
shlominoach
178
8.6k
Making Projects Easy
brettharned
98
4.3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
103
16k
Transcript
INTRO TO pdb Peter Hadlaw @ Tesorio August 13, 2017
https://www.tesorio.com/careers
TOO OFTEN I SEE... print foo print foo['bar'] print fizz.buzz()
...
CONS: Limited (can't interrupt execution) Messy (lot's of clean up)
Zero interactivity (need to modify code and run everything again) Much harder to dive deeper into third party code (internal or external alike)
DEBUGGER Exist in many languages and platforms Python's built-in debugger
is... "A computer program that assists in the detection and correction of errors in computer programs."
pdb
THREE EASY STEPS 1. Set a breakpoint 2. Run program
3. Execution halts at breakpoint and now, you, interact
SETTING A BREAKPOINT import pdb; pdb.set_trace() Using a one liner
is a nice habit to make clean up easier (e.g. a single dd in vi).
api.py
RUN PROGRAM
l - LIST COMMAND
EXPRESSIONS
n - NEXT COMMAND
s - STEP COMMAND
c - CONTINUE COMMAND
GENERAL FLOW Use l to orient yourself and inspect what
code is currently being executed. Use n to step forward in execution Use s to dive deeper Create expressions for the debugger to evaluate and gain insights into what's happening c to continue execution until next breakpoint / finish Profit.
NOTES More commands and features available iPython version, much more
powerful (has to be installed separately) Other languages have debuggers to, for example JavaScript in the browser, or C (gdb)
WE'RE HIRING https://www.tesorio.com/careers