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
strace(1) all the things!
Search
Dan Miller
November 13, 2014
Programming
3
650
strace(1) all the things!
Presented at the Marist College Computer Society meeting, 11/12/14
Dan Miller
November 13, 2014
Tweet
Share
More Decks by Dan Miller
See All by Dan Miller
Oh Snap!
jazzdan
0
290
HHVM at Etsy
jazzdan
22
6.9k
"API First" Development
jazzdan
7
1.1k
Other Decks in Programming
See All in Programming
CSC307 Lecture 03
javiergs
PRO
1
480
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
5.7k
組織で育むオブザーバビリティ
ryota_hnk
0
140
AtCoder Conference 2025
shindannin
0
980
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
400
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
3.8k
gunshi
kazupon
1
140
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
120
ゆくKotlin くるRust
exoego
1
210
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
160
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
340
AIエージェントの設計で注意するべきポイント6選
har1101
6
3.2k
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
99
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
47
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
220
The SEO identity crisis: Don't let AI make you average
varn
0
55
Embracing the Ebb and Flow
colly
88
5k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
260
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
190
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Optimizing for Happiness
mojombo
379
71k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
For a Future-Friendly Web
brad_frost
181
10k
Transcript
strace(1) all the things Dan Miller Software Engineer Etsy
etsy.com/careers
@jazzdan strace(1) all the things What is strace(1)? How to
see what a program does without the source A quick aside about man(1) pages How does ls(1) work?
What is strace?
@jazzdan strace(1) is a unix utility for observing system calls
How do we see what a program does without reading
the source?
@jazzdan $ls
@jazzdan $strace ls
None
@jazzdan strace ls • execve(2) • open(2) • close(2) •
getdents(2) • write(2)
A quick aside on Unix man pages
@jazzdan $man man
None
None
None
How does ls work?
execve("/bin/ls", ["ls"], [/* 23 vars */]) = 0
None
execve() executes the program pointed to by filename. filename must
be either a binary executable, or a script starting with a line of the form: ! #! interpreter [optional-arg]
int execve(const char *filename, char *const argv[], char *const envp[]);
open( “/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC ) = 3
None
Given a pathname for a file, open() returns a file
descriptor, a small, nonnegative integer for use in subsequent system calls (read(2), write(2), lseek(2), fcntl(2), etc.).
int open(const char *pathname, int flags)
open( “/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC ) = 3
@jazzdan Wait… what is libc?
@jazzdan $man libc
None
open( “.", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC ) = 3
getdents( 3, /* 4 entries */, 32768 ) = 712
None
int getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int count);
getdents( 3, /* 23 entries */, 32768 )= 712
open( “.", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC ) = 3
close(3)
None
int close(int fd);
close(3)
write( 1, “hello_world\n", hello_world ) = 23
None
exit_group(0) = ?
None
This system call is equivalent to exit(2) except that it
terminates not only the calling thread, but all threads in the calling process's thread group.
void exit_group(int status);
@jazzdan When is strace(1) useful? • Anything involving files or
sockets • Path issues • See what is being sent over a network interface
@jazzdan When is strace(1) not useful? • In production (performance
is terrible) • When no syscalls are being executed
One Cool Trick for Performance Analysis (perf folks hate ‘em)
@jazzdan $strace -c ls
None
Questions?