mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-30 22:26:42 +00:00
kodi: run via wrapper. dump a crashlog on SEGV whenever possible
This commit is contained in:
parent
0e5c443160
commit
be8d1c810c
@ -422,6 +422,7 @@ post_makeinstall_target() {
|
||||
|
||||
mkdir -p $INSTALL/usr/lib/kodi
|
||||
cp $PKG_DIR/scripts/kodi-config $INSTALL/usr/lib/kodi
|
||||
cp $PKG_DIR/scripts/kodi.sh $INSTALL/usr/lib/kodi
|
||||
cp $PKG_DIR/scripts/kodi-hacks $INSTALL/usr/lib/kodi
|
||||
cp $PKG_DIR/scripts/kodi-sources $INSTALL/usr/lib/kodi
|
||||
# TODO: remove this later:
|
||||
|
100
packages/mediacenter/kodi/scripts/kodi.sh
Executable file
100
packages/mediacenter/kodi/scripts/kodi.sh
Executable file
@ -0,0 +1,100 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2008-2013 Team XBMC
|
||||
# http://xbmc.org
|
||||
#
|
||||
# This Program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This Program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
. /etc/profile
|
||||
|
||||
trap cleanup TERM
|
||||
|
||||
SAVED_ARGS="$@"
|
||||
CRASHLOG_DIR=/storage/.kodi/temp
|
||||
|
||||
cleanup() {
|
||||
# make systemd happy by not exiting immediately but
|
||||
# wait for kodi to exit
|
||||
while killall -0 kodi.bin &>/dev/null; do
|
||||
sleep 0.5
|
||||
done
|
||||
}
|
||||
|
||||
command_exists()
|
||||
{
|
||||
command -v $1 &>/dev/null
|
||||
}
|
||||
|
||||
single_stacktrace()
|
||||
{
|
||||
# core filename is "core.*kodi.bin.*"
|
||||
find "$1" -name 'core.*kodi.bin.*' | while read core; do
|
||||
echo "=====> Core file: "$core"" >> $FILE
|
||||
echo " =========================================" >> $FILE
|
||||
gdb /usr/lib/kodi/kodi.bin --core="$core" --batch -ex "thread apply all bt" 2>/dev/null >> $FILE
|
||||
rm -f "$core"
|
||||
done
|
||||
}
|
||||
|
||||
print_crash_report()
|
||||
{
|
||||
if [ ! -d $CRASHLOG_DIR ] ; then
|
||||
mkdir -p $CRASHLOG_DIR
|
||||
fi
|
||||
FILE="$CRASHLOG_DIR/kodi_crashlog.log"
|
||||
echo "############## kodi CRASH LOG ###############" > $FILE
|
||||
echo >> $FILE
|
||||
echo "################ SYSTEM INFO ################" >> $FILE
|
||||
echo -n " Date: " >> $FILE
|
||||
date >> $FILE
|
||||
echo " kodi Options: $SAVED_ARGS" >> $FILE
|
||||
echo -n " Arch: " >> $FILE
|
||||
uname -m >> $FILE
|
||||
echo -n " Kernel: " >> $FILE
|
||||
uname -rvs >> $FILE
|
||||
echo -n " Release: " >> $FILE
|
||||
. /etc/os-release
|
||||
echo $NAME $VERSION >> $FILE
|
||||
echo "############## END SYSTEM INFO ##############" >> $FILE
|
||||
echo >> $FILE
|
||||
echo "############### STACK TRACE #################" >> $FILE
|
||||
if command_exists gdb; then
|
||||
single_stacktrace /storage/.cache/cores
|
||||
else
|
||||
echo "gdb not installed, can't get stack trace." >> $FILE
|
||||
fi
|
||||
echo "############# END STACK TRACE ###############" >> $FILE
|
||||
echo >> $FILE
|
||||
echo "################# LOG FILE ##################" >> $FILE
|
||||
echo >> $FILE
|
||||
cat /storage/.kodi/temp/kodi.log >> $FILE
|
||||
echo >> $FILE
|
||||
echo "############### END LOG FILE ################" >> $FILE
|
||||
echo >> $FILE
|
||||
echo "############ END kodi CRASH LOG #############" >> $FILE
|
||||
echo "Crash report available at $FILE"
|
||||
}
|
||||
|
||||
if command_exists gdb; then
|
||||
ulimit -c unlimited
|
||||
fi
|
||||
|
||||
# clean up any stale cores. just in case
|
||||
rm -f /storage/.cache/cores/*
|
||||
|
||||
/usr/lib/kodi/kodi.bin $SAVED_ARGS
|
||||
RET=$?
|
||||
|
||||
if [ $(( ($RET >= 131 && $RET <= 136) || $RET == 139 )) = "1" ] ; then
|
||||
# Crashed with core dump
|
||||
print_crash_report
|
||||
fi
|
||||
|
||||
exit $RET
|
@ -10,9 +10,8 @@ Environment=HOME=/storage
|
||||
EnvironmentFile=-/run/openelec/kodi.conf
|
||||
EnvironmentFile=-/run/openelec/debug/kodi.conf
|
||||
ExecStartPre=-/usr/lib/kodi/kodi-config
|
||||
ExecStart=/bin/sh -c ". /etc/profile; exec /usr/lib/kodi/kodi.bin --standalone -fs $KODI_ARGS $KODI_DEBUG"
|
||||
# keep KillMode=process unless there is no good reason to switch to cgroup
|
||||
KillMode=process
|
||||
ExecStart=/usr/lib/kodi/kodi.sh --standalone -fs $KODI_ARGS $KODI_DEBUG
|
||||
ExecStop=/bin/kill -TERM $MAINPID
|
||||
TimeoutStopSec=5
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
Loading…
x
Reference in New Issue
Block a user