buildroot/package/google-breakpad/gen-syms.sh
Pascal Huerst 09a1a10f48 google-breakpad: integration into Makefile and Config.in
Add a new config option that allows to specify a list of files
to dump symbols from, and generate a database of symbols, in
stagins/usr/share/google-breakpad/.

Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
[yann.morin.1998@free.fr: add dependency on the host variant; fix
 script; add commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[Thomas: remove leftover debugging, rewrap Config.in help text,
propagate dependencies correctly.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-07-31 23:10:19 +02:00

35 lines
882 B
Bash
Executable File

#!/bin/sh
NAME="${0##*/}"
STAGING_DIR="${1}"
TARGET_DIR="${2}"
shift 2
SYMBOLS_DIR="${STAGING_DIR}/usr/share/google-breakpad-symbols"
rm -rf "${SYMBOLS_DIR}"
mkdir -p "${SYMBOLS_DIR}"
error() {
fmt="${1}"; shift
printf "%s: ${fmt}" "${NAME}" "${@}" >&2
exit 1
}
for FILE in ${@}; do
f="${TARGET_DIR}${FILE}"
if [ ! -e "${f}" ]; then
error "%s: No such file or directory\n" "${FILE}"
fi
if [ -d "${f}" ]; then
error "%s: Is a directory\n" "${FILE}"
fi
if dump_syms "${f}" > "${SYMBOLS_DIR}/tmp.sym" 2>/dev/null; then
hash=$(head -n1 "${SYMBOLS_DIR}/tmp.sym" | cut -d ' ' -f 4);
filename=$(basename "${FILE}");
mkdir -p "${SYMBOLS_DIR}/${filename}/${hash}"
mv "${SYMBOLS_DIR}/tmp.sym" "${SYMBOLS_DIR}/${filename}/${hash}/${filename}.sym";
else
error "Error dumping symbols for: '%s'\n" "${FILE}"
fi
done
rm -rf "${SYMBOLS_DIR}/tmp"