| #!/usr/bin/env bash |
| |
| # Copyright 2018 The Fuchsia Authors |
| # |
| # Use of this source code is governed by a MIT-style |
| # license that can be found in the LICENSE file or at |
| # https://opensource.org/licenses/MIT |
| |
| ZIRCON_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" |
| PREBUILT_DIR="${ZIRCON_ROOT}/prebuilt/downloads" |
| |
| if [[ -z "$LLVM_SYMBOLIZER" ]]; then |
| LLVM_SYMBOLIZER="${PREBUILT_DIR}/clang/bin/llvm-symbolizer" |
| fi |
| |
| readonly SYMBOLIZE="${PREBUILT_DIR}/symbolize" |
| |
| case $# in |
| 0) |
| build_id_file="${ZIRCON_ROOT}/build-x64/ids.txt" |
| ;; |
| 1) |
| build_id_file="$1" |
| ;; |
| *) |
| echo >&2 "Usage: $0 [/path/to/ids.txt]" |
| exit 1 |
| ;; |
| esac |
| |
| # TODO(mcgrathr): Temporary until symbolize gets fixed to default -color |
| # correctly based on isatty && TERM details. |
| if tty -s <&1; then |
| # On a terminal, use default logic based on $TERM. |
| COLOR= |
| else |
| # Not a terminal, so disable color. |
| COLOR=-color=false |
| fi |
| |
| exec "$SYMBOLIZE" $COLOR -llvm-symbolizer "$LLVM_SYMBOLIZER" -ids "$build_id_file" |