Backtracing with shell script

I have a text file test.txt which contains :
inst_f1
inst_f2
inst_f3
inst_f4
.
.
.
.
inst_fn
where inst_f1.... inst_fn are particular function type used in a given cpp file
I have to read the file test.txt line by line
Suppose the First fn is inst_f1. I have to find the fn in which this fn is called from the cpp
and so on
for eg: the contents of cpp file are
void clas_name :: rvvd_inst_into_tabl
( void )
{
rvvd_call_tabl()
}
void clas_name :: rvvd_call_tabl
( void )
{
rvvd_chck_tabl()
}
void clas_name :: rvvd_chck_tabl
( void )
{
inst_f1()
}

So the flow would be
inst_f1 <<--- rvvd_chck_tabl <<---- rvvd_call_tabl <<----- rvvd_inst_into_tabl
and I have to keep all things dynamic ie ( Number of Fncs in test.txt will change for diff cpp class)

Your Suggestions appreciated

Thanks
-Ultimatix

can we search a particular function for a matching pattern at runtime

Pls help

pls help m out unix gurus

i tried something like this..

while read line
do
grep -l "$line" *.cpp|xargs grep "void clas_name">temp_file
n_l=`awk 'END{print NR}' temp_file`
c=1
while [ $c -ne $n_l ] ; do
if [ $c -eq "1" ] ; then
tail -$c temp_file|awk -F"::" -v var=$line '{print var"<<--"$2}'
else
tail -$c temp_file|awk -F"::" '{print "<<--"$2}'
fi
c=$((c+1))
done
done < test.txt
rm temp_file

but this output in following way
inst_f1<<-- rvvd_chck_tabl
<<-- rvvd_call_tabl
<<-- rvvd_chck_tabl
inst_f2<<-- rvvd_chck_tabb
<<-- rvvd_call_tabb
<<-- rvvd_chck_tabb

PS:ultimatix?? sound like TCS'ser :o