OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script expects the following environment variables to be set. Xcode | 7 # This script expects the following environment variables to be set. Xcode |
8 # normally sets them: | 8 # normally sets them: |
9 # | 9 # |
10 # CONFIGURATION - Release or Debug; this script only operates when Release. | 10 # CONFIGURATION - Release or Debug; this script only operates when Release. |
(...skipping 29 matching lines...) Expand all Loading... |
40 BRAND_SCRIPT="${TOP}/build/branding_value.sh" | 40 BRAND_SCRIPT="${TOP}/build/branding_value.sh" |
41 SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME) | 41 SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME) |
42 . "${TOP}/chrome/VERSION" | 42 . "${TOP}/chrome/VERSION" |
43 | 43 |
44 BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms" | 44 BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms" |
45 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" | 45 FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" |
46 ARCH="i386" | 46 ARCH="i386" |
47 | 47 |
48 DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.dSYM.tar.bz2" | 48 DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.dSYM.tar.bz2" |
49 | 49 |
| 50 # Starting with an already-dumped symbol file at ${original_sym_path}, |
| 51 # transforms the MODULE line (which must be the first line) from referring to |
| 52 # ${original_stem} to refer to ${variant_stem}. The transformed symbol file |
| 53 # is written to a symbol file at the same location that a symbol file would |
| 54 # be written to if ${variant_name} were in the SRC_NAMES array below. |
| 55 # |
| 56 # If the transformed symbol file already appears more recent than |
| 57 # ${original_sym_path}, it is left alone. |
| 58 redump_syms_variant() { |
| 59 local original_sym_path="${1}" |
| 60 local original_stem="${2}" |
| 61 local variant_stem="${3}" |
| 62 local variant_name="${4}" |
| 63 |
| 64 local variant_sym_name="${variant_name}-${FULL_VERSION}-${ARCH}.breakpad" |
| 65 local variant_sym_path="${BUILT_PRODUCTS_DIR}/${variant_sym_name}" |
| 66 |
| 67 if [[ "${original_sym_path}" -nt "${variant_sym_path}" ]]; then |
| 68 local pattern="\ |
| 69 1s/^(MODULE [^ ]+ [^ ]+ [0-9a-fA-F]{33}) ${original_stem}\$/\1 ${variant_stem}/" |
| 70 sed -E -e "${pattern}" < "${original_sym_path}" > "${variant_sym_path}" |
| 71 fi |
| 72 } |
| 73 |
50 declare -a DSYMS | 74 declare -a DSYMS |
51 | 75 |
52 # Everything in SRC_NAMES is required. It's an error for any of these files | 76 # Everything in SRC_NAMES is required. It's an error for any of these files |
53 # to be missing. | 77 # to be missing. |
54 SRC_NAMES=( | 78 SRC_NAMES=( |
55 "${SRC_APP_NAME}.app" | 79 "${SRC_APP_NAME}.app" |
56 "${SRC_APP_NAME} Framework.framework" | 80 "${SRC_APP_NAME} Framework.framework" |
57 "${SRC_APP_NAME} Helper.app" | 81 "${SRC_APP_NAME} Helper.app" |
58 "crash_inspector" | 82 "crash_inspector" |
59 "crash_report_sender.app" | 83 "crash_report_sender.app" |
(...skipping 19 matching lines...) Expand all Loading... |
79 DSYM_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}" | 103 DSYM_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}" |
80 DWARF_PATH="${DSYM_PATH}/Contents/Resources/DWARF/${SRC_STEM}" | 104 DWARF_PATH="${DSYM_PATH}/Contents/Resources/DWARF/${SRC_STEM}" |
81 BPAD_SYM_NAME="${SRC_NAME}-${FULL_VERSION}-${ARCH}.breakpad" | 105 BPAD_SYM_NAME="${SRC_NAME}-${FULL_VERSION}-${ARCH}.breakpad" |
82 BPAD_SYM_PATH="${BUILT_PRODUCTS_DIR}/${BPAD_SYM_NAME}" | 106 BPAD_SYM_PATH="${BUILT_PRODUCTS_DIR}/${BPAD_SYM_NAME}" |
83 | 107 |
84 # Only run dump_syms if the file has changed since the last dump. | 108 # Only run dump_syms if the file has changed since the last dump. |
85 if [ "${DWARF_PATH}" -nt "${BPAD_SYM_PATH}" ] ; then | 109 if [ "${DWARF_PATH}" -nt "${BPAD_SYM_PATH}" ] ; then |
86 "${BREAKPAD_DUMP_SYMS}" -a "${ARCH}" "${DWARF_PATH}" > "${BPAD_SYM_PATH}" | 110 "${BREAKPAD_DUMP_SYMS}" -a "${ARCH}" "${DWARF_PATH}" > "${BPAD_SYM_PATH}" |
87 fi | 111 fi |
88 | 112 |
| 113 # Some executables will show up with variant names. The Breakpad symbol |
| 114 # server looks up modules based on a combination of the module name and |
| 115 # identifier (UUID). Produce symbol files for these variant names so that |
| 116 # the Breakpad symbol server will have something to return for stacks that |
| 117 # travel through these modules. |
| 118 case "${SRC_NAME}" in |
| 119 "${SRC_APP_NAME}.app") |
| 120 # Google Chrome Canary is produced during packaging. |
| 121 redump_syms_variant "${BPAD_SYM_PATH}" "${SRC_STEM}" \ |
| 122 "${SRC_STEM} Canary" "${SRC_STEM} Canary.app" |
| 123 ;; |
| 124 |
| 125 "${SRC_APP_NAME} Helper.app") |
| 126 # Google Chrome Helper EH and Google Chrome Helper NP are produced by |
| 127 # chrome/tools/build/mac/make_more_helpers.sh. |
| 128 redump_syms_variant "${BPAD_SYM_PATH}" "${SRC_STEM}" \ |
| 129 "${SRC_STEM} EH" "${SRC_STEM} EH.app" |
| 130 redump_syms_variant "${BPAD_SYM_PATH}" "${SRC_STEM}" \ |
| 131 "${SRC_STEM} NP" "${SRC_STEM} NP.app" |
| 132 ;; |
| 133 esac |
| 134 |
89 # Remove the .dSYM archive if the file has changed since the archive was | 135 # Remove the .dSYM archive if the file has changed since the archive was |
90 # last generated. This will cause a new .dSYM archive to be created. | 136 # last generated. This will cause a new .dSYM archive to be created. |
91 if [ "${DWARF_PATH}" -nt "${DSYM_TAR_PATH}" ] ; then | 137 if [ "${DWARF_PATH}" -nt "${DSYM_TAR_PATH}" ] ; then |
92 rm -f "${DSYM_TAR_PATH}" | 138 rm -f "${DSYM_TAR_PATH}" |
93 fi | 139 fi |
94 | 140 |
95 # Push the .dSYM bundle onto the DSYMS array so that it will be included in | 141 # Push the .dSYM bundle onto the DSYMS array so that it will be included in |
96 # the .dSYM archive if a new one is needed | 142 # the .dSYM archive if a new one is needed |
97 DSYMS[${#DSYMS[@]}]="${DSYM_NAME}" | 143 DSYMS[${#DSYMS[@]}]="${DSYM_NAME}" |
98 done | 144 done |
99 | 145 |
100 # Create the archive of .dSYM bundles. | 146 # Create the archive of .dSYM bundles. |
101 if [ ! -e "${DSYM_TAR_PATH}" ] ; then | 147 if [ ! -e "${DSYM_TAR_PATH}" ] ; then |
102 # Change directory so that absolute paths aren't included in the archive. | 148 # Change directory so that absolute paths aren't included in the archive. |
103 (cd "${BUILT_PRODUCTS_DIR}" && | 149 (cd "${BUILT_PRODUCTS_DIR}" && |
104 tar -jcf "${DSYM_TAR_PATH}" "${DSYMS[@]}") | 150 tar -jcf "${DSYM_TAR_PATH}" "${DSYMS[@]}") |
105 fi | 151 fi |
OLD | NEW |