- add sources.
[platform/framework/web/crosswalk.git] / src / remoting / scripts / mac / dump_product_syms
1 #!/bin/bash
2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 set -eu
8
9 if [[ "$#" -ne 1 ]]; then
10   echo "usage: $0 <version>" >&2
11   echo "(BUILT_PRODUCTS_DIR and FULL_PRODUCT_NAME must be set)" >& 2
12   exit 1
13 fi
14
15 VERSION="$1"
16 DUMP_SYMS_TOOL="${BUILT_PRODUCTS_DIR}/dump_syms"
17 SOURCE_BUNDLE="${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}"
18
19 # Filename of bundle, minus the file extension.
20 STEM="$(basename "${SOURCE_BUNDLE%.*}")"
21 DWARF_PATH="${SOURCE_BUNDLE}.dSYM/Contents/Resources/DWARF/${STEM}"
22
23 ARCHS=$(file "${DWARF_PATH}" | sed -Ene 's/^.*(i386|x86_64)$/\1/p')
24 if [[ -z "${ARCHS}" ]]; then
25   echo "$0: expected something dumpable in ${DWARF_PATH}" >& 2
26   exit 1
27 fi
28
29 for ARCH in ${ARCHS}; do
30   # Use -c to avoid dumping CFI, because the Breakpad stackwalk is incompatible
31   # with CFI produced by clang.
32   # http://code.google.com/p/google-breakpad/issues/detail?id=443
33   "${DUMP_SYMS_TOOL}" -a "${ARCH}" -c "${DWARF_PATH}" > \
34       "${SOURCE_BUNDLE}-${VERSION}-${ARCH}.breakpad"
35 done