Check the '/proc/sys/kernel/core_pattern' file
cat /proc/sys/kernel/core_pattern
if the output of above command is
|/usr/share/apport/apport %p %s %c %P
then you need to edit the 'core_pattern' file and replace
|/usr/share/apport/apport %p %s %c %P
with
core.%e.%p
to do this by below command
sudo su -c 'echo "core.%e.%p" > /proc/sys/kernel/core_pattern'
it will ask you for root password, and its done. At the string 'core.%e.%p' %e means the executable file name and %p denotes the processID. Now to test the core dumping first run below command
ulimit -c unlimited
then compile below code and run it.
test.c
cat /proc/sys/kernel/core_pattern
if the output of above command is
|/usr/share/apport/apport %p %s %c %P
then you need to edit the 'core_pattern' file and replace
|/usr/share/apport/apport %p %s %c %P
with
core.%e.%p
to do this by below command
sudo su -c 'echo "core.%e.%p" > /proc/sys/kernel/core_pattern'
it will ask you for root password, and its done. At the string 'core.%e.%p' %e means the executable file name and %p denotes the processID. Now to test the core dumping first run below command
ulimit -c unlimited
then compile below code and run it.
test.c
#include<stdio.h>
int main()
{
char buff[20];
int i;
for(i=0;i<40;i++) {
buff[i] ='\x41';
}
}