Hi, I try to collect code coverage data(.gcda) for one server application which working with shared libraries. Normally gcda files will be produced when application exist, so in the server application, _gcov_flush is called to generate the gcda files. The problem is: when _gcov_flush is called, gcda is only generated for those files in server application, not for shared libraries. To test this, I wrote two test files (Some files are copied from other document) File extlib.c #include <stdio.h> extern void print(const char* p, ...); void print(const char* p, ...) { printf("%s World!\n", p); } The shared library can be built by: gcc -shared -fPIC extlib.c -lgcov --coverage -o libext.so File hello.c int main() { print("Hello"); } Build and run hello application as below: rm -f *.gcda gcc hello.c -L./ -lext -o hello -ftest-coverage -fprofile-arcs export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./hello In this case, gcda is generated for both hello.c and extlib.c File hello1.c #include <stdio.h> #include <signal.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> static unsigned long long i = 0; void __gcov_flush(void); /* check in gcc sources gcc/gcov-io.h for the prototype */ void my_handler(int signum) { printf("received signal\n"); printf("%llu\n", i); __gcov_flush(); /* dump coverage data on receiving SIGUSR1 */ } int main(int argc, char **argv) { struct sigaction new_action, old_action; int n; /* setup signal hander */ new_action.sa_handler = my_handler; sigemptyset(&new_action.sa_mask); new_action.sa_flags = 0; sigaction(SIGUSR1, NULL, &old_action); if (old_action.sa_handler != SIG_IGN) sigaction (SIGUSR1, &new_action, NULL); /* infinite loop - to exemplify dumping coverage data while program runs */ for(n = 0; ; n++) { print("Hello "); i++; sleep(2); } } Build and run hello1 as below: rm -f *.gcda gcc hello1.c -L./ -lext -lgcov --coverage -o hello1 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./hello1 then in another terminal, run killall -USR1 hello1 In this case, only gcda file is generated for hello1.c, no gcda file fo extlib.c I run the two cases under openSUSE 10.3 (i586) and gcc is gcc (GCC) 4.2.1 (SUSE Linux) Please help to check how to generate gcda for extlib.c when run hello1.c (server appication with shared library) Thanks in advanced. Victor -- View this message in context: http://gcc.1065356.n5.nabble.com/gcov-for-server-application-with-shared-library-tp970610.html Sent from the gcc - Help mailing list archive at Nabble.com.