(Here I'm targeting only Linux)

I'm assuming core is generated by the glibc's default signal handler.

But if I google most of result says OS generate a core dump. If OS generates core, signal handler will be called first (or) core dumped first?

有帮助吗?

解决方案

The kernel itself generates the coredump. See the core handling routines in the linux kernel source here:

http://lxr.linux.no/linux+v3.12.6/fs/coredump.c

If the process receives any of the following signals 1, the kernel responds by attempting a coredump.

#define SIG_KERNEL_COREDUMP_MASK (\
rt_sigmask(SIGQUIT)   |  rt_sigmask(SIGILL)    | \
rt_sigmask(SIGTRAP)   |  rt_sigmask(SIGABRT)   | \
rt_sigmask(SIGFPE)    |  rt_sigmask(SIGSEGV)   | \
rt_sigmask(SIGBUS)    |  rt_sigmask(SIGSYS)    | \
rt_sigmask(SIGXCPU)   |  rt_sigmask(SIGXFSZ)   | \
SIGEMT_MASK  

This coredump is configurable, and can be disabled or controlled in several ways, including the file /proc/sys/kernel/core_pattern, and ulimit. One can also control the delivery of these signals through the signal handling mechanisms.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top