Quote Originally Posted by spjackson View Post
OK, let's return to your original post 3 weeks ago, and take your example source and put it in a file fun.c.

Now take this code and put it in a file called dotrace.sh
Code:
#!/bin/bash

image="$1"

echo "Functions called are as follows"
for line in $(egrep '^E' trace.txt)
do
    address=$(echo $line | sed 's/^.//')
    function_name=$(addr2line -e $image -f -s $address | head -1)
    echo ${function_name}'()'
done
Now let's go to my first reply which referred to http://www.ibm.com/developerworks/li...ry/l-graphvis/ and said:

The source code for that article is linked on the above page, so let's get it and use it.

Code:
$ chmod +x ./dotrace.sh
$ wget http://www.mtjones.com/developerworks/pvtrace.zip
$ unzip pvtrace.zip
$ gcc -g -finstrument-functions -o fun fun.c pvtrace/instrument.c
$ ./fun
$ ./dotrace.sh
Functions called are as follows
main()
fun1()
fun2()
fun2_1()
fun3()
The output is precisely what you described in your first post. Is this what you still want? I'm afraid I've lost track somewhat.

Of course there's scope for improvement to the above script and the trace that is always written to ./trace.txt. However, the basic functionality is what you first described.
Sir, thanks a lot for the reply. I'm trying. Will get back to you in an hour's time.