I was dealing with a program that was segfaulting. It was writing a
core file on segmentation fault. However, I noticed that if a
core file already existed in the directory, the program would not overwrite it on segfault. Only if the existing
core file was deleted, then a new one would be created!
This is due to a well known bug of Apport, the crash reporting service in Ubuntu. It can be disabled as described here. Once disabled, I found that the core file was being overwritten correctly on a new segmentation fault.
Tried with: Apport 2.14.1 and Ubuntu 14.04