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

Side by Side Diff: build/android/adb_gdb

Issue 315223005: Fix adb_gdb --su-prefix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 --script=<file> Specify extra GDB init script. 313 --script=<file> Specify extra GDB init script.
314 314
315 --gdbserver=<file> Specify target gdbserver binary. 315 --gdbserver=<file> Specify target gdbserver binary.
316 --gdb=<file> Specify host gdb client binary. 316 --gdb=<file> Specify host gdb client binary.
317 --target-arch=<name> Specify NDK target arch. 317 --target-arch=<name> Specify NDK target arch.
318 --adb=<file> Specify host ADB binary. 318 --adb=<file> Specify host ADB binary.
319 319
320 --su-prefix=<prefix> Prepend <prefix> to 'adb shell' commands that are 320 --su-prefix=<prefix> Prepend <prefix> to 'adb shell' commands that are
321 run by this script. This can be useful to use 321 run by this script. This can be useful to use
322 the 'su' program on rooted production devices. 322 the 'su' program on rooted production devices.
323 e.g. --su-prefix="su -c"
323 324
324 --pull-libs Force system libraries extraction. 325 --pull-libs Force system libraries extraction.
325 --no-pull-libs Do not extract any system library. 326 --no-pull-libs Do not extract any system library.
326 --libs-dir=<path> Specify system libraries extraction directory. 327 --libs-dir=<path> Specify system libraries extraction directory.
327 328
328 --debug Use libraries under out/Debug. 329 --debug Use libraries under out/Debug.
329 --release Use libraries under out/Release. 330 --release Use libraries under out/Release.
330 331
331 EOF 332 EOF
332 exit 0 333 exit 0
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 if [ "$SU_PREFIX" ]; then 846 if [ "$SU_PREFIX" ]; then
846 # Need to check that this works properly. 847 # Need to check that this works properly.
847 SU_PREFIX_TEST_LOG=$TMPDIR/su-prefix.log 848 SU_PREFIX_TEST_LOG=$TMPDIR/su-prefix.log
848 adb_shell $SU_PREFIX echo "foo" > $SU_PREFIX_TEST_LOG 2>&1 849 adb_shell $SU_PREFIX echo "foo" > $SU_PREFIX_TEST_LOG 2>&1
849 if [ $? != 0 -o "$(cat $SU_PREFIX_TEST_LOG)" != "foo" ]; then 850 if [ $? != 0 -o "$(cat $SU_PREFIX_TEST_LOG)" != "foo" ]; then
850 echo "ERROR: Cannot use '$SU_PREFIX' as a valid su prefix:" 851 echo "ERROR: Cannot use '$SU_PREFIX' as a valid su prefix:"
851 echo "$ adb shell $SU_PREFIX echo foo" 852 echo "$ adb shell $SU_PREFIX echo foo"
852 cat $SU_PREFIX_TEST_LOG 853 cat $SU_PREFIX_TEST_LOG
853 exit 1 854 exit 1
854 fi 855 fi
855 COMMAND_PREFIX=$SU_PREFIX 856 COMMAND_PREFIX="$SU_PREFIX"
856 else 857 else
857 SHELL_UID=$(adb shell cat /proc/self/status | \ 858 SHELL_UID=$(adb shell cat /proc/self/status | \
858 awk '$1 == "Uid:" { print $2; }') 859 awk '$1 == "Uid:" { print $2; }')
859 log "Shell UID: $SHELL_UID" 860 log "Shell UID: $SHELL_UID"
860 if [ "$SHELL_UID" != 0 -o -n "$NO_ROOT" ]; then 861 if [ "$SHELL_UID" != 0 -o -n "$NO_ROOT" ]; then
861 COMMAND_PREFIX="run-as $PACKAGE_NAME" 862 COMMAND_PREFIX="run-as $PACKAGE_NAME"
862 else 863 else
863 COMMAND_PREFIX= 864 COMMAND_PREFIX=
864 fi 865 fi
865 fi 866 fi
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 988
988 if [ "$VERBOSE" -gt 0 ]; then 989 if [ "$VERBOSE" -gt 0 ]; then
989 echo "### START $COMMANDS" 990 echo "### START $COMMANDS"
990 cat $COMMANDS 991 cat $COMMANDS
991 echo "### END $COMMANDS" 992 echo "### END $COMMANDS"
992 fi 993 fi
993 994
994 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" 995 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS"
995 $GDB $GDB_ARGS -x $COMMANDS && 996 $GDB $GDB_ARGS -x $COMMANDS &&
996 rm -f "$GDBSERVER_PIDFILE" 997 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