Author: emaste Date: Sat Nov 5 09:45:13 2016 New Revision: 286035 URL: http://llvm.org/viewvc/llvm-project?rev=286035&view=rev Log: make-core.sh: add FreeBSD support
Differential Revision: https://reviews.llvm.org/D26315 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh?rev=286035&r1=286034&r2=286035&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh Sat Nov 5 09:45:13 2016 @@ -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 " 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. _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits