[Lldb-commits] [PATCH] D26315: make-core.sh: add FreeBSD support

Ed Maste via lldb-commits lldb-commits at lists.llvm.org
Sat Nov 5 07:54:47 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL286035: make-core.sh: add FreeBSD support (authored by emaste).

Changed prior to commit:
  https://reviews.llvm.org/D26315?vs=76951&id=76968#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26315

Files:
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
+++ lldb/trunk/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.76968.patch
Type: text/x-patch
Size: 1700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161105/10fda111/attachment.bin>


More information about the lldb-commits mailing list