Created by: gaasedelen
TL;DR
This PR adds an optional -logprefix
command line toggle to the drcov
tool.
By default, drcov
will prefix log files with 'drcov', eg drcov.ls.57735.0000.proc.log
. The addition of this command line option allows users to change the prefix to a string of their choosing. This can be used to build a clear relationship between which invocation produced which log file.
Problem Usecase
A growing number of DynamoRIO users have been integrating drcov
into their fuzzing and instrumentation workflows. A common nuisance among these users is that there isn't a great way for a fuzz harness (or anything) that wraps drcov
to specify an output filename for the coverage log.
As a result, it can be difficult to correlate which fuzzed input testcase generated which log after the fact with any certainty.
doom@upwn64:~/projects/dynamorio/testing$ ../build/bin64/drrun -t drcov -- /bin/ls /what/the/fuzz
/bin/ls: cannot access '/what/the/fuzz': No such file or directory
doom@upwn64:~/projects/dynamorio/testing$ ../build/bin64/drrun -t drcov -- /bin/ls .
drcov.ls.57735.0000.proc.log drcov.ls.57736.0000.proc.log
doom@upwn64:~/projects/dynamorio/testing$ ls -al
total 80
drwxrwxr-x 2 doom doom 4096 Apr 4 14:21 .
drwxrwxr-x 14 doom doom 4096 Apr 4 13:57 ..
-rw-rw---- 1 doom doom 37465 Apr 4 14:21 drcov.ls.57735.0000.proc.log
-rw-rw---- 1 doom doom 32505 Apr 4 14:21 drcov.ls.57736.0000.proc.log
Which log is which? Obviously, this becomes increasingly tedious when there are tens of thousands of executions / logs being generated simultaneously.
Example Usage
The example below demonstrates the usage of the new -logprefix
option:
doom@upwn64:~/projects/dynamorio/testing$ ../build/bin64/drrun -t drcov -- /bin/ls
1.txt 2.txt drcov.ls.57606.0000.proc.log
doom@upwn64:~/projects/dynamorio/testing$ ../build/bin64/drrun -t drcov -logprefix "testcase_123" -- /bin/ls
1.txt 2.txt drcov.ls.57606.0000.proc.log testcase_123.ls.57609.0000.proc.log
doom@upwn64:~/projects/dynamorio/testing$ ls -al
total 76
drwxrwxr-x 2 doom doom 4096 Apr 4 13:58 .
drwxrwxr-x 14 doom doom 4096 Apr 4 13:57 ..
-rw-rw-r-- 1 doom doom 0 Apr 4 13:57 1.txt
-rw-rw-r-- 1 doom doom 7 Apr 4 13:57 2.txt
-rw-rw---- 1 doom doom 32041 Apr 4 13:58 drcov.ls.57606.0000.proc.log
-rw-rw---- 1 doom doom 32201 Apr 4 13:58 testcase_123.ls.57609.0000.proc.log
Additional Comments
Most users would prefer the ability to specify a static / known log filename. But being able to change the log file prefix seemed like a fair compromise and the path of least resistance for the existing codebase.
I am open to alternative solutions, but would like to see a change like this integrated in one form or another.