]>
git.ipfire.org Git - thirdparty/freeswitch.git/blob - scripts/backtrace-from-core
2 ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
3 ##### Author: Travis Cross <tc@traviscross.com>
5 log1
() { printf '%s' "$1">&2; }
6 log
() { printf '%s\n' "$1">&2; }
7 err
() { log
"$1"; exit 1; }
10 local opt
="$1" bs
="" be
=""
11 $opt && { bs
="[ "; be
=" ]"; }
12 log
"usage: $0 <corefile> ${bs}<path/to/freeswitch>${be}"
15 while getopts "h" o
; do
17 h
) usage true
; exit 0; ;;
27 if ! [ $# -lt 2 ]; then
29 [ -x "$fspath" ] || err
"Not executable: $fspath"
31 btpath
="/tmp/$(date -u +%Y%m%dT%H%M%SZ)-bt.txt"
32 if [ -z "$fspath" ]; then
33 for x
in "$(which freeswitch)" \
34 /usr
/bin
/freeswitch
/usr
/sbin
/freeswitch \
35 /usr
/local
/bin
/freeswitch
/usr
/local
/sbin
/freeswitch \
36 /opt
/freeswitch
/bin
/freeswitch
; do
37 ! [ -x "$x" ] ||
{ fspath
="$x"; break; }
40 if [ -z "$fspath" ]; then
41 log
"Couldn't find FS binary"
44 if test $
(id
-u) = 0 && test -f /etc
/debian_version
; then
46 ### You're running on Debian. Please make sure you have appropriate
47 ### freeswitch-*-dbg packages installed so we get as many symbols in
48 ### this backtrace as possible. I won't install these for you. If
49 ### you're running the freeswitch-all package, then you should install
50 ### freeswitch-all-dbg.
55 log1
'Generating backtrace...'
56 gdb
"$fspath" "$core" > $btpath <<'EOF'
60 printf "================================================================================\n"
61 printf "# GDB session generated by FS backtrace-from-core\n"
62 printf "# FreeSWITCH version: %s\n", switch_version_full_str
63 printf "# FreeSWITCH version (human): %s\n", switch_version_full_human_str
64 printf "================================================================================\n"
66 printf "================================================================================\n"
67 printf "# info threads\n"
68 printf "================================================================================\n"
70 printf "================================================================================\n"
72 printf "================================================================================\n"
74 printf "================================================================================\n"
76 printf "================================================================================\n"
78 printf "================================================================================\n"
79 printf "# thread apply all bt\n"
80 printf "================================================================================\n"
82 printf "================================================================================\n"
83 printf "# thread apply all bt full\n"
84 printf "================================================================================\n"
85 thread apply all bt full
90 log
"Please attach the backtrace here:"