Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 # SRC_STEM is the name of the file within the DWARF directory of the .dSYM | 100 # SRC_STEM is the name of the file within the DWARF directory of the .dSYM |
| 101 # bundle, which comes from the on-disk name of an executable or dylib within | 101 # bundle, which comes from the on-disk name of an executable or dylib within |
| 102 # its enclosing .app, .framework or .plugin bundle. This is the bundle name | 102 # its enclosing .app, .framework or .plugin bundle. This is the bundle name |
| 103 # without .app, .framework or .plugin appended. For non-bundled types, the | 103 # without .app, .framework or .plugin appended. For non-bundled types, the |
| 104 # stem is just the name of the singular file on disk. | 104 # stem is just the name of the singular file on disk. |
| 105 SRC_STEM=$(echo "${SRC_NAME}" | sed -Ee 's/\.(app|framework|plugin)$//') | 105 SRC_STEM=$(echo "${SRC_NAME}" | sed -Ee 's/\.(app|framework|plugin)$//') |
| 106 DSYM_NAME="${SRC_NAME}.dSYM" | 106 DSYM_NAME="${SRC_NAME}.dSYM" |
| 107 DSYM_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}" | 107 DSYM_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}" |
| 108 DWARF_PATH="${DSYM_PATH}/Contents/Resources/DWARF/${SRC_STEM}" | 108 DWARF_PATH="${DSYM_PATH}/Contents/Resources/DWARF/${SRC_STEM}" |
| 109 | 109 |
| 110 # SRC_PATH is the path to the Mach-O file to which the DSYM_PATH corresponds. | |
| 111 # If this is a directory, it is a bundle, and the path to the actual image | |
| 112 # needs to be computed for dump_syms. | |
| 113 SRC_PREFIX="${BUILT_PRODUCTS_DIR}/${SRC_NAME}" | |
| 114 SRC_PATH="" | |
| 115 if [[ -d "${SRC_PREFIX}" ]]; then | |
| 116 BUNDLED_OPTIONS=( | |
| 117 # Executables and plugins: | |
| 118 "${SRC_PREFIX}/Contents/MacOS/${SRC_STEM}" | |
| 119 # Frameworks: | |
| 120 "${SRC_PREFIX}/Versions/Current/${SRC_STEM}" | |
| 121 ) | |
| 122 for BUNDLED_OPTION in "${BUNDLED_OPTIONS[@]}"; do | |
| 123 if [[ -e "${BUNDLED_OPTION}" ]]; then | |
|
Mark Mentovai
2014/07/25 22:28:43
Use a combination of -f and -x, not -e.
Robert Sesek
2014/07/25 22:37:36
Done.
| |
| 124 SRC_PATH="${BUNDLED_OPTION}" | |
| 125 break | |
| 126 fi | |
| 127 done | |
| 128 | |
| 129 if [[ -z "${SRC_PATH}" ]]; then | |
| 130 echo "${0}: Could not find bundled Mach-O file for ${SRC_NAME}" | |
| 131 exit 1 | |
| 132 fi | |
| 133 else | |
| 134 # The Mach-O file is not a bundle. | |
| 135 SRC_PATH="${SRC_PREFIX}" | |
| 136 fi | |
| 137 | |
| 110 ARCHS=$(file "${DWARF_PATH}" | sed -Ene 's/^.*(i386|x86_64)$/\1/p') | 138 ARCHS=$(file "${DWARF_PATH}" | sed -Ene 's/^.*(i386|x86_64)$/\1/p') |
| 111 if [[ -z "${ARCHS}" ]]; then | 139 if [[ -z "${ARCHS}" ]]; then |
| 112 echo "${0}: expected something dumpable in ${DWARF_PATH}" >& 2 | 140 echo "${0}: expected something dumpable in ${DWARF_PATH}" >& 2 |
| 113 exit 1 | 141 exit 1 |
| 114 fi | 142 fi |
| 115 | 143 |
| 116 for ARCH in ${ARCHS}; do | 144 for ARCH in ${ARCHS}; do |
| 117 BPAD_SYM_NAME="${SRC_NAME}-${FULL_VERSION}-${ARCH}.breakpad" | 145 BPAD_SYM_NAME="${SRC_NAME}-${FULL_VERSION}-${ARCH}.breakpad" |
| 118 BPAD_SYM_PATH="${BUILT_PRODUCTS_DIR}/${BPAD_SYM_NAME}" | 146 BPAD_SYM_PATH="${BUILT_PRODUCTS_DIR}/${BPAD_SYM_NAME}" |
| 119 | 147 |
| 120 # Only run dump_syms if the file has changed since the last dump. Use -c | 148 # Only run dump_syms if the file has changed since the last dump. Use -g |
| 121 # to avoid dumping CFI, because the Breakpad stackwalk is incompatible | 149 # to dump data from the dSYM and CFI data from the Mach-O library or |
| 122 # with CFI produced by clang. | 150 # executable. |
| 123 # http://code.google.com/p/google-breakpad/issues/detail?id=443 | |
| 124 if [ "${DWARF_PATH}" -nt "${BPAD_SYM_PATH}" ] ; then | 151 if [ "${DWARF_PATH}" -nt "${BPAD_SYM_PATH}" ] ; then |
|
Mark Mentovai
2014/07/25 22:28:43
You should also check if SRC_PATH is newer than BP
Robert Sesek
2014/07/25 22:37:36
Done.
| |
| 125 "${BREAKPAD_DUMP_SYMS}" -a "${ARCH}" -c "${DWARF_PATH}" > \ | 152 "${BREAKPAD_DUMP_SYMS}" -a "${ARCH}" -g "${DWARF_PATH}" "${SRC_PATH}" > \ |
| 126 "${BPAD_SYM_PATH}" | 153 "${BPAD_SYM_PATH}" |
| 127 fi | 154 fi |
| 128 | 155 |
| 129 # Some executables will show up with variant names. The Breakpad symbol | 156 # Some executables will show up with variant names. The Breakpad symbol |
| 130 # server looks up modules based on a combination of the module name and | 157 # server looks up modules based on a combination of the module name and |
| 131 # identifier (UUID). Produce symbol files for these variant names so that | 158 # identifier (UUID). Produce symbol files for these variant names so that |
| 132 # the Breakpad symbol server will have something to return for stacks that | 159 # the Breakpad symbol server will have something to return for stacks that |
| 133 # travel through these modules. | 160 # travel through these modules. |
| 134 case "${SRC_NAME}" in | 161 case "${SRC_NAME}" in |
| 135 "${SRC_APP_NAME}.app") | 162 "${SRC_APP_NAME}.app") |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 160 # the .dSYM archive if a new one is needed | 187 # the .dSYM archive if a new one is needed |
| 161 DSYMS[${#DSYMS[@]}]="${DSYM_NAME}" | 188 DSYMS[${#DSYMS[@]}]="${DSYM_NAME}" |
| 162 done | 189 done |
| 163 | 190 |
| 164 # Create the archive of .dSYM bundles. | 191 # Create the archive of .dSYM bundles. |
| 165 if [ ! -e "${DSYM_TAR_PATH}" ] ; then | 192 if [ ! -e "${DSYM_TAR_PATH}" ] ; then |
| 166 # Change directory so that absolute paths aren't included in the archive. | 193 # Change directory so that absolute paths aren't included in the archive. |
| 167 (cd "${BUILT_PRODUCTS_DIR}" && | 194 (cd "${BUILT_PRODUCTS_DIR}" && |
| 168 tar -jcf "${DSYM_TAR_PATH}" "${DSYMS[@]}") | 195 tar -jcf "${DSYM_TAR_PATH}" "${DSYMS[@]}") |
| 169 fi | 196 fi |
| OLD | NEW |