On 10/11/05, Astroman (sent by Nabble.com) <[EMAIL PROTECTED]> wrote: > > I am working on a piece of software that never exits and I am trying to use > -fprofile-arcs and gcov to gather coverage data on it. > The code looks like this: > int main(){ > while(1){ > foo(); > nanosleep(50); > } > } > This is a child process that as you can see will never exit on its own so > eventually it is just signal killed by the parent process. This code could > be changed to exit properly but that is not an option in this case. I am > compiling the code with -fprofile-arcs and -ftest-coverage and I am able to > obtain accurate coverage data for all the files in the project that exit > normally. Is there any way to collect the .da file data before exit? Is it > temporarily stored anywhere or could I alter the gcc library to store this > information more often?
Make it SIGTERM, add a signal handler and do proper sigsetjmp/siglongjmp to jump to a clean exit point. The output should be worth the extra 10 lines of code. Richard.