printcore

来自「一个C语言写的快速贝叶斯垃圾邮件过滤工具」· 代码 · 共 67 行

TXT
67
字号
#! /bin/shorc=$?set +e# This script tries to grab a core file and analyze it, obtaining a# backtrace.# (C) 2003 Matthias Andree## Redistributable in accordance with the terms and conditions of the# GNU General Public License v2.## THIS COMES WITHOUT ANY WARRANTIES!: ${GDB=gdb}# stage 1: find core file - we'll guess, not knowing all possible#          core file name generators. Most tend to contain pid + "core"#          or program name + "core".corefile="`find . ${TMPDIR} -name '*core*' -print | grep -w core | head -n1`"if [ -z "$corefile" ] ; then    if [ $orc -gt 0 ] ; then echo >&2 "No core file found" ; fi    exit 0fiecho >&2 ">>> Using core file \"$corefile\"."trap "rm -f \"$corefile\"" 0# stage 2: pull name of executable file out of corebacktick='`'LANG=CLC_MESSAGES=Cexport LANG LC_MESSAGESrm -f exit.$$execfile="`( $GDB -nw -batch -nx -silent -c "$corefile" </dev/null)`"if [ $? -gt 0 ]then    echo >&2 "Problem with GDB program \"$GDB\""    exit 0fiexecfile=`echo "$execfile" | grep -i 'ore was generated by' | cut -f2- -d$backtick | cut -f1 -d"'" | cut -f1 -d" "`if [ -z "$execfile" ]then    echo >&2 "Cannot figure executable."    exit 0fiecho >&2 ">>> Using exec file \"$execfile\"."# stage 3: obtain backtracegdbfile="script.gdb.$$"rm -f "$gdbfile"cat <<_EOF >"$gdbfile"set height 0set width 0echo <<< SIMPLE BACKTRACE <<<\nbacktraceecho <<< FULL BACKTRACE <<<\nbacktrace fullquit_EOFcmd="gdb -nw -r -batch -nx -x "$gdbfile" -silent "$execfile" "$corefile" </dev/null"echo >&2 ">>> Running command: $cmd"eval "$cmd"rm -f "$gdbfile"echo >&2 ">>> Done."exit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?