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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 DEFAULT_ACTIVITY=${ADB_GDB_ACTIVITY:-".Main"} | 80 DEFAULT_ACTIVITY=${ADB_GDB_ACTIVITY:-".Main"} |
81 | 81 |
82 # Allow wrapper scripts to set the program name through ADB_GDB_PROGNAME | 82 # Allow wrapper scripts to set the program name through ADB_GDB_PROGNAME |
83 PROGNAME=${ADB_GDB_PROGNAME:-$(basename "$0")} | 83 PROGNAME=${ADB_GDB_PROGNAME:-$(basename "$0")} |
84 | 84 |
85 ACTIVITY=$DEFAULT_ACTIVITY | 85 ACTIVITY=$DEFAULT_ACTIVITY |
86 ADB= | 86 ADB= |
87 ANNOTATE= | 87 ANNOTATE= |
88 FORCE= | 88 FORCE= |
89 GDBEXEPOSTFIX=gdb | 89 GDBEXEPOSTFIX=gdb |
| 90 CGDB= |
90 GDBINIT= | 91 GDBINIT= |
91 GDBSERVER= | 92 GDBSERVER= |
92 HELP= | 93 HELP= |
93 NDK_DIR= | 94 NDK_DIR= |
94 NO_PULL_LIBS= | 95 NO_PULL_LIBS= |
95 PACKAGE_NAME= | 96 PACKAGE_NAME= |
96 PID= | 97 PID= |
97 PORT= | 98 PORT= |
98 PRIVILEGED= | 99 PRIVILEGED= |
99 PRIVILEGED_INDEX= | 100 PRIVILEGED_INDEX= |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 ;; | 200 ;; |
200 --target-arch=*) | 201 --target-arch=*) |
201 TARGET_ARCH=$optarg | 202 TARGET_ARCH=$optarg |
202 ;; | 203 ;; |
203 --toolchain=*) | 204 --toolchain=*) |
204 TOOLCHAIN=$optarg | 205 TOOLCHAIN=$optarg |
205 ;; | 206 ;; |
206 --ui) | 207 --ui) |
207 GDBEXEPOSTFIX=gdbtui | 208 GDBEXEPOSTFIX=gdbtui |
208 ;; | 209 ;; |
| 210 --cgdb) |
| 211 CGDB=cgdb |
| 212 ;; |
| 213 --cgdb=*) |
| 214 CGDB=$optarg |
| 215 ;; |
209 --verbose) | 216 --verbose) |
210 VERBOSE=$(( $VERBOSE + 1 )) | 217 VERBOSE=$(( $VERBOSE + 1 )) |
211 ;; | 218 ;; |
212 -*) | 219 -*) |
213 panic "Unknown option $opt, see --help." >&2 | 220 panic "Unknown option $opt, see --help." >&2 |
214 ;; | 221 ;; |
215 *) | 222 *) |
216 if [ "$PACKAGE_NAME" ]; then | 223 if [ "$PACKAGE_NAME" ]; then |
217 panic "You can only provide a single package name as argument!\ | 224 panic "You can only provide a single package name as argument!\ |
218 See --help." | 225 See --help." |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 306 |
300 Any local .gdbinit script will be ignored, but it is possible to pass a | 307 Any local .gdbinit script will be ignored, but it is possible to pass a |
301 gdb command script with the --script=<file> option. Note that its commands | 308 gdb command script with the --script=<file> option. Note that its commands |
302 will be passed to gdb after the remote connection and library symbol | 309 will be passed to gdb after the remote connection and library symbol |
303 loading have completed. | 310 loading have completed. |
304 | 311 |
305 Valid options: | 312 Valid options: |
306 --help|-h|-? Print this message. | 313 --help|-h|-? Print this message. |
307 --verbose Increase verbosity. | 314 --verbose Increase verbosity. |
308 | 315 |
| 316 --cgdb[=<file>] Use cgdb (an interface for gdb that shows the code). |
309 --sandboxed Debug first sandboxed process we find. | 317 --sandboxed Debug first sandboxed process we find. |
310 --sandboxed=<num> Debug specific sandboxed process. | 318 --sandboxed=<num> Debug specific sandboxed process. |
311 --symbol-dir=<path> Specify directory with symbol shared libraries. | 319 --symbol-dir=<path> Specify directory with symbol shared libraries. |
312 --output-directory=<path> Specify the output directory (e.g. "out/Debug"). | 320 --output-directory=<path> Specify the output directory (e.g. "out/Debug"). |
313 --package-name=<name> Specify package name (alternative to 1st argument). | 321 --package-name=<name> Specify package name (alternative to 1st argument). |
314 --privileged Debug first privileged process we find. | 322 --privileged Debug first privileged process we find. |
315 --privileged=<num> Debug specific privileged process. | 323 --privileged=<num> Debug specific privileged process. |
316 --program-name=<name> Specify program name (cosmetic only). | 324 --program-name=<name> Specify program name (cosmetic only). |
317 --pid=<pid> Specify application process pid. | 325 --pid=<pid> Specify application process pid. |
318 --force Kill any previous debugging session, if any. | 326 --force Kill any previous debugging session, if any. |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 cat "$GDBINIT" >> $COMMANDS | 1048 cat "$GDBINIT" >> $COMMANDS |
1041 fi | 1049 fi |
1042 | 1050 |
1043 if [ "$VERBOSE" -gt 0 ]; then | 1051 if [ "$VERBOSE" -gt 0 ]; then |
1044 echo "### START $COMMANDS" | 1052 echo "### START $COMMANDS" |
1045 cat $COMMANDS | 1053 cat $COMMANDS |
1046 echo "### END $COMMANDS" | 1054 echo "### END $COMMANDS" |
1047 fi | 1055 fi |
1048 | 1056 |
1049 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" | 1057 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" |
1050 $GDB $GDB_ARGS -x $COMMANDS && | 1058 if [ "$CGDB" ]; then |
| 1059 $CGDB -d $GDB -- $GDB_ARGS -x $COMMANDS |
| 1060 else |
| 1061 $GDB $GDB_ARGS -x $COMMANDS |
| 1062 fi |
1051 rm -f "$GDBSERVER_PIDFILE" | 1063 rm -f "$GDBSERVER_PIDFILE" |
OLD | NEW |