1#!/bin/bash 2 3if echo $1 | grep -q '^-p' ; then 4 PROJ=$(echo $1 | cut -d = -f 2) 5 shift 6fi 7 8info_file=$1 9 10if [[ "$info_file" = "" ]] ; then 11 echo "Usage: $0 -p=<project> <file with smatch messages>" 12 exit 1 13fi 14 15bin_dir=$(dirname $0) 16db_file=smatch_db.sqlite 17 18files=$(grep "insert into caller_info" $info_file | cut -d : -f 1 | sort -u) 19for c_file in $files; do 20 echo "FILE $c_file" 21 echo "delete from caller_info where file = '$c_file';" | sqlite3 $db_file 22 echo "delete from return_states where file = '$c_file';" | sqlite3 $db_file 23 echo "delete from call_implies where file = '$c_file';" | sqlite3 $db_file 24 echo "delete from return_implies where file = '$c_file';" | sqlite3 $db_file 25done 26 27tmp_file=$(mktemp) 28 29grep "insert into caller_info" $info_file > $tmp_file 30${bin_dir}/fill_db_caller_info.pl "$PROJ" $tmp_file $db_file 31 32grep "insert into return_states" $info_file > $tmp_file 33${bin_dir}/fill_db_sql.pl "$PROJ" $tmp_file $db_file 34 35grep "into call_implies" $info_file > $tmp_file 36${bin_dir}/fill_db_sql.pl "$PROJ" $tmp_file $db_file 37 38grep "into return_implies" $info_file > $tmp_file 39${bin_dir}/fill_db_sql.pl "$PROJ" $tmp_file $db_file 40 41rm $tmp_file 42 43${bin_dir}/fixup_all.sh $db_file 44if [ "$PROJ" != "" ] ; then 45 ${bin_dir}/fixup_${PROJ}.sh $db_file 46fi 47 48