Debugging Program during execution

I have made use of 'valgrind' and -finstrument-functions compiler option for debugging / analyzing code. Both the options lets us know the line / file being executed to some extent.

Is there a generic way that lets program dump the file:line it is getting executed dumped to a log file during execution apart from GDB.

Am not clear.

Did you mean to say - an automatic code coverage run ( similar to that ) when executed via debugger ( GDB ) ?

No, I did not meant about code coverage functionality. My understanding on code coverage is that % of code executed, while I am looking for debugging a flow.

The options that I have provided provide details of files:line that the code in execution has covered while valgrind states particular type of issues with the code.

Here's an output of valgrind:

11> valgrind w

==21875== Conditional jump or move depends on uninitialised value(s)
==21875== at 0x40308D9A: profil_counter (../sysdeps/posix/profil.c:47)
==21875== by 0x4018402B: vgPlain_HT_destruct (vg_hashtable.c:213)
==21875== by 0x40295B46: __libc_system (in /lib/libc-2.1.3.so)
==21875== by 0x8048570: main (w.cpp:7)
==21875==

12> addr2line -Cfe w 0x8048570
main
/x/home/xxxxxxxxxx/w.cpp:7
13>

Same with compiler options that I have listed. Now if these tools can provide information of the code flow in execution, is there a possible way to list complete 'file:line' of the code execution path?

I gone though gcov tool and that exactly suffices my need but the issue is that our codebase has hundreds of file compiled, linked to form one binary. So how do I use this tool on all the files as running on each file is very time consuming and does not seems to be a good approach.