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