diff options
author | anssih <anssih@svn> | 2010-10-22 22:44:54 +0000 |
---|---|---|
committer | anssih <anssih@svn> | 2010-10-22 22:44:54 +0000 |
commit | 4e12de52807a2b4f09dbc0ca8c25428a65db73e0 (patch) | |
tree | 645c22d2fbf7402995d167b3ca81892de27dbf05 /tools/Linux | |
parent | 3d5353334bf4369ce8e36485fbef0be048000098 (diff) |
fixed: various issues with backtrace generation on linux
There were several issues with the single_stacktrace() shell function in
xbmc.sh that is used to generate backtraces when XBMC crashes:
- it removed all core* files from current directory, even those that
were unrelated to XBMC or were not actually core files at all
- it did not work when current path contained whitespace characters
(which could also lead to unrelated files being removed)
Fix those by rewriting the function.
Additionally, output the timestamp of the core file to the crash log
(useful for determining the correct backtrace in case there were several
core files for some reason).
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@34954 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'tools/Linux')
-rw-r--r-- | tools/Linux/xbmc.sh.in | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/Linux/xbmc.sh.in b/tools/Linux/xbmc.sh.in index 692398f3f9..28d98a10cd 100644 --- a/tools/Linux/xbmc.sh.in +++ b/tools/Linux/xbmc.sh.in @@ -40,11 +40,13 @@ done single_stacktrace() { - find $1 -maxdepth $2 -name 'core*' \( -exec \ - echo "=====> Core file: {}" 2> /dev/null >> $FILE \; , -exec \ - echo " ========================================= " 2> /dev/null >> $FILE \; , -exec \ - gdb "$LIBDIR/xbmc/xbmc.bin" --core={} --batch -ex "thread apply all bt" 2> /dev/null >> $FILE \; , -exec \ - rm -f {} \; \) + find "$1" -maxdepth $2 -name 'core.*' | while read core; do + LC_ALL=C gdb --core="$core" --batch 2> /dev/null | grep -q "^Core was generated by \`$LIBDIR/xbmc/xbmc.bin" || continue + echo "=====> Core file: "$core" ($(stat -c%y "$core"))" >> $FILE + echo " =========================================" >> $FILE + gdb "$LIBDIR/xbmc/xbmc.bin" --core="$core" --batch -ex "thread apply all bt" 2> /dev/null >> $FILE + rm -f "$core" + done } print_crash_report() @@ -70,14 +72,14 @@ print_crash_report() echo "############## END SYSTEM INFO ##############" >> $FILE echo >> $FILE echo "############### STACK TRACE #################" >> $FILE - single_stacktrace $PWD 1 + single_stacktrace "$PWD" 1 # Find in plugins directories if [ $XBMC_HOME ]; then BASEDIR=$XBMC_HOME else BASEDIR="$LIBDIR/xbmc/" fi - single_stacktrace $BASEDIR 5 + single_stacktrace "$BASEDIR" 5 # find in user xbmc dir single_stacktrace $HOME/.xbmc/ 5 echo "############# END STACK TRACE ###############" >> $FILE |