Blame view

buildroot/buildroot-2016.08.1/package/google-breakpad/gen-syms.sh 882 Bytes
6b13f685e   김민수   BSP 최초 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  #!/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
  " "${FILE}"
      fi
  	if [ -d "${f}" ]; then
  		error "%s: Is a directory
  " "${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'
  " "${FILE}"
  	fi
  done
  rm -rf "${SYMBOLS_DIR}/tmp"