3 linux_check_ptrace_scope()
5 if grep -q '1' </proc/sys/kernel/yama/ptrace_scope; then
7 Your system prevents the use of PTRACE to attach to non-child processes. The core file
8 cannot be generated. Please reset /proc/sys/kernel/yama/ptrace_scope to 0 (requires root
9 privileges) to enable core generation via gcore.
18 if [ "$OS" = Linux ]; then
19 linux_check_ptrace_scope
26 Executable file is in a.out.
27 Core file will be saved as core.<pid>.
30 stack_size=`ulimit -s`
32 # Decrease stack size to 16k => smaller core files.
33 # gcore won't run with the smaller stack
36 core_dump_filter=`cat /proc/self/coredump_filter`
37 echo 0 > /proc/self/coredump_filter
43 echo $core_dump_filter > /proc/self/coredump_filter
45 # Reset stack size as so there's enough space to run gcore.
48 echo "Sleeping for 5 seconds to wait for $pid"
51 echo "Taking core from process $pid"
55 echo "Killing process $pid"