ulimit & core dump

来源:互联网 发布:如何调教一个抖m知乎 编辑:程序博客网 时间:2024/04/28 06:24

1. ulimit -c [num]    get or set core-dump file size

         ulimit -c 1024

         ulimit -c unlimited

2.// Append pid for core file name

echo "1" > /proc/sys/kernel/core_uses_pid

3.// Append timestamp for core file name

corename format specifiers:

  • %p - pid
  • %u - uid
  • %g - gid
  • %s - signal number
  • %t - UNIX time of dump
  • %h - hostname
  • %e - executable filename
  • %% - output one "%"
  • %<NUL> - "%" is dropped
  • %<OTHER> - both are dropped

echo "core.%e.%t" > /proc/sys/kernel/core_pattern

 

4.SIGQUIT    "ctrl + /"

 

5.gdb core dump file

$gcc -g test.c -o test

$./test

(coredump)

$gdb test

1. ulimit -c [num]    get or set core-dump file size

         ulimit -c 1024

         ulimit -c unlimited


2.// Append pid for core file name

echo "1" > /proc/sys/kernel/core_uses_pid

3.// Append timestamp for core file name

echo "core%t" > /proc/sys/kernel/core_pattern

 

4.SIGQUIT    "ctrl + /"

 

 

5.gdb core dump file

$gcc -g test.c -o test

$./test

(coredump)

$gdb test core1301297882.5387

原创粉丝点击