3 # Copyright (C) 2008-2013 Team XBMC
6 # This Program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This Program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with XBMC; see the file COPYING. If not, write to
18 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 # http://www.gnu.org/copyleft/gpl.html
23 exec_prefix="@exec_prefix@"
24 datarootdir="@datarootdir@"
26 CRASHLOG_DIR=${CRASHLOG_DIR:-$HOME}
28 # Check for some options used by this script
29 while [ "$#" -gt "0" ]
44 # core filename is either "core.$PID" or "core"
45 find "$1" -maxdepth $2 -name 'core*' | while read core; do
46 LC_ALL=C gdb --core="$core" --batch 2> /dev/null | grep -q "^Core was generated by \`$LIBDIR/xbmc/xbmc.bin" || continue
47 echo "=====> Core file: "$core" ($(stat -c%y "$core"))" >> $FILE
48 echo " =========================================" >> $FILE
49 gdb "$LIBDIR/xbmc/xbmc.bin" --core="$core" --batch -ex "thread apply all bt" 2> /dev/null >> $FILE
56 FILE="$CRASHLOG_DIR/xbmc_crashlog-`date +%Y%m%d_%H%M%S`.log"
57 echo "############## XBMC CRASH LOG ###############" >> $FILE
59 echo "################ SYSTEM INFO ################" >> $FILE
60 echo -n " Date: " >> $FILE
62 echo " XBMC Options: $*" >> $FILE
63 echo -n " Arch: " >> $FILE
65 echo -n " Kernel: " >> $FILE
67 echo -n " Release: " >> $FILE
68 if [ -f /etc/os-release ]; then
70 echo $NAME $VERSION >> $FILE
71 elif which lsb_release > /dev/null; then
73 lsb_release -a 2> /dev/null | sed -e 's/^/ /' >> $FILE
75 echo "lsb_release not available" >> $FILE
77 echo "############## END SYSTEM INFO ##############" >> $FILE
79 echo "############### STACK TRACE #################" >> $FILE
80 if which gdb >/dev/null 2>&1; then
81 if which systemd-coredumpctl &> /dev/null; then
82 systemd-coredumpctl dump -o core xbmc.bin &> /dev/null
84 single_stacktrace "$PWD" 1
85 # Find in plugins directories
86 if [ $XBMC_HOME ]; then
89 BASEDIR="$LIBDIR/xbmc/"
91 single_stacktrace "$BASEDIR" 5
92 # find in user xbmc dir
93 single_stacktrace $HOME/.xbmc/ 5
95 echo "gdb not installed, can't get stack trace." >> $FILE
97 echo "############# END STACK TRACE ###############" >> $FILE
99 echo "################# LOG FILE ##################" >> $FILE
101 if [ -f ~/.xbmc/temp/xbmc.log ]
103 cat ~/.xbmc/temp/xbmc.log >> $FILE
106 echo "Logfile not found in the usual place." >> $FILE
107 echo "Please attach it seperately." >> $FILE
108 echo "Use pastebin.com or similar for forums or IRC." >> $FILE
111 echo "############### END LOG FILE ################" >> $FILE
113 echo "############ END XBMC CRASH LOG #############" >> $FILE
114 echo "Crash report available at $FILE"
117 python @datadir@/xbmc/FEH.py $SAVED_ARGS
119 if [ $RET -ne 0 ]; then
123 if which gdb >/dev/null 2>&1; then
124 # Output warning in case ulimit is unsupported by shell
125 eval ulimit -c unlimited
126 if [ ! $? = "0" ]; then
127 echo "xbmc: ulimit is unsupported by this shell" 1>&2
132 while [ $(( $LOOP )) = "1" ]
135 "$LIBDIR/xbmc/xbmc.bin" $SAVED_ARGS
137 if [ $(( $RET == 65 )) = "1" ]
138 then # User requested to restart app
140 elif [ $(( ($RET >= 131 && $RET <= 136) || $RET == 139 )) = "1" ]
141 then # Crashed with core dump