make-core.sh: add FreeBSD support
Differential Revision: https://reviews.llvm.org/D26315 llvm-svn: 286035
This commit is contained in:
parent
1b4e1ac966
commit
b30841ae95
|
@ -1,4 +1,30 @@
|
|||
#! /bin/bash
|
||||
#! /bin/sh
|
||||
|
||||
linux_check_core_pattern()
|
||||
{
|
||||
if grep -q '^|' </proc/sys/kernel/core_pattern; then
|
||||
cat <<EOF
|
||||
Your system uses a crash report tool ($(cat /proc/sys/kernel/core_pattern)). Core files
|
||||
will not be generated. Please reset /proc/sys/kernel/core_pattern (requires root
|
||||
privileges) to enable core generation.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
OS=$(uname -s)
|
||||
case "$OS" in
|
||||
FreeBSD)
|
||||
core_pattern=$(sysctl -n kern.corefile)
|
||||
;;
|
||||
Linux)
|
||||
core_pattern=$(cat /proc/sys/kernel/core_pattern)
|
||||
;;
|
||||
*)
|
||||
echo "OS $OS not supported" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
set -e -x
|
||||
|
||||
|
@ -10,13 +36,8 @@ EOF
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if grep -q '^|' </proc/sys/kernel/core_pattern; then
|
||||
cat <<EOF
|
||||
Your system uses a crash report tool ($(cat /proc/sys/kernel/core_pattern)). Core files
|
||||
will not be generated. Please reset /proc/sys/kernel/core_pattern (requires root
|
||||
privileges) to enable core generation.
|
||||
EOF
|
||||
exit 1
|
||||
if [ "$OS" = Linux ]; then
|
||||
linux_check_core_pattern
|
||||
fi
|
||||
|
||||
ulimit -c 1000
|
||||
|
@ -33,7 +54,7 @@ ${CC:-cc} -nostdlib -static -g $CFLAGS "$file" -o a.out
|
|||
|
||||
cat <<EOF
|
||||
Executable file is in a.out.
|
||||
Core file will be saved according to pattern $(cat /proc/sys/kernel/core_pattern).
|
||||
Core file will be saved according to pattern $core_pattern.
|
||||
EOF
|
||||
|
||||
ulimit -s 8 # Decrease stack size to 8k => smaller core files.
|
||||
|
|
Loading…
Reference in New Issue