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

Unified Diff: build/android/adb_gdb

Issue 1023703002: Let adb_gdb support privileged processes with a switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_gdb
diff --git a/build/android/adb_gdb b/build/android/adb_gdb
index c71b81646c155d40d688c35b89ec4c5c1aff82a2..3612f90991bd4c55a67fe092243c822829c8c053 100755
--- a/build/android/adb_gdb
+++ b/build/android/adb_gdb
@@ -97,6 +97,8 @@ NDK_DIR=
NO_PULL_LIBS=
PACKAGE_NAME=
PID=
+PRIVILEGED=
+PRIVILEGED_INDEX=
PROGRAM_NAME="activity"
PULL_LIBS=
PULL_LIBS_DIR=
@@ -145,6 +147,13 @@ for opt; do
--pid=*)
PID=$optarg
;;
+ --privileged)
+ PRIVILEGED=true
+ ;;
+ --privileged=*)
+ PRIVILEGED=true
+ PRIVILEGED_INDEX=$optarg
+ ;;
--program-name=*)
PROGRAM_NAME=$optarg
;;
@@ -236,8 +245,9 @@ EOF
cat <<EOF
This script is used to debug a running $PROGRAM_NAME process.
-This can be a regular Android application process, or a sandboxed
-service, if you use the --sandboxed or --sandboxed=<num> option.
+This can be a regular Android application process, sandboxed (if you use the
+--sandboxed or --sandboxed=<num> option) or a privileged (--privileged or
+--privileged=<num>) service.
This script needs several things to work properly. It will try to pick
them up automatically for you though:
@@ -304,6 +314,8 @@ Valid options:
--symbol-dir=<path> Specify directory with symbol shared libraries.
--out-dir=<path> Specify the out directory.
--package-name=<name> Specify package name (alternative to 1st argument).
+ --privileged Debug first privileged process we find.
+ --privileged=<num> Debug specific privileged process.
--program-name=<name> Specify program name (cosmetic only).
--pid=<pid> Specify application process pid.
--force Kill any previous debugging session, if any.
@@ -818,6 +830,12 @@ if [ -z "$PID" ]; then
PROCESSNAME=$PROCESSNAME:sandboxed_process
PID=$(adb_shell ps | \
awk '$9 ~ /^'$PROCESSNAME'/ { print $2; }' | head -1)
+ elif [ "$PRIVILEGED_INDEX" ]; then
+ PROCESSNAME=$PROCESSNAME:privileged_process$PRIVILEGED_INDEX
+ elif [ "$PRIVILEGED" ]; then
+ PROCESSNAME=$PROCESSNAME:privileged_process
+ PID=$(adb_shell ps | \
+ awk '$9 ~ /^'$PROCESSNAME'/ { print $2; }' | head -1)
fi
if [ -z "$PID" ]; then
PID=$(adb_shell ps | \
@@ -834,6 +852,8 @@ running? Try using --start."
log "Found process PID: $PID"
elif [ "$SANDBOXED" ]; then
echo "WARNING: --sandboxed option ignored due to use of --pid."
+elif [ "$PRIVILEGED" ]; then
+ echo "WARNING: --privileged option ignored due to use of --pid."
fi
# Determine if 'adb shell' runs as root or not.
« 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