Dyninst Scalable Tools Workshop Granlibakken Resort Lake Tahoe, - - PowerPoint PPT Presentation

dyninst
SMART_READER_LITE
LIVE PREVIEW

Dyninst Scalable Tools Workshop Granlibakken Resort Lake Tahoe, - - PowerPoint PPT Presentation

Dyninst Scalable Tools Workshop Granlibakken Resort Lake Tahoe, California Dyninst Scalable Tools Workshop A Brief Introduction to Dyninst Dyninst: a tool for static and dynamic binary instrumentation and modification 2 Dyninst Scalable


slide-1
SLIDE 1

Dyninst

Scalable Tools Workshop

Granlibakken Resort Lake Tahoe, California

slide-2
SLIDE 2

Dyninst Scalable Tools Workshop

Dyninst: a tool for static and dynamic binary instrumentation and modification

A Brief Introduction to Dyninst

2

slide-3
SLIDE 3

Dyninst Scalable Tools Workshop

Parse API

A Dyninst Component

Dataflow API

A Dyninst Component

Proc Control API

A Dyninst Component

Patch API

A Dyninst Component

Stack Walker API

A Dyninst Component

Symtab API

A Dyninst Component

Instruction API

A Dyninst Component

Codegen

A Dyninst Component

DynC

A Dyninst Component

Binary Binary

Process

How is Dyninst organized?

3

slide-4
SLIDE 4

Dyninst Scalable Tools Workshop

  • Changes to the build system
  • Test suite enhancements to support

Continuous Integration testing

  • Parallel parsing
  • ARMv8 advances

What is new since July 2018?

4

slide-5
SLIDE 5

Dyninst Scalable Tools Workshop

Dyninst /usr http:

ElfUtils TBB Boost

Boost ElfUtils TBB

Test suite

/usr http:

ElfUtils TBB Boost

Boost ElfUtils TBB

X

Changes to the Build System

5

slide-6
SLIDE 6

Dyninst Scalable Tools Workshop

⚫ All CMake variable names are now uniform across all dependencies ⚫ Many new variables have been exposed for finer control of the build ⚫ Export all CMake variables into cache ⚫ applications use them through CMake’s load_cache

Caveat: rpath doesn’t work fully (yet)

github.com/dyninst/dyninst/wiki

Changes to the Build System

6

slide-7
SLIDE 7

Dyninst Scalable Tools Workshop

Dyninst is one of three applications testing the CI workflow for ECP New build script for turnkey building and testing of Dyninst git clone dyninst git clone testsuite perl build.pl

  • 1. Build Dyninst
  • 2. Build Test suite
  • 3. Run Test suite
  • 4. Upload results to our dashboard

github.com/dyninst/testsuite

Getting the Test Suite Ready for CI

7

slide-8
SLIDE 8

Dyninst Scalable Tools Workshop

What effect does this have on you?

Users: None

Developers: Github pull requests will be manually run through the new build script before acceptance

Future:

  • All PRs will be automatically run through CI
  • this is 6+ months away
  • Automatic nightly and weekly builds of the head of Master

Getting the Test Suite Ready for CI

8

slide-9
SLIDE 9

Dyninst Scalable Tools Workshop

  • Dyninst 10.0 added parallel code parsing

Uses function level parallelism in ParseAPI

Speedup relative to 1 thread is ~2-4x

  • Dyninst 10.1 fixed a few bugs
  • Performance is still limited by serial code

GNU memory allocator

symbol table construction

parse frame initialization

parse finalization

Parallel Parsing

9

slide-10
SLIDE 10

Dyninst Scalable Tools Workshop

  • Post 10.1 features under testing:

Optimized parallel ParseAPI

New parallel SymtabAPI

  • Changes include:

Parallel symbol table construction

Parallel parsing frame initialization

Parallel finalization

Remove redundant calculation

Scalable allocator from TBB

Parallel Parsing

10

slide-11
SLIDE 11

Dyninst Scalable Tools Workshop

Performance compared to 10.1 version

min max

10.1 baseline 3.4x 10.1 optimized 1.1x 6.1x

Speedup

Parallel Parsing

11

slide-12
SLIDE 12

Dyninst Scalable Tools Workshop

Code analysis: complete Dynamic instrumentation: complete Binary rewriting:

○ Dynamically-linked code: complete ○ Statically-linked code: in progress

ARMv8 Advances

12

slide-13
SLIDE 13

Dyninst Scalable Tools Workshop

What can I do with Dyninst?

Function entry/exit tracing Stack walking Code coverage

13

slide-14
SLIDE 14

Dyninst Scalable Tools Workshop

Function Entry/Exit Instrumentation

Process

Function Add(…) You have a process (or a binary) that contains a function and you want to collect information such as:

  • How often it was called
  • Time the function
  • Get parameters supplied to the function

How would you do this? You could modify the source code to include your instrumentation, recompile, and rerun

14

slide-15
SLIDE 15

Dyninst Scalable Tools Workshop

Function Entry/Exit Instrumentation

Process

Function Add(…) You have a process (or a binary) that contains a function and you want to collect information such as:

  • How often it was called
  • Time the function
  • Get parameters supplied to the function

How would you do this? You could modify the source code to include your instrumentation, recompile, and rerun Drawbacks: Maintain instrumentation w/ application source, source code may not be available (i.e. closed source), etc

15

slide-16
SLIDE 16

Dyninst Scalable Tools Workshop

Function Entry/Exit Instrumentation

Process

Function Add(…) You have a process (or a binary) that contains a function and you want to collect information such as:

  • How often it was called
  • Time the function
  • Get parameters supplied to the function

How would you do this? You could modify the source code to include your instrumentation, recompile, and rerun Drawbacks: Maintain instrumentation w/ application source, source code may not be available (i.e. closed source), etc. You could avoid these problems by using binary instrumentation.

16

slide-17
SLIDE 17

Dyninst Scalable Tools Workshop

Show an example of how to use Dyninst to insert entry/exit instrumentation into a function.

○ Function call to a tracing

library at entry/exit.

00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

Function Entry/Exit Instrumentation

17

slide-18
SLIDE 18

Dyninst Scalable Tools Workshop addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

Function Entry/Exit Instrumentation

18

slide-19
SLIDE 19

Dyninst Scalable Tools Workshop addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit)

00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

addrSpace->loadLibrary(“libtrace.so”); Function Entry/Exit Instrumentation

19

slide-20
SLIDE 20

Dyninst Scalable Tools Workshop addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit)

00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

addrSpace->loadLibrary(“libtrace.so”); libtrace.so

XXX <Trace>: …: push %rbp … …: retq

Function Entry/Exit Instrumentation

20

slide-21
SLIDE 21

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”); Function Entry/Exit Instrumentation

21

slide-22
SLIDE 22

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”); Function Entry/Exit Instrumentation

22

slide-23
SLIDE 23

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”);

  • 5. Find the entry/exit points of the function

entry = add->findPoint(BPatch_locEntry); exit = add->findPoint(BPatch_locExit); Function Entry/Exit Instrumentation

23

slide-24
SLIDE 24

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”);

  • 5. Find the entry/exit points of the function

entry = add->findPoint(BPatch_locEntry); exit = add->findPoint(BPatch_locExit);

  • 6. Create the instrumentation snippet (call Trace())

BPatch_funcCallExpr traceExpr(trace,…) Function Entry/Exit Instrumentation

24

slide-25
SLIDE 25

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”);

  • 5. Find the entry/exit points of the function

entry = add->findPoint(BPatch_locEntry); exit = add->findPoint(BPatch_locExit);

  • 6. Create the instrumentation snippet (call Trace())

BPatch_funcCallExpr traceExpr(trace,…)

  • 7. Insert Snippet

addrSpace->insertSnippet(traceExpr,entry) Function Entry/Exit Instrumentation

25

slide-26
SLIDE 26

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: call Trace 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp call Trace 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”);

  • 5. Find the entry/exit points of the function

entry = add->findPoint(BPatch_locEntry); exit = add->findPoint(BPatch_locExit);

  • 6. Create the instrumentation snippet (call Trace())

BPatch_funcCallExpr traceExpr(trace,…)

  • 7. Insert Snippet

addrSpace->insertSnippet(traceExpr,entry) addrSpace->insertSnippet(traceExpr,exit) Function Entry/Exit Instrumentation

26

slide-27
SLIDE 27

Dyninst Scalable Tools Workshop

Only minor modifications are needed to extend this example to:

  • Basic Block

Instrumentation

  • Memory Tracing

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: call Trace 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp call Trace 60d: retq

Function Entry/Exit Instrumentation

27

slide-28
SLIDE 28

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: call Trace 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp call Trace 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”);

  • 5. Find the entry/exit points of the function

entry = add->findPoint(BPatch_locEntry); exit = add->findPoint(BPatch_locExit);

  • 6. Create the instrumentation snippet (call Trace())

BPatch_funcCallExpr traceExpr(trace,…)

  • 7. Insert Snippet

addrSpace->insertSnippet(traceExpr,entry) addrSpace->insertSnippet(traceExpr,exit) Function Entry/Exit Instrumentation

28

slide-29
SLIDE 29

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

Basic Block Instrumentation libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: call Trace 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp call Trace 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 5. Find the entry/exit points of the blocks in the function
  • 6. Create the instrumentation snippet (call Trace())

BPatch_funcCallExpr traceExpr(trace,…)

  • 7. Insert Snippet

addrSpace->insertSnippet(traceExpr,entry) addrSpace->insertSnippet(traceExpr,exit)

add->getCFG()->getAllBasicBlocks(blocks) for(auto block : blocks) entry.push_back(block->findEntryPoint()) exit.push_back(block->findExitPoint())

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”);

29

slide-30
SLIDE 30

Dyninst Scalable Tools Workshop add = addrSpace->findFunction(“add”);

  • 3. Find the function you want instrument

Load/Store Operation Instrumentation libtrace.so

XXX <Trace>: …: push %rbp … …: retq 00000000000005fa <add>: call Trace 5fa: push %rbp 5fb: mov %rsp,%rbp 5fe: mov %edi,-0x4(%rbp) 601: mov %esi,-0x8(%rbp) 604: mov

  • 0x4(%rbp),%edx

607: mov

  • 0x8(%rbp),%eax

60a: add %edx,%eax 60c: pop %rbp call Trace 60d: retq

addrSpace = bpatch.processCreate(…);

  • 1. Open the binary/attach to or create the process with

the function you want to trace

  • 2. Insert the tracing library (contains the function you

want to call at entry/exit) addrSpace->loadLibrary(“libtrace.so”);

  • 5. Find Load/Store operations in the function
  • 6. Create the instrumentation snippet (call Trace())

BPatch_funcCallExpr traceExpr(trace,…)

  • 7. Insert Snippet

addrSpace->insertSnippet(traceExpr,lsp)

std::set<BPatch_opCode> axs; axs.insert(BPatch_opLoad); axs.insert(BPatch_opStore); lsp = add->findPoint(axs)

  • 4. Find the function you want to insert at entry/exit

trace = addrSpace->findFunction(“Trace”);

30

slide-31
SLIDE 31

Dyninst Scalable Tools Workshop

Stack Tracing

Walk through the stack frames that lead to the current program counter address Example Use Cases:

  • Examining the context of

crashes

  • Attribute performance

measurement

void main() { int a; foo(0); … } void foo(int b) { int c; bar(); … } void bar() { int d; while(1); } We will be doing third-party stack walk (attach to the process of the code example)

31

slide-32
SLIDE 32

Dyninst Scalable Tools Workshop

Stack Tracing

void main() { int a; foo(0); … } void foo(int b) { int c; bar(); … } void bar() { int d; while(1); }

main's frame object: FP RA SP a foo's frame object: FP RA SP bar's frame object: FP RA SP Stack memory FP Registers SP PC b main's RA main's FP c foo's RA foo's FP d

We use binary analysis, DWARF frame information, signal context information, and analyze Dyninst instrumentation to extract frames

32

slide-33
SLIDE 33

Dyninst Scalable Tools Workshop

Stack Tracing

void main() { int a; foo(0); … } void foo(int b) { int c; bar(); … } void bar() { int d; while(1); }

main's frame object: FP RA SP foo's frame object: FP RA SP bar's frame object: FP RA SP walker = Walker::newWalker(pid);

  • 1. Attach to or create the process to perform stack walk

vector<Frame> frames; Walker->walkStack(frames);

  • 2. Perform the stack walk

// function name of frame i frame[i].getName(s); // stack pointer value of frame i frame[i].getSP() // frame pointer value of frame i frame[i].getFP() // return address of frame i frame[i].getRA()

  • 3. Examine each frame

33

slide-34
SLIDE 34

Dyninst Scalable Tools Workshop

Code Coverage

Determine which code in a binary have been executed through a test run.

34

slide-35
SLIDE 35

Dyninst Scalable Tools Workshop

Code Coverage

Determine which code in a binary have been executed through a test run. What for? To know how well their tests actually test their code. To know whether they have enough testing in place.

35

slide-36
SLIDE 36

Dyninst Scalable Tools Workshop

Code Coverage

Determine which code in a binary have been executed through a test run. What for? To know how well their tests actually test their code. To know whether they have enough testing in place. Dyninst can be used to perform code coverage at function level or basic block level.

36

slide-37
SLIDE 37

Dyninst Scalable Tools Workshop

  • 1. Get all functions

Code coverage

functions = addrSpace->getProcedures() XXX <add>: XXX: push %rbp ... XXX: retq YYY <sub>: YYY: push %rbp ... YYY: retq ZZZ <printf>: ZZZ: push %rbp ... ZZZ: retq

slide-38
SLIDE 38

Dyninst Scalable Tools Workshop

  • 1. Get all functions
  • 2. Allocate memory for flags

Code coverage

vectorFlag = addrSpace()->malloc(n) functions = addrSpace->getProcedures() XXX <add>: XXX: push %rbp ... XXX: retq YYY <sub>: YYY: push %rbp ... YYY: retq ZZZ <printf>: ZZZ: push %rbp ... ZZZ: retq

slide-39
SLIDE 39

Dyninst Scalable Tools Workshop

  • 1. Get all functions
  • 2. Allocate memory for flags

Code coverage

for (auto i : functions) BPatch_arithExpr assign(BPatch_assign, vectorFlag[i], BPatch_constExpr(1)); BPatch_breakPointExpr bp; addrSpace->insertSnippet(assign,point) addrSpace->insertSnippet(bp,point) vectorFlag = addrSpace()->malloc(n) functions = addrSpace->getProcedures()

  • 3. Instrument entry point of every function

XXX <add>: XXX: inc vectorFlag[0] XXX: break XXX: push %rbp ... XXX: retq YYY <sub>: YYY: inc vectorFlag[1] YYY: break YYY: push %rbp ... YYY: retq ZZZ <printf>: ZZZ: inc vectorFlag[2] ZZZ: break ZZZ: push %rbp ... ZZZ: retq

slide-40
SLIDE 40

Dyninst Scalable Tools Workshop

  • 1. Get all functions
  • 2. Allocate memory for flags

Code coverage

for (auto i : functions) BPatch_arithExpr assign(BPatch_assign, vectorFlag[i], BPatch_constExpr(1)); BPatch_breakPointExpr bp; addrSpace->insertSnippet(assign,point) addrSpace->insertSnippet(bp,point) vectorFlag = addrSpace()->malloc(n) functions = addrSpace->getProcedures()

  • 3. Instrument entry point of every function
  • 4. Clean up

While(process != terminated){ // continueExecution() // WaitForStatusChange() // Program at breakpoint // Copy from mutatee to mutator vectorFlag For(int i = 0; i < vectorFlag.size(); i++) If (vectorFlag[i] == 1) addrSpace->deleteSnippet(assign) addrSpace->deleteSnippet(bp) } XXX <add>: XXX: inc vectorFlag[0] XXX: break XXX: push %rbp ... XXX: retq YYY <sub>: YYY: inc vectorFlag[1] YYY: break YYY: push %rbp ... YYY: retq ZZZ <printf>: ZZZ: push %rbp ... ZZZ: retq

slide-41
SLIDE 41

Dyninst Scalable Tools Workshop

  • 1. Count basic blocks
  • 2. Allocate memory for flags

Code coverage (basic block)

for (auto i : functions) add->getCFG()->getAllBasicBlocks(blocks) for(auto block : blocks) BPatch_arithExpr assign(BPatch_assign, vectorFlag[i], BPatch_constExpr(1)); BPatch_breakPointExpr bp; addrSpace->insertSnippet(assign,point) addrSpace->insertSnippet(bp,point)

vectorFlag = addrSpace()->malloc(m)

  • 3. Instrument entry point of every function
  • 4. Clean up

While(process != terminated){ // continueExecution() // WaitForStatusChange() // Program at breakpoint // Copy from mutatee to mutator vectorFlag For(int i = 0; i < vectorFlag.size(); i++) If (vectorFlag[i] == 1) addrSpace->deleteSnippet(assign) addrSpace->deleteSnippet(bp) } m = for each function -> number of basic blocks

slide-42
SLIDE 42

Dyninst Scalable Tools Workshop

The Road Ahead: Features for 2020

  • Statically-linked code for ARMv8
  • Continue to improve build system
  • Automate CI testing
  • Parallel DWARF parsing

42

slide-43
SLIDE 43

Dyninst Scalable Tools Workshop

Who collaborates on Dyninst?

Thanks to contributions from:

  • John Mellor-Crummey and Mark Krentel (Rice)
  • Matt Legendre (LLNL)
  • Ben Woodard (Red Hat)
  • Stan Cox (Red Hat)

43

slide-44
SLIDE 44

Dyninst Scalable Tools Workshop

Who uses Dyninst?

Dyninst is used by:

  • HPCToolkit (Rice)
  • SystemTap (Red Hat)
  • Open|SpeedShop
  • stat (LLNL)
  • ATP (Cray)

Not on this list? Let us know!

44

slide-45
SLIDE 45

Dyninst Scalable Tools Workshop

45

Questions?

slide-46
SLIDE 46

Dyninst Scalable Tools Workshop

46

slide-47
SLIDE 47

Dyninst Scalable Tools Workshop

47