From 718e42b548cf35d8c0bf75214232fb4cdd7f7e98 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 17 Apr 2012 22:18:03 +0300 Subject: [PATCH] smdb_param_buf_size.sh: ask db what size buffers are passed to a function Smatch tracks the size of buffers across function calls. This is a script to check the database for that information. Signed-off-by: Dan Carpenter --- smatch_scripts/db/smdb_param_buf_size.sh | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 smatch_scripts/db/smdb_param_buf_size.sh diff --git a/smatch_scripts/db/smdb_param_buf_size.sh b/smatch_scripts/db/smdb_param_buf_size.sh new file mode 100755 index 00000000..0c6b3d2b --- /dev/null +++ b/smatch_scripts/db/smdb_param_buf_size.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +usage() +{ + echo "Usage $0 " + exit 1 +} + +PARAM=$2 +TYPE=2 + +get_function_pointers() +{ + local func=$1 + + OLD_IFS=$IFS + IFS=" +" + ptrs=$(echo "select ptr from function_ptr where function = '$func';" | sqlite3 smatch_db.sqlite) + for ptr in $ptrs ; do + if [ "$PARAM" = "" ] ; then + echo "select * from caller_info where function = '$ptr' and type='$TYPE';" | sqlite3 smatch_db.sqlite + else + echo "select * from caller_info where function = '$ptr' and type='$TYPE' and parameter='$PARAM';" | sqlite3 smatch_db.sqlite + fi + done + IFS=$OLD_IFS +} + +func=$1 + +if [ "$func" = "" ] ; then + usage +fi + +if [ "$PARAM" = "" ] ; then + echo "select * from caller_info where function = '$func' and type='$TYPE';" | sqlite3 smatch_db.sqlite +else + echo "select * from caller_info where function = '$func' and type='$TYPE' and parameter='$PARAM';" | sqlite3 smatch_db.sqlite +fi +get_function_pointers $func -- 2.11.4.GIT