Chromium Code Reviews| Index: build/android/adb_gdb |
| diff --git a/build/android/adb_gdb b/build/android/adb_gdb |
| index 361f1bf8c523c5e86be8ab8e3fcc281b728a9fbe..efccd16dc0bc83ab17f77d75f2603d0abdcfce5c 100755 |
| --- a/build/android/adb_gdb |
| +++ b/build/android/adb_gdb |
| @@ -21,11 +21,6 @@ LC_ALL=C |
| # Location of Chromium-top-level sources. |
| CHROMIUM_SRC=$(cd "$PROGDIR"/../.. >/dev/null && pwd 2>/dev/null) |
| -# Location of Chromium out/ directory. |
| -if [ -z "$CHROMIUM_OUT_DIR" ]; then |
| - CHROMIUM_OUT_DIR=out |
| -fi |
| - |
| TMPDIR= |
| GDBSERVER_PIDFILE= |
| TARGET_GDBSERVER= |
| @@ -189,6 +184,9 @@ for opt; do |
| --symbol-dir=*) |
| SYMBOL_DIR=$optarg |
| ;; |
| + --output-dir=*) |
| + CHROMIUM_OUTPUT_DIR=$optarg |
| + ;; |
| --out-dir=*) |
| CHROMIUM_OUT_DIR=$optarg |
| ;; |
| @@ -223,11 +221,6 @@ for opt; do |
| esac |
| done |
| -print_help_options () { |
| - cat <<EOF |
| -EOF |
| -} |
| - |
| if [ "$HELP" ]; then |
| if [ "$ADB_GDB_PROGNAME" ]; then |
| # Assume wrapper scripts all provide a default package name. |
| @@ -269,13 +262,11 @@ directory. |
| The script tries to find the most recent version of the debug version of |
| shared libraries under one of the following directories: |
| - \$CHROMIUM_SRC/<out>/Release/lib/ (used by GYP builds) |
| - \$CHROMIUM_SRC/<out>/Debug/lib/ (used by GYP builds) |
| - \$CHROMIUM_SRC/<out>/Release/lib.unstripped/ (used by GN builds) |
| - \$CHROMIUM_SRC/<out>/Debug/lib.unstripped/ (used by GN builds) |
| + \$CHROMIUM_SRC/<out>/lib/ (used by GYP builds) |
| + \$CHROMIUM_SRC/<out>/lib.unstripped/ (used by GN builds) |
| -Where <out> is 'out' by default, unless the --out=<name> option is used or |
| -the CHROMIUM_OUT_DIR environment variable is defined. |
| +Where <out> is 'out' is determined by CHROMIUM_OUT_DIR, CHROMIUM_OUTPUT_DIR, or |
| +the --out-dir, --output-dir flags. |
| You can restrict this search by using --release or --debug to specify the |
| build type, or simply use --symbol-dir=<path> to specify the file manually. |
| @@ -319,7 +310,8 @@ Valid options: |
| --sandboxed Debug first sandboxed process we find. |
| --sandboxed=<num> Debug specific sandboxed process. |
| --symbol-dir=<path> Specify directory with symbol shared libraries. |
| - --out-dir=<path> Specify the out directory. |
| + --out-dir=<path> Specify the out directory (e.g. "out"). |
| + --output-dir=<path> Specify the output directory (e.g. "out/Debug"). |
| --package-name=<name> Specify package name (alternative to 1st argument). |
| --privileged Debug first privileged process we find. |
| --privileged=<num> Debug specific privileged process. |
| @@ -703,25 +695,34 @@ get_file_timestamp () { |
| # Detect the build type and symbol directory. This is done by finding |
| # the most recent sub-directory containing debug shared libraries under |
| -# $CHROMIUM_SRC/$CHROMIUM_OUT_DIR/ |
| +# $CHROMIUM_SRC/$CHROMIUM_OUT_DIR/, or $CHROMIUM_OUTPUT_DIR if set. |
| # |
|
pasko
2016/01/07 16:11:38
plz mention using $BUILDTYPE as input
agrieve
2016/01/08 02:07:30
Done.
|
| -# $1: $BUILDTYPE value, can be empty |
| # Out: nothing, but this sets SYMBOL_DIR |
| # |
| detect_symbol_dir () { |
| - local SUBDIRS SUBDIR LIST DIR DIR_LIBS TSTAMP |
| + local PARENT_DIR SUBDIRS SUBDIR LIST DIR DIR_LIBS TSTAMP |
| # GYP places unstripped libraries under out/$BUILDTYPE/lib |
| # GN places them under out/$BUILDTYPE/lib.unstripped |
| - if [ "$1" ]; then |
| - SUBDIRS="$1/lib $1/lib.unstripped" |
| + if [[ -n "$CHROMIUM_OUTPUT_DIR" ]]; then |
| + PARENT_DIR="$CHROMIUM_OUTPUT_DIR" |
| + SUBDIRS="lib.unstripped lib" |
| else |
| - SUBDIRS="Release/lib Debug/lib" |
| - SUBDIRS+=" Release/lib.unstripped Debug/lib.unstripped" |
| + PARENT_DIR="${CHROMIUM_OUT_DIR}" |
|
pasko
2016/01/07 16:11:38
please remove curly braces for consistency
agrieve
2016/01/08 02:07:30
Done.
|
| + if [[ -n "$BUILDTYPE" ]]; then |
| + PARENT_DIR="$PARENT_DIR/$BUILDTYPE" |
| + SUBDIRS="lib.unstripped lib" |
| + else |
| + SUBDIRS="Release/lib.unstripped Debug/lib.unstripped " |
| + SUBDIRS+="Release/lib Debug/lib" |
| + fi |
| + fi |
| + if [[ ! -e "$PARENT_DIR" ]]; then |
| + PARENT_DIR="$CHROMIUM_SRC/$PARENT_DIR" |
| fi |
| LIST=$TMPDIR/scan-subdirs-$$.txt |
| printf "" > "$LIST" |
| for SUBDIR in $SUBDIRS; do |
| - DIR=$CHROMIUM_SRC/$CHROMIUM_OUT_DIR/$SUBDIR |
| + DIR="$PARENT_DIR/$SUBDIR" |
| if [ -d "$DIR" ]; then |
| # Ignore build directories that don't contain symbol versions |
| # of the shared libraries. |
| @@ -738,21 +739,16 @@ detect_symbol_dir () { |
| rm -f "$LIST" |
| if [ -z "$SUBDIR" ]; then |
| - if [ -z "$1" ]; then |
| - panic "Could not find any build directory under \ |
| -$CHROMIUM_SRC/$CHROMIUM_OUT_DIR. Please build the program first!" |
| - else |
| - panic "Could not find any $1 directory under \ |
| -$CHROMIUM_SRC/$CHROMIUM_OUT_DIR. Check your build type!" |
| - fi |
| + panic "Could not find any build directory under \ |
|
pasko
2016/01/07 16:11:38
passing 2 params looks nicer:
if [[ -z "$SUBDIR"
agrieve
2016/01/08 02:07:30
Done.
|
| +$PARENT_DIR/{${SUBDIRS/ /,}}. Please build the program first!" |
|
pasko
2016/01/07 16:11:38
${SUBDIRS/ /,} would only replace the first space
agrieve
2016/01/08 02:07:30
Nope! Fixed.
|
| fi |
| - SYMBOL_DIR=$CHROMIUM_SRC/$CHROMIUM_OUT_DIR/$SUBDIR |
| + SYMBOL_DIR=$PARENT_DIR/$SUBDIR |
| log "Auto-config: --symbol-dir=$SYMBOL_DIR" |
| } |
| if [ -z "$SYMBOL_DIR" ]; then |
| - detect_symbol_dir "$BUILDTYPE" |
| + detect_symbol_dir |
| fi |
| # Allow several concurrent debugging sessions |