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

Side by Side Diff: platform_tools/android/bin/android_gdb_app

Issue 1952323004: Initial commit of our new Android app to demo Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Style Created 4 years, 7 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
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # android_gdb_app: Pushes gdbserver, launches sampleApp, and connects 3 # android_gdb_app: Pushes gdbserver, launches sampleApp, and connects
4 # the debugging environment. 4 # the debugging environment.
5 5
6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7 source $SCRIPT_DIR/android_setup.sh "$@" 7 source $SCRIPT_DIR/android_setup.sh "$@"
8 8
9 APP_NAME=${APP_ARGS[0]} 9 APP_NAME=${APP_ARGS[0]}
10 PORT=5039 10 PORT=5039
11 11
12 PACKAGE="org.skia.viewer"
13 ACTIVITY="MainActivity"
djsollen 2016/05/06 18:45:26 checking in this change means we can no longer deb
14
15 echo "Debugging $PACKAGE.$ACTIVITY..."
16
12 source $SCRIPT_DIR/utils/setup_adb.sh 17 source $SCRIPT_DIR/utils/setup_adb.sh
13 18
14 19
15 # Forward local to remote socket connection. 20 # Forward local to remote socket connection.
16 $ADB $DEVICE_SERIAL forward "tcp:$PORT" "tcp:$PORT" 21 $ADB $DEVICE_SERIAL forward "tcp:$PORT" "tcp:$PORT"
17 22
18 # We kill all previous instances of gdbserver to rid all port overriding errors. 23 # We kill all previous instances of gdbserver to rid all port overriding errors.
19 if [ $(uname) == "Linux" ]; then 24 if [ $(uname) == "Linux" ]; then
20 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB $DEVICE_SERIAL shell kill 25 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB $DEVICE_SERIAL shell kill
21 elif [ $(uname) == "Darwin" ]; then 26 elif [ $(uname) == "Darwin" ]; then
22 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs $AD B $DEVICE_SERIAL shell kill 27 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs $AD B $DEVICE_SERIAL shell kill
23 else 28 else
24 echo "Could not automatically determine OS!" 29 echo "Could not automatically determine OS!"
25 exit 1; 30 exit 1;
26 fi 31 fi
27 32
28 # We need the debug symbols from these files 33 # We need the debug symbols from these files
29 GDB_TMP_DIR=$SKIA_OUT/android_gdb_tmp 34 GDB_TMP_DIR=$SKIA_OUT/android_gdb_tmp
30 mkdir -p $GDB_TMP_DIR 35 mkdir -p $GDB_TMP_DIR
31 36
32 echo "Pushing gdbserver..." 37 echo "Pushing gdbserver..."
33 adb_push_if_needed $ANDROID_TOOLCHAIN/gdbserver /data/local/tmp 38 adb_push_if_needed $ANDROID_TOOLCHAIN/gdbserver /data/local/tmp
34 39
35 # Launch the app 40 # Launch the app
36 echo "Launching the app..." 41 echo "Launching the app..."
37 $ADB $DEVICE_SERIAL shell am start -n com.skia.sample_app/com.skia.SkiaSampleAct ivity 42 $ADB $DEVICE_SERIAL shell am start -n $PACKAGE/.$ACTIVITY
38 43
39 # Wait for app process to initialize 44 # Wait for app process to initialize
40 sleep 2 45 sleep 2
41 46
42 # Attach gdbserver to the app process 47 # Attach gdbserver to the app process
43 PID=$($ADB shell ps | grep com.skia.sample_app | awk '{print $2}') 48 PID=$($ADB shell ps | grep $PACKAGE | awk '{print $2}')
44 echo "Attaching to pid: $PID" 49 echo "Attaching to pid: $PID"
45 $ADB $DEVICE_SERIAL shell /data/local/tmp/gdbserver :$PORT --attach $PID & 50 $ADB $DEVICE_SERIAL shell /data/local/tmp/gdbserver :$PORT --attach $PID &
46 51
47 # Wait for gdbserver 52 # Wait for gdbserver
48 sleep 2 53 sleep 2
49 54
50 # Set up gdb commands 55 # Set up gdb commands
51 GDBSETUP=$GDB_TMP_DIR/gdb.setup 56 GDBSETUP=$GDB_TMP_DIR/gdb.setup
52 echo "target remote :$PORT" >> $GDBSETUP 57 echo "target remote :$PORT" >> $GDBSETUP
53 58
54 59
55 # Launch gdb client 60 # Launch gdb client
56 echo "Entering gdb client shell" 61 echo "Entering gdb client shell"
57 ${ANDROID_TOOLCHAIN}/host_prebuilt/bin/gdb-orig -x $GDBSETUP 62 ${ANDROID_TOOLCHAIN}/host_prebuilt/bin/gdb-orig -x $GDBSETUP
58 63
59 # Clean up: 64 # Clean up:
60 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging 65 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging
61 # sessions to take longer than necessary. The tradeoff is to now force the user 66 # sessions to take longer than necessary. The tradeoff is to now force the user
62 # to remove the directory when they are done debugging. 67 # to remove the directory when they are done debugging.
63 rm $GDBSETUP 68 rm $GDBSETUP
64 69
65 70
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698