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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 - target gdbserver binary | 262 - target gdbserver binary |
263 - host gdb client (e.g. arm-linux-androideabi-gdb) | 263 - host gdb client (e.g. arm-linux-androideabi-gdb) |
264 - directory with symbolic version of $PROGRAM_NAME's shared libraries. | 264 - directory with symbolic version of $PROGRAM_NAME's shared libraries. |
265 | 265 |
266 You can also use --ndk-dir=<path> to specify an alternative NDK installation | 266 You can also use --ndk-dir=<path> to specify an alternative NDK installation |
267 directory. | 267 directory. |
268 | 268 |
269 The script tries to find the most recent version of the debug version of | 269 The script tries to find the most recent version of the debug version of |
270 shared libraries under one of the following directories: | 270 shared libraries under one of the following directories: |
271 | 271 |
272 \$CHROMIUM_SRC/<out>/Release/lib/ (used by Ninja builds) | 272 \$CHROMIUM_SRC/<out>/Release/lib/ (used by GYP builds) |
273 \$CHROMIUM_SRC/<out>/Debug/lib/ (used by Ninja builds) | 273 \$CHROMIUM_SRC/<out>/Debug/lib/ (used by GYP builds) |
274 \$CHROMIUM_SRC/<out>/Release/lib.target/ (used by Make builds) | 274 \$CHROMIUM_SRC/<out>/Release/lib.unstripped/ (used by GN builds) |
275 \$CHROMIUM_SRC/<out>/Debug/lib.target/ (used by Make builds) | 275 \$CHROMIUM_SRC/<out>/Debug/lib.unstripped/ (used by GN builds) |
276 | 276 |
277 Where <out> is 'out' by default, unless the --out=<name> option is used or | 277 Where <out> is 'out' by default, unless the --out=<name> option is used or |
278 the CHROMIUM_OUT_DIR environment variable is defined. | 278 the CHROMIUM_OUT_DIR environment variable is defined. |
279 | 279 |
280 You can restrict this search by using --release or --debug to specify the | 280 You can restrict this search by using --release or --debug to specify the |
281 build type, or simply use --symbol-dir=<path> to specify the file manually. | 281 build type, or simply use --symbol-dir=<path> to specify the file manually. |
282 | 282 |
283 The script tries to extract the target architecture from your target device, | 283 The script tries to extract the target architecture from your target device, |
284 but if this fails, will default to 'arm'. Use --target-arch=<name> to force | 284 but if this fails, will default to 'arm'. Use --target-arch=<name> to force |
285 its value. | 285 its value. |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 | 703 |
704 # Detect the build type and symbol directory. This is done by finding | 704 # Detect the build type and symbol directory. This is done by finding |
705 # the most recent sub-directory containing debug shared libraries under | 705 # the most recent sub-directory containing debug shared libraries under |
706 # $CHROMIUM_SRC/$CHROMIUM_OUT_DIR/ | 706 # $CHROMIUM_SRC/$CHROMIUM_OUT_DIR/ |
707 # | 707 # |
708 # $1: $BUILDTYPE value, can be empty | 708 # $1: $BUILDTYPE value, can be empty |
709 # Out: nothing, but this sets SYMBOL_DIR | 709 # Out: nothing, but this sets SYMBOL_DIR |
710 # | 710 # |
711 detect_symbol_dir () { | 711 detect_symbol_dir () { |
712 local SUBDIRS SUBDIR LIST DIR DIR_LIBS TSTAMP | 712 local SUBDIRS SUBDIR LIST DIR DIR_LIBS TSTAMP |
713 # Make places them under out/$BUILDTYPE/lib.target. | 713 # GYP places unstripped libraries under out/$BUILDTYPE/lib |
714 # GYP places debug libraries under out/$BUILDTYPE/lib | |
715 # GN places them under out/$BUILDTYPE/lib.unstripped | 714 # GN places them under out/$BUILDTYPE/lib.unstripped |
716 if [ "$1" ]; then | 715 if [ "$1" ]; then |
717 SUBDIRS="$1/lib $1/lib.target $1/lib.unstripped" | 716 SUBDIRS="$1/lib $1/lib.unstripped" |
718 else | 717 else |
719 SUBDIRS="Release/lib Debug/lib Release/lib.target Debug/lib.target" | 718 SUBDIRS="Release/lib Debug/lib" |
720 SUBDIRS+=" Release/lib.unstripped Debug/lib.unstripped" | 719 SUBDIRS+=" Release/lib.unstripped Debug/lib.unstripped" |
721 fi | 720 fi |
722 LIST=$TMPDIR/scan-subdirs-$$.txt | 721 LIST=$TMPDIR/scan-subdirs-$$.txt |
723 printf "" > "$LIST" | 722 printf "" > "$LIST" |
724 for SUBDIR in $SUBDIRS; do | 723 for SUBDIR in $SUBDIRS; do |
725 DIR=$CHROMIUM_SRC/$CHROMIUM_OUT_DIR/$SUBDIR | 724 DIR=$CHROMIUM_SRC/$CHROMIUM_OUT_DIR/$SUBDIR |
726 if [ -d "$DIR" ]; then | 725 if [ -d "$DIR" ]; then |
727 # Ignore build directories that don't contain symbol versions | 726 # Ignore build directories that don't contain symbol versions |
728 # of the shared libraries. | 727 # of the shared libraries. |
729 DIR_LIBS=$(ls "$DIR"/lib*.so 2>/dev/null) | 728 DIR_LIBS=$(ls "$DIR"/lib*.so 2>/dev/null) |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 | 1049 |
1051 if [ "$VERBOSE" -gt 0 ]; then | 1050 if [ "$VERBOSE" -gt 0 ]; then |
1052 echo "### START $COMMANDS" | 1051 echo "### START $COMMANDS" |
1053 cat $COMMANDS | 1052 cat $COMMANDS |
1054 echo "### END $COMMANDS" | 1053 echo "### END $COMMANDS" |
1055 fi | 1054 fi |
1056 | 1055 |
1057 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" | 1056 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" |
1058 $GDB $GDB_ARGS -x $COMMANDS && | 1057 $GDB $GDB_ARGS -x $COMMANDS && |
1059 rm -f "$GDBSERVER_PIDFILE" | 1058 rm -f "$GDBSERVER_PIDFILE" |
OLD | NEW |