Thursday, October 13, 2011

What do I do with this core file?

Use this script to generate a useful backtrace from the core file.

#!/bin/bash

corefile=$1
outfile=$1.gdbtrace.log

function getprocess {

        commandstring=$(gdb -c $corefile \
                --eval-command='set pagination off' \
                --eval-command='bt' \
                --eval-command='quit' \
                |awk '/Core was generated by/ { split($0, a, "`"); split(a[2], b, "'\''"); split(b[1], c, " "); print c[1] }')

        echo $commandstring|awk '{print $1}'
}


if [ -a $corefile ] ; then
        process=$(getprocess)
else
        echo You must provide a core file as an argument
        exit
fi

if [ -a $process ] ; then

echo Core was generated by $process

gdb $process \
                -c $corefile \
                --eval-command='set pagination off' \
                --eval-command="set logging file $outfile" \
                --eval-command='set logging on' \
                --eval-command='bt' \
                --eval-command='bt full' \
                --eval-command='thread apply all bt' \
                --eval-command='thread apply all bt full' \
                --eval-command='quit'

echo "Trace written to $outfile"

else
        echo "Can not find $process. This script my be broken, or the file disappeared."
        exit
fi

1 comment:

Anonymous said...

If proceed to} prefer fiat strategies, you can use use|you need to use} Interac, Diners, MasterCard, Skrill, Neteller, ecoPayz, and different strategies with no deposit fees. Jackpot City journey starts with a hundred and fifty free spins + a C$1600 welcome bonus, but one 온라인 카지노 of many nifty options of this brand is the every day deal - a guaranteed match provide every single day. The website works completely on cell devices, but it isn't all - this on-line on line casino also options wonderful gambling purposes for both iOS and Android devices. Spin Casino Canada has been regulated by the Kahnawake Gaming Commission, a licensing authority for the gaming industry, since 1996.