[Lldb-commits] [PATCH] D26315: make-core.sh: add FreeBSD support
Ed Maste via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 4 16:19:12 PDT 2016
emaste created this revision.
emaste added a reviewer: labath.
emaste added a subscriber: lldb-commits.
https://reviews.llvm.org/D26315
Files:
packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
Index: packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
===================================================================
--- packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
+++ packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
@@ -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 @@
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 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26315.76951.patch
Type: text/x-patch
Size: 1667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161104/b83571dc/attachment.bin>
More information about the lldb-commits
mailing list