Error with Visual Profiler after Segfault

I have been attempting to profile a much larger program, but for ease of understanding sake, I have also created a much simpler case for illustrative purposes.

I modified to template project to include this:

   int x = atoi(argv[1]);

    printf("Testing output: %i\n", x);

I am having problems making sure the arguments I call are correct, and the profiler had a very erratic behavior. It would sometimes run, and sometimes not, with the same arguments.

This bit of code will run as many times as there is an argument in the arguments box. As soon as there isn’t one, it will segfault (as I would expect), but if after a segfault, an argument is put in the box, it will not run again afterwards.

The error I get is:

Error -97 in reading profiler output.

Unable to open file.

I don’t know why this is, but I would really like it to not be anymore.

Thanks

I may be wrong, but I would guess that you are using Windows and the program that crashed actually hangs after a crash instead of exiting (maybe some debugger attaches?). Then the profiler file will still be opened by it, thus it can not be deleted/overwritten/anything.

In that case I think the options are:

  1. make sure the program really exits after a crash

  2. use an operating system that does not lock files all the time (basically anything except Windows and OS/2).

I am actually using Linux. Would it be possible in a Gnome environment for such a condition to still occur?