diff --git a/tools/cover.sh b/tools/cover.sh index 76b770b0b9684be1166ae8ef863e1d47703ff19e..adb610e3a80346c5a912d9cb972d3eb72c8ecfc0 100755 --- a/tools/cover.sh +++ b/tools/cover.sh @@ -15,6 +15,23 @@ OUTPUT_BLACKLIST_FILE=$6 # output file with list of functions to blacklis CANDIDATE_FNS_PRE_LIBC=`dirname $6`/p1.candidates.prelibc + +$SECURITY_TRANSFORMS_HOME/tools/cover/cover $ORIGINAL_BINARY $ANNOTATION_FILE $EXECUTED_ADDRESS_FILE $OUTPUT_COVERAGE_FILE +status=$? +cp $FILTER_FILE $OUTPUT_BLACKLIST_FILE +cat $OUTPUT_COVERAGE_FILE | cut -f1 -d" " > $CANDIDATE_FNS_PRE_LIBC + +if [ ! $status -eq 0 ]; then +# cp $FILTER_FILE $OUTPUT_BLACKLIST_FILE + return 1 +fi + +return 0 + +#below is a relic from when PN could not take ina coverage file, it is left here +#as it is uncertain as to whether we do want to filter functions at this level +#in this scenario yet. + # # Prune out functions that do not have sufficient coverage # Any function whose coverage metric starts with 0.0, e.g. 0.09, 0.0123, is pruned out @@ -23,25 +40,20 @@ CANDIDATE_FNS_PRE_LIBC=`dirname $6`/p1.candidates.prelibc # Yes, this is a hack... but it will do for now until we get a more sophisticated definition of coverage # -$SECURITY_TRANSFORMS_HOME/tools/cover/cover $ORIGINAL_BINARY $ANNOTATION_FILE $EXECUTED_ADDRESS_FILE $OUTPUT_COVERAGE_FILE -if [ ! $? -eq 0 ]; then - cp $FILTER_FILE $OUTPUT_BLACKLIST_FILE - return 1 -fi - -if [ ! -f $OUTPUT_COVERAGE_FILE ]; then - cp $FILTER_FILE $OUTPUT_BLACKLIST_FILE - return 1 -fi +#if [ ! -f $OUTPUT_COVERAGE_FILE ]; then +# cp $FILTER_FILE $OUTPUT_BLACKLIST_FILE +# return 1 +#fi -grep -v "0\.000" $OUTPUT_COVERAGE_FILE | cut -f1 -d" " > $CANDIDATE_FNS_PRE_LIBC -grep "0\.000" $OUTPUT_COVERAGE_FILE | cut -f1 -d" " > $OUTPUT_BLACKLIST_FILE +#cat $OUTPUT_COVERAGE_FILE | cut -f1 -d" ">$CANDIDATE_FNS_PRE_LIBC +#grep -v "0\.000" $OUTPUT_COVERAGE_FILE | cut -f1 -d" " > $CANDIDATE_FNS_PRE_LIBC +#grep "0\.000" $OUTPUT_COVERAGE_FILE | cut -f1 -d" " > $OUTPUT_BLACKLIST_FILE # Filter out functions that: # 1. are not sufficiently covered # 2. are libc function -cat $FILTER_FILE >> $OUTPUT_BLACKLIST_FILE -sort $OUTPUT_BLACKLIST_FILE | uniq > tmp.$$ -mv tmp.$$ $OUTPUT_BLACKLIST_FILE +#cat $FILTER_FILE >> $OUTPUT_BLACKLIST_FILE +#sort $OUTPUT_BLACKLIST_FILE | uniq > tmp.$$ +#mv tmp.$$ $OUTPUT_BLACKLIST_FILE -return 0 +#return 0