mizer-pin-tutorial

mizer-pin-tutorial

English
26 Pages
Read
Download
Downloading requires you to have access to the YouScribe library
Learn all about the services we offer

Description

Code Stitching with PinISA 563: Fundamentals of Systems ProgrammingGMUFall 2008 Goals● Introduction to Pin● Highlights of the Pin API● Building a simple tool (strace clone)● Building Mizer, a memoization tool● Wrap-up MotivationWhat the heck is program P doing? Previous Approaches to Debugging & Instrumentation● Self-written (printf, System.out, writeln)– Unreliable (I/O fushing, corrupted state, etc.)– Intrusive (performance, complicates source)– Breaks fow (requires recompilation, meta-debugging)● Debuggers (IDAPro, jdb, gdb, Acme IDE)– Programmable interface is limited● Code proflers (ptrace, gprof, strace, purify)– Only one type of information/featureDynamic Binary Supervision● Valgrind– Great shadow memory subsystem– Multi-stage translation, IR● Dyninst– Trampolines & probes● Pin– Dynamic x86 to x86 compilation– attach/detach Overview: Injecting InstrumentationInstrumentationYour Program PinOverview: Injecting InstrumentationInstrumentationCopy of Your Program PinYour ProgramOverview: Injecting InstrumentationCopy of Your Program PinYour ProgramSteps● Write a Pin tool (C/C++)– Write a series ofins trumentation routines– Register analysis routines at “interesting” events / points– Write analysis routines● Compile against Pin API● Run u(nmodifed!) program – [you@node]$ pin -t mytool -- /bin/ls -Shl ● Observe output / debugPin Benefts● Written with Intel's blessing, support, etc.● Can ...

Subjects

Informations

Published by
Reads 38
Language English
Report a problem
 
Code Stitching with Pin
ISA 563: Fundamentals of Systems Programming
GMU Fall 2008
 
 
Goals
Introduction to Pin
Highlights of the Pin API
Building a simple tool (strace clone)
Building Mizer, a memoization tool
Wrap-up
 
 
Motivation
What the heck is program P doing?
 
 (rsleopre odC
Previous Approaches to Debugging & Instrumentation
Self-written (printf, System.out, writeln)
Programmable interface is limited
  
Unreliable (I/O ushing, corrupted state, etc.)
Intrusive (performance, complicates source)
Breaks ow (requires recompilation, meta-debugging)
Debuggers (IDAPro, jdb, gdb, Acme IDE)
pgor,fs tparec ,urify)  trace, p  
 
Dynamic Binary Supervision
Valgrind
Great shadow memory subsystem
Multi-stage translation, IR
Dyninst
Pin
Trampolines & probes
Dynamic x86 to x86 compilation
attach/detach
 
 
Overview: Injecting Instrumentation
Your Program
 
Instrumentation
Pin
 
Overview: Injecting Instrumentation
Copy of Your Program
Instrumentation
r Program
Pin
 
Overview: Injecting Instrumentation
Copy of Your Program
r Program
Pin
 
Steps
Write a Pin tool (C/C++)
Write a series ofinstrumentation routines
Registeranalysisroutines at “interesting” events / points
Write analysis routines
Compile against Pin API
Run (unmodifed!)program
[you@node]$ pin -t mytool -- /bin/ls -Shl
Observe output / de bug
 
Pin Benets
Written with Intel's blessing, support, etc.
Can attach after program startup
Notices all interesting events, instructions, etc.
Static and dynamic instrumentation
Fairly complete API to extract all this information
Dynamically recompiles: only a 1 time instrumentation overhead  
 
And now the good stu...
Writing an strace(1) clone