2018-11-19 23:17:57 +08:00
|
|
|
#!/bin/bash
|
2019-06-02 04:58:16 +08:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright(c) 2018 Intel Corporation. All rights reserved.
|
|
|
|
|
2018-11-19 23:17:57 +08:00
|
|
|
# Exemplatory usage of sof-coredump-reader.py ($reader_name)
|
|
|
|
# We read from dump file into sof-coredump-reader.py, then we pipe its output
|
|
|
|
# to xt-gdb, which operates on given elf-file.
|
|
|
|
|
|
|
|
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|
|
|
elf="${1}"
|
|
|
|
dump="${2}"
|
|
|
|
|
|
|
|
reader_name="sof-coredump-reader.py" # in case it is changed
|
2019-04-04 20:49:05 +08:00
|
|
|
reader_output="$(${THIS_SCRIPT_DIR}/${reader_name} -vc -i ${dump} -l 4 \
|
2019-04-12 22:07:26 +08:00
|
|
|
-o reader-output.txt)"
|
2018-11-19 23:17:57 +08:00
|
|
|
reader_result="$?" # if $reader_name script fails, running xt-gdb is pointless
|
|
|
|
if [[ ${reader_result} -ne 0 ]] ; then
|
|
|
|
echo "${reader_name} failed!"
|
|
|
|
exit ${reader_result}
|
|
|
|
else
|
2019-04-04 20:49:05 +08:00
|
|
|
(echo "${reader_output}")
|
2019-04-12 22:07:26 +08:00
|
|
|
echo "quit" >> reader-output.txt
|
|
|
|
xt-gdb -q "${elf}" --command=reader-output.txt |& tee gdb_log.txt \
|
|
|
|
| grep -E '^[0-9]|#|\$'
|
|
|
|
rm -rf reader-output.txt
|
2018-11-19 23:17:57 +08:00
|
|
|
fi
|