HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //proc/self/root/usr/sbin/btraceback
#!/bin/sh
#
# Script to do a stack trace of a Bareos daemon/program
# and create a core-file for postmortem debugging.
#
# We attempt to attach to running program
#
# Arguments to this script are
#  $1 = path to executable
#  $2 = main pid of running program to be traced back.
#  $3 = working directory
#
PNAME="`basename $1`"
WD="$3"

GCORE="GCORE-NOTFOUND"
GDB="GDB-NOTFOUND"
DBX="DBX-NOTFOUND"
MDB="MDB-NOTFOUND"

#
# Try to generate a core dump for postmortem analyzing.
#
POSTMORTEM="NONE"
if [ ! -z "${GCORE}" -a -x "${GCORE}" ]; then
   POSTMORTEM="${WD}/${PNAME}.core"
   ${GCORE} -o ${POSTMORTEM} $2 > /dev/null 2>&1
   POSTMORTEM="${POSTMORTEM}.$2"
   echo "Created ${POSTMORTEM} for doing postmortem debugging" > ${WD}/bareos.$2.traceback
else
   which gcore > /dev/null 2>&1 && GCORE="`which gcore`" || GCORE=''
   if [ ! -z "${GCORE}" -a -x "${GCORE}" ]; then
      POSTMORTEM="${WD}/${PNAME}.core"
      ${GCORE} -o ${POSTMORTEM} $2 > /dev/null 2>&1
      POSTMORTEM="${POSTMORTEM}.$2"
      echo "Created ${POSTMORTEM} for doing postmortem debugging" > ${WD}/bareos.$2.traceback
   fi
fi

#
# Try to find out what debugger is available on this platform.
#
if [ ! -z "${DBX}" -a -x "${DBX}" ]; then
   DEBUGGER="DBX"
elif [ ! -z "${GDB}" -a -x "${GDB}"  ]; then
   DEBUGGER="GDB"
elif [ ! -z "${MDB}" -a -x "${MDB}"  ]; then
   DEBUGGER="MDB"
else
   #
   # If we fail to find the configured debugger do a last try to find it on the PATH.
   #
   which gdb > /dev/null 2>&1 && GDB="`which gdb`" || GDB=''
   which dbx > /dev/null 2>&1 && DBX="`which dbx`" || DBX=''
   which mdb > /dev/null 2>&1 && MDB="`which mdb`" || MDB=''

   if [ ! -z "${DBX}" -a -x "${DBX}" ]; then
      DEBUGGER="DBX"
   elif [ ! -z "${GDB}" -a -x "${GDB}"  ]; then
      DEBUGGER="GDB"
   elif [ ! -z "${MDB}" -a -x "${MDB}"  ]; then
      DEBUGGER="MDB"
   else
      DEBUGGER="NONE"
   fi
fi

#
# Try to run a debugger on the crashing program or the generated postmortem dump for getting a strack trace.
#
case ${DEBUGGER} in
   DBX)
      if [ ${POSTMORTEM} != NONE -a -s ${POSTMORTEM} ]; then
         ${DBX} $1 ${POSTMORTEM} < /usr/lib/bareos/scripts/btraceback.dbx >> ${WD}/bareos.$2.traceback 2>&1
      else
         ${DBX} $1 $2 < /usr/lib/bareos/scripts/btraceback.dbx >> ${WD}/bareos.$2.traceback 2>&1
      fi
      ;;
   GDB)
      if [ ${POSTMORTEM} != NONE -a -s ${POSTMORTEM} ]; then
         ${GDB} -quiet -batch -x /usr/lib/bareos/scripts/btraceback.gdb $1 ${POSTMORTEM} >> ${WD}/bareos.$2.traceback 2>&1
      else
         ${GDB} -quiet -batch -x /usr/lib/bareos/scripts/btraceback.gdb $1 $2 >> ${WD}/bareos.$2.traceback 2>&1
      fi
      ;;
   MDB)
      if [ ${POSTMORTEM} != NONE -a -s ${POSTMORTEM} ]; then
         ${MDB} -u $1 ${POSTMORTEM} < /usr/lib/bareos/scripts/btraceback.mdb >> ${WD}/bareos.$2.traceback 2>&1
      else
         ${MDB} -u -p $2 < /usr/lib/bareos/scripts/btraceback.mdb >> ${WD}/bareos.$2.traceback 2>&1
      fi
      ;;
   NONE)
      echo "No debugger available on this platform," \
           " please install one to get proper stack traces" >> ${WD}/bareos.$2.traceback
      ;;
esac

#
# Send the stack trace info to someone for analyzing or at least letting someone know we crashed.
#
PNAME="${PNAME} on `hostname`"
cat ${WD}/bareos.$2.traceback | \
/usr/sbin/bsmtp -h root@localhost -f root@localhost -s "Bareos ${DEBUGGER} traceback of ${PNAME}" root@localhost