Process Control:
The command line arguments of ./coverage
should assume this form:
./coverage <program_path> [args] ,
where [args] are the command-line
arguments for the mutatee.
Resume the mutatee's execution after instrumentation is
installed.
(You can copy this code from maxarg.C)
|
Variables:
Find the functions belonging to the executable, and
create a counter for each function in the mutatee.
Useful API functions |
Create a variable |
BPatch_process::malloc |
page 21 |
|
Instrumentation:
Find main in the mutatee and initialize your counters to zero at its entry point.
Instrument each function to
increment its counter variable every time
it is invoked.
Useful API functions |
Find function entry/exit points |
BPatch_function::findPoint |
page 33 |
Create instrumentation: |
BPatch_snippet subclass constructors |
pages 43-48 |
Create assignment statements |
BPatch_arithExpr constructor |
page 44 |
Place instrumentation at program points |
BPatch_process::insertSnippet |
page 22 |
Read from a variable |
BPatch_variable::readValue |
page 49 |
|
Output:
Register an exit callback function as in the sample program,
where you will retrieve the function invocation
counts and print out the name and address of each function,
along with the number of
times it was called.
Useful API functions |
Read from a variable |
BPatch_variable::readValue |
page 45 |
Hint: In order to access your function count variables in the
exit callback you will need to declare them globally
|