Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: build/android/adb_gdb

Issue 23513083: Fix the adb_gdb script to honor the --gdb flag for a user specified gdb binary according to the exi… (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ;; 114 ;;
115 --annotate=3) 115 --annotate=3)
116 ANNOTATE=$optarg 116 ANNOTATE=$optarg
117 ;; 117 ;;
118 --force) 118 --force)
119 FORCE=true 119 FORCE=true
120 ;; 120 ;;
121 --gdbserver=*) 121 --gdbserver=*)
122 GDBSERVER=$optarg 122 GDBSERVER=$optarg
123 ;; 123 ;;
124 --gdb=*)
125 GDB=$optarg
126 ;;
124 --help|-h|-?) 127 --help|-h|-?)
125 HELP=true 128 HELP=true
126 ;; 129 ;;
127 --ndk-dir=*) 130 --ndk-dir=*)
128 NDK_DIR=$optarg 131 NDK_DIR=$optarg
129 ;; 132 ;;
130 --no-pull-libs) 133 --no-pull-libs)
131 NO_PULL_LIBS=true 134 NO_PULL_LIBS=true
132 ;; 135 ;;
133 --package-name=*) 136 --package-name=*)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 --package-name=<name> Specify package name (alternative to 1st argument). 298 --package-name=<name> Specify package name (alternative to 1st argument).
296 --program-name=<name> Specify program name (cosmetic only). 299 --program-name=<name> Specify program name (cosmetic only).
297 --pid=<pid> Specify application process pid. 300 --pid=<pid> Specify application process pid.
298 --force Kill any previous debugging session, if any. 301 --force Kill any previous debugging session, if any.
299 --start Start package's activity on device. 302 --start Start package's activity on device.
300 --ui Use gdbtui instead of gdb 303 --ui Use gdbtui instead of gdb
301 --activity=<name> Activity name for --start [$DEFAULT_ACTIVITY]. 304 --activity=<name> Activity name for --start [$DEFAULT_ACTIVITY].
302 --annotate=<num> Enable gdb annotation. 305 --annotate=<num> Enable gdb annotation.
303 --script=<file> Specify extra GDB init script. 306 --script=<file> Specify extra GDB init script.
304 307
305 --gdbserver=<file> Specify targer gdbserver binary. 308 --gdbserver=<file> Specify target gdbserver binary.
306 --gdb=<program> Specify host gdb client binary. 309 --gdb=<file> Specify host gdb client binary.
307 --target-arch=<name> Specify NDK target arch. 310 --target-arch=<name> Specify NDK target arch.
308 --adb=<program> Specify host ADB binary. 311 --adb=<file> Specify host ADB binary.
309 312
310 --su-prefix=<prefix> Prepend <prefix> to 'adb shell' commands that are 313 --su-prefix=<prefix> Prepend <prefix> to 'adb shell' commands that are
311 run by this script. This can be useful to use 314 run by this script. This can be useful to use
312 the 'su' program on rooted production devices. 315 the 'su' program on rooted production devices.
313 316
314 --pull-libs Force system libraries extraction. 317 --pull-libs Force system libraries extraction.
315 --no-pull-libs Do not extract any system library. 318 --no-pull-libs Do not extract any system library.
316 --libs-dir=<path> Specify system libraries extraction directory. 319 --libs-dir=<path> Specify system libraries extraction directory.
317 320
318 --debug Use libraries under out/Debug. 321 --debug Use libraries under out/Debug.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if [ -d "$TOOLCHAIN/bin" ]; then 538 if [ -d "$TOOLCHAIN/bin" ]; then
536 TOOLCHAIN=$TOOLCHAIN/bin 539 TOOLCHAIN=$TOOLCHAIN/bin
537 fi 540 fi
538 ANDROID_TOOLCHAIN=$TOOLCHAIN 541 ANDROID_TOOLCHAIN=$TOOLCHAIN
539 fi 542 fi
540 543
541 # Cosmetic: Remove trailing directory separator. 544 # Cosmetic: Remove trailing directory separator.
542 ANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN%/} 545 ANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN%/}
543 546
544 # Find host GDB client binary 547 # Find host GDB client binary
545 GDB=$(which $ANDROID_TOOLCHAIN/*-$GDBEXEPOSTFIX 2>/dev/null | head -1)
546 if [ -z "$GDB" ]; then 548 if [ -z "$GDB" ]; then
547 panic "Can't find Android gdb client in your path, check your \ 549 GDB=$(which $ANDROID_TOOLCHAIN/*-$GDBEXEPOSTFIX 2>/dev/null | head -1)
548 --toolchain path." 550 if [ -z "$GDBSERVER" ]; then
551 panic "Can't find Android gdb client in your path, check your \
552 --toolchain or --gdb path."
553 fi
554 log "Host gdb client: $GDB"
549 fi 555 fi
550 log "Host gdb client: $GDB"
551 556
552 # Find gdbserver binary, we will later push it to /data/local/tmp 557 # Find gdbserver binary, we will later push it to /data/local/tmp
553 # This ensures that both gdbserver and $GDB talk the same binary protocol, 558 # This ensures that both gdbserver and $GDB talk the same binary protocol,
554 # otherwise weird problems will appear. 559 # otherwise weird problems will appear.
555 # 560 #
556 if [ -z "$GDBSERVER" ]; then 561 if [ -z "$GDBSERVER" ]; then
557 GDBSERVER=$(get_ndk_gdbserver "$ANDROID_NDK_ROOT" "$TARGET_ARCH") 562 GDBSERVER=$(get_ndk_gdbserver "$ANDROID_NDK_ROOT" "$TARGET_ARCH")
558 if [ -z "$GDBSERVER" ]; then 563 if [ -z "$GDBSERVER" ]; then
559 panic "Can't find NDK gdbserver binary. use --gdbserver to specify \ 564 panic "Can't find NDK gdbserver binary. use --gdbserver to specify \
560 valid one!" 565 valid one!"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 # so we can add them to solib-search-path later. 884 # so we can add them to solib-search-path later.
880 SOLIB_DIRS=$(find $PULL_LIBS_DIR -mindepth 1 -maxdepth 4 -type d | \ 885 SOLIB_DIRS=$(find $PULL_LIBS_DIR -mindepth 1 -maxdepth 4 -type d | \
881 grep -v "^$" | tr '\n' ':') 886 grep -v "^$" | tr '\n' ':')
882 887
883 # This is a re-implementation of gdbclient, where we use compatible 888 # This is a re-implementation of gdbclient, where we use compatible
884 # versions of gdbserver and $GDBNAME to ensure that everything works 889 # versions of gdbserver and $GDBNAME to ensure that everything works
885 # properly. 890 # properly.
886 # 891 #
887 892
888 # Push gdbserver to the device 893 # Push gdbserver to the device
889 log "Pushing gdbserver to $TARGET_GDBSERVER" 894 log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER"
890 adb push $GDBSERVER $TARGET_GDBSERVER &>/dev/null 895 adb push $GDBSERVER $TARGET_GDBSERVER &>/dev/null
891 fail_panic "Could not copy gdbserver to the device!" 896 fail_panic "Could not copy gdbserver to the device!"
892 897
893 PORT=5039 898 PORT=5039
894 HOST_PORT=$PORT 899 HOST_PORT=$PORT
895 TARGET_PORT=$PORT 900 TARGET_PORT=$PORT
896 901
897 # Pull the app_process binary from the device 902 # Pull the app_process binary from the device
898 GDBEXEC=app_process 903 GDBEXEC=app_process
899 log "Pulling $GDBEXEC from device" 904 log "Pulling $GDBEXEC from device"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 959
955 if [ "$VERBOSE" -gt 0 ]; then 960 if [ "$VERBOSE" -gt 0 ]; then
956 echo "### START $COMMANDS" 961 echo "### START $COMMANDS"
957 cat $COMMANDS 962 cat $COMMANDS
958 echo "### END $COMMANDS" 963 echo "### END $COMMANDS"
959 fi 964 fi
960 965
961 log "Launching gdb client: $GDB $GDBARGS -x $COMMANDS" 966 log "Launching gdb client: $GDB $GDBARGS -x $COMMANDS"
962 $GDB $GDBARGS -x $COMMANDS && 967 $GDB $GDBARGS -x $COMMANDS &&
963 rm -f "$GDBSERVER_PIDFILE" 968 rm -f "$GDBSERVER_PIDFILE"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698