取消禁止生成core文件
ulimit -c unlimited
设置core文件生成规则
echo "/tmp/core-%e-%p-%t" >> /proc/sys/kernel/core_pattern
主动触发程序崩溃
kill -sigtrap pid
调试
gdb program core
默认dump的信号表
Signal Standard Action Comment
────────────────────────────────────────────────────────────────────────
SIGABRT P1990 Core Abort signal from abort(3)
SIGBUS P2001 Core Bus error (bad memory access)
SIGFPE P1990 Core Floating-point exception
SIGILL P1990 Core Illegal Instruction
SIGIOT - Core IOT trap. A synonym for SIGABRT
SIGQUIT P1990 Core Quit from keyboard
SIGSEGV P1990 Core Invalid memory reference
SIGSYS P2001 Core Bad system call (SVr4);
see also seccomp(2)
SIGTRAP P2001 Core Trace/breakpoint trap
SIGUNUSED - Core Synonymous with SIGSYS
SIGXCPU P2001 Core CPU time limit exceeded (4.2BSD);
see setrlimit(2)
SIGXFSZ P2001 Core File size limit exceeded (4.2BSD);
see setrlimit(2)
参考:
本文介绍如何在Linux环境下取消禁止生成core文件,设置core文件生成规则,并通过主动触发程序崩溃来创建core文件。此外,还详细解释了如何使用gdb进行core文件的调试过程,以及默认情况下可能触发dump的信号列表。
580

被折叠的 条评论
为什么被折叠?



