I am working with gcc -pg option in order to do some profiling on my C++ program usign gprof. I have added -pg option to both linking and compiling, and added a call to exit(0) in order to have a clean exit point, and I am able to obtain a gmon.out file as desired when everything works fine.
But I have noticed that if the executable compiled with -pg option for some reason generates a core dump, this core dump is truncated (when opening it with gdb gdb says it is truncated, that only some bytes could be written instead of the whole size) , even though on the machine ulimit -c is set to unlimited as usual.
Removing the -pg option, the executable generates normal core dumps.
Is this a known side effect of -pg option?