Core dump

From vpsget wiki
Revision as of 15:53, 5 August 2014 by Ndi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How to switch core dump function between node and container.

File on the node:

/proc/sys/kernel/core_pattern

Original value (dump works on node):

|/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e

Edit the line so the core dump is working inside a container but isn't working on the node:

echo "/var/dump/core.%e.%p.%h.%t" >> /proc/sys/kernel/core_pattern

The /proc/sys/kernel/core_pattern take value on boot from /etc/sysctl.conf

kernel.core_pattern = /var/dump/core.%p

You can always apply values from sysctl.con with next command:

sysctl -p

A code for generating segmentation fail error:

#include <stdio.h>
 
int main()
{
int *null_p = NULL;
*null_p = 10; //write to null pointer memory area,Segmentation fault will happen
return 0;
}

Compile it with gcc:

# gcc seg.c -o seg

Run to test

# ./seg
Segmentation fault (core dumped)

check the /var/dump/ for core file