Reputation: 10497
I got a simple c program to test "core dump" behavior:
$ cat 1.c
int main()
{
int buf[]={1,2};
int j=buf[20000]+buf[30000];
return 0;
}
I did:
$ ulimit -c unlimited
$ gcc 1.c
$ a.out
It generates a core file, no problem. I run "a.out" again, this time the previous "core" file was not overwritten, unless I removed the core file manually, and then a new core file is generated.
Question: how can I setup the ubuntu linux to make sure each time there's a crash, a new core dump file will overwrite the old one?
Upvotes: 1
Views: 633
Reputation: 2972
You can toggle adding pid to core file, so every time program started with new pid core name will have new pid as 'extension'
echo 1 > /proc/sys/kernel/core_uses_pid
also, read this with much more details
Upvotes: 2