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

Side by Side Diff: build/android/adb_gdb

Issue 2295103002: Fixing the pushing gdbserver problem while setting --su-prefix="su -c" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
11 # 11 #
12 # Use --help to print full usage instructions. 12 # Use --help to print full usage instructions.
13 # 13 #
14 14
15 PROGNAME=$(basename "$0") 15 PROGNAME=$(basename "$0")
16 PROGDIR=$(dirname "$0") 16 PROGDIR=$(dirname "$0")
17 17
18 # Force locale to C to allow recognizing output from subprocesses. 18 # Force locale to C to allow recognizing output from subprocesses.
19 LC_ALL=C 19 LC_ALL=C
20 20
21 # Location of Chromium-top-level sources. 21 # Location of Chromium-top-level sources.
22 CHROMIUM_SRC=$(cd "$PROGDIR"/../.. >/dev/null && pwd 2>/dev/null) 22 CHROMIUM_SRC=$(cd "$PROGDIR"/../.. >/dev/null && pwd 2>/dev/null)
23 23
24 TMPDIR= 24 TMPDIR=
25 GDBSERVER_PIDFILE= 25 GDBSERVER_PIDFILE=
26 TARGET_GDBSERVER= 26 TARGET_GDBSERVER=
27 COMMAND_PREFIX= 27 COMMAND_PREFIX=
28 COMMAND_SUFFIX=
28 29
29 clean_exit () { 30 clean_exit () {
30 if [ "$TMPDIR" ]; then 31 if [ "$TMPDIR" ]; then
31 GDBSERVER_PID=$(cat $GDBSERVER_PIDFILE 2>/dev/null) 32 GDBSERVER_PID=$(cat $GDBSERVER_PIDFILE 2>/dev/null)
32 if [ "$GDBSERVER_PID" ]; then 33 if [ "$GDBSERVER_PID" ]; then
33 log "Killing background gdbserver process: $GDBSERVER_PID" 34 log "Killing background gdbserver process: $GDBSERVER_PID"
34 kill -9 $GDBSERVER_PID >/dev/null 2>&1 35 kill -9 $GDBSERVER_PID >/dev/null 2>&1
35 fi 36 fi
36 if [ "$TARGET_GDBSERVER" ]; then 37 if [ "$TARGET_GDBSERVER" ]; then
37 log "Removing target gdbserver binary: $TARGET_GDBSERVER." 38 log "Removing target gdbserver binary: $TARGET_GDBSERVER."
38 "$ADB" shell "$COMMAND_PREFIX" rm "$TARGET_GDBSERVER" >/dev/null 2>&1 39 "$ADB" shell "$COMMAND_PREFIX" rm "$TARGET_GDBSERVER" "$COMMAND_SUFFIX" >/ dev/null 2>&1
39 fi 40 fi
40 log "Cleaning up: $TMPDIR" 41 log "Cleaning up: $TMPDIR"
41 rm -rf "$TMPDIR" 42 rm -rf "$TMPDIR"
42 fi 43 fi
43 trap "" EXIT 44 trap "" EXIT
44 exit $1 45 exit $1
45 } 46 }
46 47
47 # Ensure clean exit on Ctrl-C or normal exit. 48 # Ensure clean exit on Ctrl-C or normal exit.
48 trap "clean_exit 1" INT HUP QUIT TERM 49 trap "clean_exit 1" INT HUP QUIT TERM
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 grep -v "^$" | tr '\n' ':') 914 grep -v "^$" | tr '\n' ':')
914 915
915 # This is a re-implementation of gdbclient, where we use compatible 916 # This is a re-implementation of gdbclient, where we use compatible
916 # versions of gdbserver and $GDBNAME to ensure that everything works 917 # versions of gdbserver and $GDBNAME to ensure that everything works
917 # properly. 918 # properly.
918 # 919 #
919 920
920 # Push gdbserver to the device 921 # Push gdbserver to the device
921 log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER" 922 log "Pushing gdbserver $GDBSERVER to $TARGET_GDBSERVER"
922 adb push $GDBSERVER $TMP_TARGET_GDBSERVER &>/dev/null 923 adb push $GDBSERVER $TMP_TARGET_GDBSERVER &>/dev/null
923 adb shell $COMMAND_PREFIX cp $TMP_TARGET_GDBSERVER $TARGET_GDBSERVER 924 adb shell $COMMAND_PREFIX cp $TMP_TARGET_GDBSERVER $TARGET_GDBSERVER $COMMAND_SU FFIX
924 adb shell rm $TMP_TARGET_GDBSERVER 925 adb shell rm $TMP_TARGET_GDBSERVER
925 fail_panic "Could not copy gdbserver to the device!" 926 fail_panic "Could not copy gdbserver to the device!"
926 927
927 if [ -z "$PORT" ]; then 928 if [ -z "$PORT" ]; then
928 PORT=5039 929 PORT=5039
929 fi 930 fi
930 HOST_PORT=$PORT 931 HOST_PORT=$PORT
931 TARGET_PORT=$PORT 932 TARGET_PORT=$PORT
932 933
933 # Select correct app_process for architecture. 934 # Select correct app_process for architecture.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1032
1032 if [ "$VERBOSE" -gt 0 ]; then 1033 if [ "$VERBOSE" -gt 0 ]; then
1033 echo "### START $COMMANDS" 1034 echo "### START $COMMANDS"
1034 cat $COMMANDS 1035 cat $COMMANDS
1035 echo "### END $COMMANDS" 1036 echo "### END $COMMANDS"
1036 fi 1037 fi
1037 1038
1038 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS" 1039 log "Launching gdb client: $GDB $GDB_ARGS -x $COMMANDS"
1039 $GDB $GDB_ARGS -x $COMMANDS && 1040 $GDB $GDB_ARGS -x $COMMANDS &&
1040 rm -f "$GDBSERVER_PIDFILE" 1041 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