scripts: stacktrace: support parse spl/tpl stacktrace info
Usage: ./scripts/stacktrace.sh ./dump.txt ./scripts/stacktrace.sh ./dump.txt tpl ./scripts/stacktrace.sh ./dump.txt spl Change-Id: I6a496109206d26917d5677c076aa770388c36ae6 Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
parent
1b4592b538
commit
73251fc230
|
|
@ -8,21 +8,42 @@
|
|||
set -e
|
||||
ARGS_N=$#
|
||||
INPUT_FILE=$1
|
||||
SYMBOL_FILE=`find -name u-boot.sym`
|
||||
TPL_SPL=$2
|
||||
|
||||
|
||||
if [ "$TPL_SPL" = "tpl" ]; then
|
||||
SYMBOL_FILE=`find -name u-boot-tpl.sym`
|
||||
elif [ "$TPL_SPL" = "spl" ]; then
|
||||
SYMBOL_FILE=`find -name u-boot-spl.sym`
|
||||
else
|
||||
SYMBOL_FILE=`find -name u-boot.sym`
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ $ARGS_N -eq 0 ]; then
|
||||
echo "Usage: "
|
||||
echo " ./scripts/stacktrace.sh <file> // u-boot stacktrace info file"
|
||||
echo " ./scripts/stacktrace.sh <file> <type>"
|
||||
echo
|
||||
echo "Param:"
|
||||
echo " <file>: stacktrace info file"
|
||||
echo " <type>: none, spl, tpl"
|
||||
echo
|
||||
echo "Example:"
|
||||
echo " ./scripts/stacktrace.sh ./dump.txt"
|
||||
echo " ./scripts/stacktrace.sh ./dump.txt tpl"
|
||||
echo " ./scripts/stacktrace.sh ./dump.txt spl"
|
||||
echo
|
||||
exit 1
|
||||
elif [ ! -f $INPUT_FILE ]; then
|
||||
echo "Can't find input file: $INPUT_FILE"
|
||||
exit 1
|
||||
elif [ "$SYMBOL_FILE" = '' ] || [ ! -f $SYMBOL_FILE ]; then
|
||||
echo "Can't find symbol file: u-boot.sym"
|
||||
echo "Can't find symbol file: ${SYMBOL_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "SYMBOL File: ${SYMBOL_FILE}"
|
||||
echo
|
||||
# Parse PC and LR
|
||||
echo "Call trace:"
|
||||
sed -n "/: \[</p" $INPUT_FILE | while read line
|
||||
|
|
@ -33,12 +54,12 @@ do
|
|||
frame_pc_dec=`echo $line | awk '{ print strtonum("0x"$3); }'`
|
||||
frame_pc_hex=`echo "obase=16;${frame_pc_dec}"|bc |tr '[A-Z]' '[a-z]'`
|
||||
|
||||
f_pc_dec=`cat u-boot.sym | sort | awk '/\.text/ { if (strtonum("0x"$1) > '$frame_pc_str') { print fpc; exit; } fpc=strtonum("0x"$1); }'`
|
||||
f_pc_dec=`cat ${SYMBOL_FILE} | sort | awk '/\.text/ { if (strtonum("0x"$1) > '$frame_pc_str') { print fpc; exit; } fpc=strtonum("0x"$1); }'`
|
||||
f_pc_hex=`echo "obase=16;${f_pc_dec}"|bc |tr '[A-Z]' '[a-z]'`
|
||||
f_offset_dec=$((frame_pc_dec-f_pc_dec))
|
||||
f_offset_hex=`echo "obase=16;${f_offset_dec}"|bc |tr '[A-Z]' '[a-z]'`
|
||||
|
||||
cat u-boot.sym | sort |
|
||||
cat ${SYMBOL_FILE} | sort |
|
||||
awk -v foffset=$f_offset_hex '/\.text/ {
|
||||
if (strtonum("0x"$1) > '$frame_pc_str') {
|
||||
printf("%s+0x%s/0x%x ", fname, foffset, fsize);
|
||||
|
|
@ -65,12 +86,12 @@ do
|
|||
frame_pc_dec=`echo $line | awk '{ print strtonum("0x"$2); }'`
|
||||
frame_pc_hex=`echo "obase=16;${frame_pc_dec}"|bc |tr '[A-Z]' '[a-z]'`
|
||||
|
||||
f_pc_dec=`cat u-boot.sym | sort | awk '/\.text/ { if (strtonum("0x"$1) > '$frame_pc_str') { print fpc; exit; } fpc=strtonum("0x"$1); }'`
|
||||
f_pc_dec=`cat ${SYMBOL_FILE} | sort | awk '/\.text/ { if (strtonum("0x"$1) > '$frame_pc_str') { print fpc; exit; } fpc=strtonum("0x"$1); }'`
|
||||
f_pc_hex=`echo "obase=16;${f_pc_dec}"|bc |tr '[A-Z]' '[a-z]'`
|
||||
f_offset_dec=$((frame_pc_dec-f_pc_dec))
|
||||
f_offset_hex=`echo "obase=16;${f_offset_dec}"|bc |tr '[A-Z]' '[a-z]'`
|
||||
|
||||
cat u-boot.sym | sort |
|
||||
cat ${SYMBOL_FILE} | sort |
|
||||
awk -v foffset=$f_offset_hex '/\.text/ {
|
||||
if (strtonum("0x"$1) > '$frame_pc_str') {
|
||||
printf("%s+0x%s/0x%x\n", fname, foffset, fsize);
|
||||
|
|
|
|||
Loading…
Reference in New Issue