Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DTrace: printf debugging for seventh-level wizards
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Shawn Moore
January 14, 2012
Programming
1.3k
2
Share
DTrace: printf debugging for seventh-level wizards
Shawn Moore
January 14, 2012
More Decks by Shawn Moore
See All by Shawn Moore
Right the First Time
sartak
0
520
Lifting Moose
sartak
0
670
Kindergarten Code
sartak
0
140
How to be Fluent in Japanese
sartak
0
200
DTrace War Stories
sartak
1
190
Moose Role Usage Patterns
sartak
5
6k
git-status-tackle
sartak
5
390
Extending Moose for Applications
sartak
1
390
API Design
sartak
4
990
Other Decks in Programming
See All in Programming
AI Assistants for YourAngular Solutions @Angular Graz, March 2026
manfredsteyer
PRO
0
140
20260315 AWSなんもわからん🥲
chiilog
2
180
Claude Code Skill入門
mayahoney
0
460
RailsのValidatesをSwift Macrosで再現してみた
hokuron
0
150
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
6
1.2k
飯MCP
yusukebe
0
460
Java 21/25 Virtual Threads 소개
debop
0
320
Feature Toggle は捨てやすく使おう
gennei
0
400
「速くなった気がする」をデータで疑う
senleaf24
0
130
How to stabilize UI tests using XCTest
akkeylab
0
150
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
120
KagglerがMixSeekを触ってみた
morim
0
360
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Writing Fast Ruby
sferik
630
63k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.5k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
The browser strikes back
jonoalderson
0
870
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
140
Google's AI Overviews - The New Search
badams
0
950
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Six Lessons from altMBA
skipperchong
29
4.2k
Docker and Python
trallard
47
3.8k
Building Applications with DynamoDB
mza
96
7k
Transcript
@sartak DTRACE printf debugging for seventh-level wizards 121݄14༵
ME ME ME ME ME ME ME Shawn M Moore
@sartak I’m Bawstin’ Moose-lover Infinity Interactive 121݄14༵
What’s my computer doing right now? Q: A: Find out
with DTrace 121݄14༵
iotop $ iotop dtrace: failed to initialize dtrace: DTrace requires
additional privileges You may already have DTrace and not even know it. 121݄14༵
Solaris & OS X (complete) Linux (partial) Profiler (Different and
deeper than NYTProf) Debugger Kernel module “You don’t port DTrace to an OS, you port an OS to DTrace” DTRACE 121݄14༵
SAFE! ɾNo unwanted side effects ɾVery low overhead ɾDo it
in production! 121݄14༵
σϞ pidpersec iotop execsnoop opensnoop dtruss plockstat iosnoop Global (high
level) The metal (low level) 121݄14༵
σϞ pidpersec iotop execsnoop opensnoop dtruss plockstat iosnoop Global (high
level) The metal (low level) 121݄14༵
PROGRAMMABILITY dtrace -n ' syscall::open:entry /strstr(copyinstr(arg0), "corpus") != NULL/ {
printf("%s %s",execname,copyinstr(arg0)); }' Show processes that open a file whose name includes “corpus” 121݄14༵
PROGRAMMABILITY dtrace -n ' syscall::open:entry /strstr(copyinstr(arg0), "corpus") != NULL/ {
printf("%s %s",execname,copyinstr(arg0)); }' Show processes that open a file whose name includes “corpus” Event(Probe Description) 121݄14༵
PROGRAMMABILITY dtrace -n ' syscall::open:entry /strstr(copyinstr(arg0), "corpus") != NULL/ {
printf("%s %s",execname,copyinstr(arg0)); }' Show processes that open a file whose name includes “corpus” Predicate 121݄14༵
PROGRAMMABILITY dtrace -n ' syscall::open:entry /strstr(copyinstr(arg0), "corpus") != NULL/ {
printf("%s %s",execname,copyinstr(arg0)); }' Show processes that open a file whose name includes “corpus” Action 121݄14༵
PROGRAMMABILITY dtrace -n ' syscall::open:entry /strstr(copyinstr(arg0), "corpus") != NULL/ {
printf("%s %s",execname,copyinstr(arg0)); }' Show processes that open a file whose name includes “corpus” 121݄14༵
DTrace instrumentation points ɾKernel function calls/returns (syscalls too) ɾPerl function
calls/returns ɾSQL execution ɾthreads ɾsignals ɾmany more PROBES 121݄14༵
THE COOL DEMO HEY, FORGETFUL! DEMO THE GPG THING 121݄14༵
PROFILER Devel::NYTProf kicks ass 121݄14༵
PROFILER But there’s more than one way to do it
121݄14༵
PROFILER DEMO: syscalls intuit_method 121݄14༵
XCode’s profiler uses DTrace 121݄14༵
121݄14༵
TRANSLATION “I am comfortable being ignorant and helpless” 121݄14༵
DEBUGGER Request Tracker (e.g. rt.cpan.org) was failing tests on mod_perl.
On only my computer. Probably because of all the Japanese. 121݄14༵
DEBUGGER Failed test 'gpg: error reading key: ެ։伴͕ݟ͔ͭΓ·ͤΜ' doesn't match
'(?-xism:public key not found)' 121݄14༵
DEBUGGER ެ։伴͕ݟ͔ͭΓ·ͤΜ isn’t part of RT’s Japanese i18n 121݄14༵
DEBUGGER ެ։伴͕ݟ͔ͭΓ·ͤΜ possibly from GPG’s i18n? 121݄14༵
DEBUGGER gpg-2.0.18 $ ack -a ެ։伴͕ݟ͔ͭΓ·ͤΜ gpg-2.0.18 $ 121݄14༵
DEBUGGER gpg-2.0.18 $ echo "ެ։伴͕ݟ͔ͭΓ·ͤΜ" | iconv -f UTF-8 -t
EUCJP | xargs ack -ao | iconv -f EUCJP -t UTF-8 Binary file po/ja.gmo matches po/ja.po:2965:ެ։伴͕ݟ͔ͭΓ·ͤΜ po/ja.po:6525:ެ։伴͕ݟ͔ͭΓ·ͤΜ po/ja.po:8311:ެ։伴͕ݟ͔ͭΓ·ͤΜ gpg-2.0.18 $ 121݄14༵
DEBUGGER probably a mis-set $LANG, $LC_ALL? 121݄14༵
DEBUGGER Ͱ LC_ALL=en gpg LC_ALL=ja gpg LC_ALL= gpg opensnoop 121݄14༵
DEBUGGER Without DTrace, woulda had to add print statements to
GPG itself 121݄14༵
DEBUGGER then compiled it 121݄14༵
DEBUGGER then installed it 121݄14༵
DEBUGGER then repeated a couple of times because I’m a
“throw everything til something sticks” kinda guy 121݄14༵
DEBUGGER then cleaned up after all that hot mess 121݄14༵
DEBUGGER DTrace is great for debugging interactions between programs 121݄14༵
DEBUGGER DTrace is great for debugging interactions between YOUR BEAUTIFUL
CODE and THE IDIOTS 121݄14༵
Perl ɾ5.10.0+: sub-entry, sub-return ɾ5.15.1+: phase-change (${^GLOBAL_PHASE}) ɹ ɾFuture?: string
eval, etc. perldoc perldtrace 121݄14༵
Perl ɾ5.10.0Ҏ߱: sub-entry, sub-return ɾ5.15.1Ҏ߱: phase-change ɹ ɾকདྷʁ: string eval
My first Perl patch! Was simple! perldtrace 121݄14༵
QUESTIONS? ຊޠͰ̤̠Ͱ͢ʂ slides: http://twitter.com/sartak 121݄14༵