开发者

Signal can't generate core dump after signal Handler

开发者 https://www.devze.com 2023-03-22 14:28 出处:网络
I\'ve heard from someone that if a signal is caught in a signal handler, it won\'t generate a core dump - or a us开发者_如何学Goeless core dump.

I've heard from someone that if a signal is caught in a signal handler, it won't generate a core dump - or a us开发者_如何学Goeless core dump.

Is it right and why?

Working on linux.


Core dump is normally generated in response to certain signals by their default handler. If you modify that handler, you modify the response and so won't get core dump.

Core dump is by default generated in response to signals that happen because of failures (SIGSEGV (access to unmapped memory), SIGILL (invalid instruction), SIGBUS (various other incorrect system access)) and the SIGABRT signal, which is used when the program itself detects fatal error (in standard runtime, from assert or by calling abort()). It is also default for some other signals. In particular SIGUSR1, which the program shouldn't receive unless it's prepared to handle it and changed the handler. See man 7 signal for complete list.

Note, that "default handler" is not a code in the application. It is a special value indicating to kernel that it should take some specific action on behalf of the application. This action is exit for some signals, exit with core dump for some other and do nothing for the rest.

0

精彩评论

暂无评论...
验证码 换一张
取 消