forked from nuttx/nuttx-update
tools/btdecode.sh: add optional elf file parameter
Example: ./nuttx/tools/btdecode.sh aarch64-none-elf-addr2line crash.log build/nuttx Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
parent
3e6ba4c17c
commit
94a114b19a
1 changed files with 11 additions and 5 deletions
|
@ -36,7 +36,7 @@
|
||||||
# 0x400e1a2a: function_name at file.c:line
|
# 0x400e1a2a: function_name at file.c:line
|
||||||
# 0x40082912: function_name at file.c:line
|
# 0x40082912: function_name at file.c:line
|
||||||
|
|
||||||
USAGE="USAGE: ${0} chip|toolchain-addr2line backtrace_file
|
USAGE="USAGE: ${0} chip|toolchain-addr2line backtrace_file [elf_file]
|
||||||
If the first argument contains 'addr2line', it will be used as the toolchain's addr2line tool.
|
If the first argument contains 'addr2line', it will be used as the toolchain's addr2line tool.
|
||||||
Otherwise, the script will try to identify the toolchain based on the chip name."
|
Otherwise, the script will try to identify the toolchain based on the chip name."
|
||||||
|
|
||||||
|
@ -59,6 +59,12 @@ if [ -z "$2" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
elf_file="nuttx"
|
||||||
|
|
||||||
|
if [ -n "$3" ]; then
|
||||||
|
elf_file=$3
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if the first argument is an addr2line tool or a chip
|
# Check if the first argument is an addr2line tool or a chip
|
||||||
|
|
||||||
chip_or_tool=$1
|
chip_or_tool=$1
|
||||||
|
@ -95,9 +101,9 @@ else
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure the project was built
|
# Make sure the elf file is accessible
|
||||||
|
|
||||||
if [ ! -f nuttx ]; then
|
if [ ! -f ${elf_file} ]; then
|
||||||
echo "NuttX binaries not found!"
|
echo "NuttX binaries not found!"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
@ -142,7 +148,7 @@ done < "$2"
|
||||||
for task_id in "${!backtraces_before[@]}"; do
|
for task_id in "${!backtraces_before[@]}"; do
|
||||||
echo "Backtrace for task $task_id:"
|
echo "Backtrace for task $task_id:"
|
||||||
for bt in ${backtraces_before[$task_id]}; do
|
for bt in ${backtraces_before[$task_id]}; do
|
||||||
$ADDR2LINE_TOOL -pfiaCs -e nuttx $bt
|
$ADDR2LINE_TOOL -pfiaCs -e ${elf_file} $bt
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
@ -153,7 +159,7 @@ if $in_dump_tasks_section; then
|
||||||
for task_id in "${!backtraces_after[@]}"; do
|
for task_id in "${!backtraces_after[@]}"; do
|
||||||
echo "Backtrace for task $task_id:"
|
echo "Backtrace for task $task_id:"
|
||||||
for bt in ${backtraces_after[$task_id]}; do
|
for bt in ${backtraces_after[$task_id]}; do
|
||||||
$ADDR2LINE_TOOL -pfiaCs -e nuttx $bt
|
$ADDR2LINE_TOOL -pfiaCs -e ${elf_file} $bt
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue