| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 # Copyright 2012 The Native Client Authors. All rights reserved. | 3 # 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 | 4 # found in the LICENSE file. |
| 5 # be found in the LICENSE file. | |
| 6 | 5 |
| 7 set -o nounset | 6 set -o nounset |
| 8 set -o errexit | 7 set -o errexit |
| 9 | 8 |
| 10 #@ Various commands to emulate mips32 code using qemu | 9 #@ Various commands to emulate mips32 code using qemu |
| 11 #@ | 10 #@ |
| 12 #@ Note: this script is not meant to be run as | 11 #@ Note: this script is not meant to be run as |
| 13 #@ tools/llvm/qemu_tool.sh | 12 #@ tools/llvm/qemu_tool.sh |
| 14 #@ but rather as: | 13 #@ but rather as: |
| 15 #@ toolchain/linux_mips-trusted/qemu-mips32 | 14 #@ toolchain/linux_mips-trusted/qemu-mips32 |
| 16 | 15 |
| 17 # From a qemu build based on qemu-0.12.5.tar.gz | 16 # From a qemu build based on qemu-0.12.5.tar.gz |
| 18 readonly SDK_ROOT=$(dirname $0) | 17 readonly SDK_ROOT=$(dirname $0) |
| 19 readonly QEMU=${SDK_ROOT}/qemu-mips32 | 18 readonly QEMU=${SDK_ROOT}/qemu-mips32 |
| 20 readonly QEMU_JAIL=${SDK_ROOT}/mips-release/mips-linux-gnu/libc/el | 19 readonly QEMU_JAIL=${SDK_ROOT}/sysroot |
| 21 # NOTE: some useful debugging options for qemu: | 20 # NOTE: some useful debugging options for qemu: |
| 22 # env vars: | 21 # env vars: |
| 23 # QEMU_STRACE=1 | 22 # QEMU_STRACE=1 |
| 24 # args: | 23 # args: |
| 25 # -strace | 24 # -strace |
| 26 # -d out_asm,in_asm,op,int,exec,cpu | 25 # -d out_asm,in_asm,op,int,exec,cpu |
| 27 # c.f. cpu_log_items in qemu-XXX/exec.c | 26 # c.f. cpu_log_items in qemu-XXX/exec.c |
| 28 readonly QEMU_ARGS="" | 27 readonly QEMU_ARGS="" |
| 29 readonly QEMU_ARGS_DEBUG="-d in_asm,int,exec,cpu" | 28 readonly QEMU_ARGS_DEBUG="-d in_asm,int,exec,cpu" |
| 30 readonly QEMU_ARGS_DEBUG_SR="-d in_asm,int,exec,cpu,service_runtime" | 29 readonly QEMU_ARGS_DEBUG_SR="-d in_asm,int,exec,cpu,service_runtime" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 Usage | 106 Usage |
| 108 exit -1 | 107 exit -1 |
| 109 elif [[ "$(type -t $1)" != "function" ]]; then | 108 elif [[ "$(type -t $1)" != "function" ]]; then |
| 110 echo "ERROR: unknown function '$1'." >&2 | 109 echo "ERROR: unknown function '$1'." >&2 |
| 111 echo "For help, try:" | 110 echo "For help, try:" |
| 112 echo " $0 help" | 111 echo " $0 help" |
| 113 exit 1 | 112 exit 1 |
| 114 else | 113 else |
| 115 "$@" | 114 "$@" |
| 116 fi | 115 fi |
| OLD | NEW |