| 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 | 7 |
| 8 # A generic script used to attach to a running Chromium process and | 8 # A generic script used to attach to a running Chromium process and |
| 9 # debug it. Most users should not use this directly, but one of the | 9 # debug it. Most users should not use this directly, but one of the |
| 10 # wrapper scripts like adb_gdb_content_shell | 10 # wrapper scripts like adb_gdb_content_shell |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 This can be a regular Android application process, or a sandboxed | 238 This can be a regular Android application process, or a sandboxed |
| 239 service, if you use the --sandboxed or --sandboxed=<num> option. | 239 service, if you use the --sandboxed or --sandboxed=<num> option. |
| 240 | 240 |
| 241 This script needs several things to work properly. It will try to pick | 241 This script needs several things to work properly. It will try to pick |
| 242 them up automatically for you though: | 242 them up automatically for you though: |
| 243 | 243 |
| 244 - target gdbserver binary | 244 - target gdbserver binary |
| 245 - host gdb client (e.g. arm-linux-androideabi-gdb) | 245 - host gdb client (e.g. arm-linux-androideabi-gdb) |
| 246 - directory with symbolic version of $PROGRAM_NAME's shared libraries. | 246 - directory with symbolic version of $PROGRAM_NAME's shared libraries. |
| 247 | 247 |
| 248 If you have sourced Chromium's build/android/envsetup.sh, this script will | 248 You can also use --ndk-dir=<path> to specify an alternative NDK installation |
| 249 find all of them automatically. This is the recommended way to use it. | |
| 250 | |
| 251 Otherwise, if you have ANDROID_NDK_ROOT defined in your environment, | |
| 252 the script will use it to find the gdb and gdbserver binaries. You can | |
| 253 also use --ndk-dir=<path> to specify an alternative NDK installation | |
| 254 directory. | 249 directory. |
| 255 | 250 |
| 256 The script tries to find the most recent version of the debug version of | 251 The script tries to find the most recent version of the debug version of |
| 257 shared libraries under one of the following directories: | 252 shared libraries under one of the following directories: |
| 258 | 253 |
| 259 \$CHROMIUM_SRC/<out>/Release/lib/ (used by Ninja builds) | 254 \$CHROMIUM_SRC/<out>/Release/lib/ (used by Ninja builds) |
| 260 \$CHROMIUM_SRC/<out>/Debug/lib/ (used by Ninja builds) | 255 \$CHROMIUM_SRC/<out>/Debug/lib/ (used by Ninja builds) |
| 261 \$CHROMIUM_SRC/<out>/Release/lib.target/ (used by Make builds) | 256 \$CHROMIUM_SRC/<out>/Release/lib.target/ (used by Make builds) |
| 262 \$CHROMIUM_SRC/<out>/Debug/lib.target/ (used by Make builds) | 257 \$CHROMIUM_SRC/<out>/Debug/lib.target/ (used by Make builds) |
| 263 | 258 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 330 |
| 336 EOF | 331 EOF |
| 337 exit 0 | 332 exit 0 |
| 338 fi | 333 fi |
| 339 | 334 |
| 340 if [ -z "$PACKAGE_NAME" ]; then | 335 if [ -z "$PACKAGE_NAME" ]; then |
| 341 panic "Please specify a package name on the command line. See --help." | 336 panic "Please specify a package name on the command line. See --help." |
| 342 fi | 337 fi |
| 343 | 338 |
| 344 if [ -z "$NDK_DIR" ]; then | 339 if [ -z "$NDK_DIR" ]; then |
| 345 if [ -z "$ANDROID_NDK_ROOT" ]; then | 340 ANDROID_NDK_ROOT=$(PYTHONPATH=build/android python -c \ |
| 346 panic "Can't find NDK directory, please source \ | 341 'from pylib.constants import ANDROID_NDK_ROOT; print ANDROID_NDK_ROOT,') |
| 347 build/android/envsetup.sh!" | |
| 348 fi | |
| 349 else | 342 else |
| 350 if [ ! -d "$NDK_DIR" ]; then | 343 if [ ! -d "$NDK_DIR" ]; then |
| 351 panic "Invalid directory: $NDK_DIR" | 344 panic "Invalid directory: $NDK_DIR" |
| 352 fi | 345 fi |
| 353 if [ ! -f "$NDK_DIR/ndk-build" ]; then | 346 if [ ! -f "$NDK_DIR/ndk-build" ]; then |
| 354 panic "Not a valid NDK directory: $NDK_DIR" | 347 panic "Not a valid NDK directory: $NDK_DIR" |
| 355 fi | 348 fi |
| 356 ANDROID_NDK_ROOT=$NDK_DIR | 349 ANDROID_NDK_ROOT=$NDK_DIR |
| 357 fi | 350 fi |
| 358 | 351 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 | 972 |
| 980 if [ "$VERBOSE" -gt 0 ]; then | 973 if [ "$VERBOSE" -gt 0 ]; then |
| 981 echo "### START $COMMANDS" | 974 echo "### START $COMMANDS" |
| 982 cat $COMMANDS | 975 cat $COMMANDS |
| 983 echo "### END $COMMANDS" | 976 echo "### END $COMMANDS" |
| 984 fi | 977 fi |
| 985 | 978 |
| 986 log "Launching gdb client: $GDB $GDBARGS -x $COMMANDS" | 979 log "Launching gdb client: $GDB $GDBARGS -x $COMMANDS" |
| 987 $GDB $GDBARGS -x $COMMANDS && | 980 $GDB $GDBARGS -x $COMMANDS && |
| 988 rm -f "$GDBSERVER_PIDFILE" | 981 rm -f "$GDBSERVER_PIDFILE" |
| OLD | NEW |