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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 BUILDTYPE= | 90 BUILDTYPE= |
91 FORCE= | 91 FORCE= |
92 GDBEXEPOSTFIX=gdb | 92 GDBEXEPOSTFIX=gdb |
93 GDBINIT= | 93 GDBINIT= |
94 GDBSERVER= | 94 GDBSERVER= |
95 HELP= | 95 HELP= |
96 NDK_DIR= | 96 NDK_DIR= |
97 NO_PULL_LIBS= | 97 NO_PULL_LIBS= |
98 PACKAGE_NAME= | 98 PACKAGE_NAME= |
99 PID= | 99 PID= |
| 100 PORT= |
100 PRIVILEGED= | 101 PRIVILEGED= |
101 PRIVILEGED_INDEX= | 102 PRIVILEGED_INDEX= |
102 PROGRAM_NAME="activity" | 103 PROGRAM_NAME="activity" |
103 PULL_LIBS= | 104 PULL_LIBS= |
104 PULL_LIBS_DIR= | 105 PULL_LIBS_DIR= |
105 SANDBOXED= | 106 SANDBOXED= |
106 SANDBOXED_INDEX= | 107 SANDBOXED_INDEX= |
107 START= | 108 START= |
108 SU_PREFIX= | 109 SU_PREFIX= |
109 SYMBOL_DIR= | 110 SYMBOL_DIR= |
(...skipping 30 matching lines...) Expand all Loading... |
140 ;; | 141 ;; |
141 --no-pull-libs) | 142 --no-pull-libs) |
142 NO_PULL_LIBS=true | 143 NO_PULL_LIBS=true |
143 ;; | 144 ;; |
144 --package-name=*) | 145 --package-name=*) |
145 PACKAGE_NAME=$optarg | 146 PACKAGE_NAME=$optarg |
146 ;; | 147 ;; |
147 --pid=*) | 148 --pid=*) |
148 PID=$optarg | 149 PID=$optarg |
149 ;; | 150 ;; |
| 151 --port=*) |
| 152 PORT=$optarg |
| 153 ;; |
150 --privileged) | 154 --privileged) |
151 PRIVILEGED=true | 155 PRIVILEGED=true |
152 ;; | 156 ;; |
153 --privileged=*) | 157 --privileged=*) |
154 PRIVILEGED=true | 158 PRIVILEGED=true |
155 PRIVILEGED_INDEX=$optarg | 159 PRIVILEGED_INDEX=$optarg |
156 ;; | 160 ;; |
157 --program-name=*) | 161 --program-name=*) |
158 PROGRAM_NAME=$optarg | 162 PROGRAM_NAME=$optarg |
159 ;; | 163 ;; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 --start Start package's activity on device. | 326 --start Start package's activity on device. |
323 --ui Use gdbtui instead of gdb | 327 --ui Use gdbtui instead of gdb |
324 --activity=<name> Activity name for --start [$DEFAULT_ACTIVITY]. | 328 --activity=<name> Activity name for --start [$DEFAULT_ACTIVITY]. |
325 --annotate=<num> Enable gdb annotation. | 329 --annotate=<num> Enable gdb annotation. |
326 --script=<file> Specify extra GDB init script. | 330 --script=<file> Specify extra GDB init script. |
327 | 331 |
328 --gdbserver=<file> Specify target gdbserver binary. | 332 --gdbserver=<file> Specify target gdbserver binary. |
329 --gdb=<file> Specify host gdb client binary. | 333 --gdb=<file> Specify host gdb client binary. |
330 --target-arch=<name> Specify NDK target arch. | 334 --target-arch=<name> Specify NDK target arch. |
331 --adb=<file> Specify host ADB binary. | 335 --adb=<file> Specify host ADB binary. |
| 336 --port=<port> Specify the tcp port to use. |
332 | 337 |
333 --su-prefix=<prefix> Prepend <prefix> to 'adb shell' commands that are | 338 --su-prefix=<prefix> Prepend <prefix> to 'adb shell' commands that are |
334 run by this script. This can be useful to use | 339 run by this script. This can be useful to use |
335 the 'su' program on rooted production devices. | 340 the 'su' program on rooted production devices. |
336 e.g. --su-prefix="su -c" | 341 e.g. --su-prefix="su -c" |
337 | 342 |
338 --pull-libs Force system libraries extraction. | 343 --pull-libs Force system libraries extraction. |
339 --no-pull-libs Do not extract any system library. | 344 --no-pull-libs Do not extract any system library. |
340 --libs-dir=<path> Specify system libraries extraction directory. | 345 --libs-dir=<path> Specify system libraries extraction directory. |
341 | 346 |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 # properly. | 931 # properly. |
927 # | 932 # |
928 | 933 |
929 # Push gdbserver to the device | 934 # Push gdbserver to the device |
930 log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER" | 935 log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER" |
931 adb push $GDBSERVER $TMP_TARGET_GDBSERVER &>/dev/null | 936 adb push $GDBSERVER $TMP_TARGET_GDBSERVER &>/dev/null |
932 adb shell $COMMAND_PREFIX cp $TMP_TARGET_GDBSERVER $TARGET_GDBSERVER | 937 adb shell $COMMAND_PREFIX cp $TMP_TARGET_GDBSERVER $TARGET_GDBSERVER |
933 adb shell rm $TMP_TARGET_GDBSERVER | 938 adb shell rm $TMP_TARGET_GDBSERVER |
934 fail_panic "Could not copy gdbserver to the device!" | 939 fail_panic "Could not copy gdbserver to the device!" |
935 | 940 |
936 PORT=5039 | 941 if [ -z "$PORT" ]; then |
| 942 PORT=5039 |
| 943 fi |
937 HOST_PORT=$PORT | 944 HOST_PORT=$PORT |
938 TARGET_PORT=$PORT | 945 TARGET_PORT=$PORT |
939 | 946 |
940 # Select correct app_process for architecture. | 947 # Select correct app_process for architecture. |
941 case $TARGET_ARCH in | 948 case $TARGET_ARCH in |
942 arm|x86|mips) GDBEXEC=app_process;; | 949 arm|x86|mips) GDBEXEC=app_process;; |
943 arm64|x86_64) GDBEXEC=app_process64;; | 950 arm64|x86_64) GDBEXEC=app_process64;; |
944 *) fail_panic "Unknown app_process for architecture!";; | 951 *) fail_panic "Unknown app_process for architecture!";; |
945 esac | 952 esac |
946 | 953 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1038 |
1032 if [ "$VERBOSE" -gt 0 ]; then | 1039 if [ "$VERBOSE" -gt 0 ]; then |
1033 echo "### START $COMMANDS" | 1040 echo "### START $COMMANDS" |
1034 cat $COMMANDS | 1041 cat $COMMANDS |
1035 echo "### END $COMMANDS" | 1042 echo "### END $COMMANDS" |
1036 fi | 1043 fi |
1037 | 1044 |
1038 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" | 1045 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" |
1039 $GDB $GDB_ARGS -x $COMMANDS && | 1046 $GDB $GDB_ARGS -x $COMMANDS && |
1040 rm -f "$GDBSERVER_PIDFILE" | 1047 rm -f "$GDBSERVER_PIDFILE" |
OLD | NEW |