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

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

Issue 164773002: fix debugging script for the SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 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 # android_gdb: Pushes parameter binary and gdbserver. Connects 3 # android_gdb: Pushes parameter binary and gdbserver. Connects
4 # and enters debugging environment. 4 # and enters 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 source $SCRIPT_DIR/utils/setup_adb.sh 12 source $SCRIPT_DIR/utils/setup_adb.sh
13 13
14 echo "Installing Skia Android app"
15 $SCRIPT_DIR/android_install_skia_apk -f
16 14
17 # Forward local to remote socket connection. 15 # Forward local to remote socket connection.
18 $ADB forward "tcp:$PORT" "tcp:$PORT" 16 $ADB forward "tcp:$PORT" "tcp:$PORT"
19 17
20 # We kill all previous instances of gdbserver to rid all port overriding errors. 18 # We kill all previous instances of gdbserver to rid all port overriding errors.
21 $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB shell kill 19 $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs -r $ADB shell kill
22 20
23 # We need the debug symbols from these files 21 # We need the debug symbols from these files
24 GDB_TMP_DIR=$(pwd)/android_gdb_tmp 22 GDB_TMP_DIR=$(pwd)/android_gdb_tmp
25 mkdir -p $GDB_TMP_DIR 23 mkdir -p $GDB_TMP_DIR
26 echo "Copying symbol files" 24 echo "Copying symbol files"
27 adb_pull_if_needed /system/bin/app_process $GDB_TMP_DIR 25 adb_pull_if_needed /system/bin/app_process $GDB_TMP_DIR
28 adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR 26 adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR
29 adb_pull_if_needed /data/data/com.skia/lib/libskia_android.so $GDB_TMP_DIR 27 adb_pull_if_needed /data/data/com.skia/lib/libskia_android.so $GDB_TMP_DIR
30 adb_pull_if_needed /data/data/com.skia/lib/libSampleApp.so $GDB_TMP_DIR 28 adb_pull_if_needed /data/data/com.skia/lib/libSampleApp.so $GDB_TMP_DIR
31 29
30 echo "Pushing gdbserver..."
31 adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver /data/local/tmp
32
32 # Launch the app 33 # Launch the app
33 SK_COMMAND="$APP_ARGS" 34 SK_COMMAND="$APP_ARGS"
34 echo "Running command $SK_COMMAND" 35 echo "Running command $SK_COMMAND"
35 adb shell am start -n com.skia/com.skia.SkiaSampleActivity 36 adb shell am start -n com.skia/com.skia.SkiaSampleActivity
36 37
37 # Attach gdbserver to the app process 38 # Attach gdbserver to the app process
38 PID=$($ADB shell ps | grep com.skia | awk '{print $2}') 39 PID=$($ADB shell ps | grep com.skia | awk '{print $2}')
39 echo "Attaching to pid: $PID" 40 echo "Attaching to pid: $PID"
40 $ADB shell /data/data/com.skia/lib/gdbserver :$PORT --attach $PID & 41 $ADB shell /data/local/tmp/gdbserver :$PORT --attach $PID &
41 42
42 # Wait for gdbserver 43 # Wait for gdbserver
43 sleep 2 44 sleep 2
44 45
45 # Set up gdb commands 46 # Set up gdb commands
46 GDBSETUP=$GDB_TMP_DIR/gdb.setup 47 GDBSETUP=$GDB_TMP_DIR/gdb.setup
47 echo "file $GDB_TMP_DIR/app_process" >> $GDBSETUP 48 echo "file $GDB_TMP_DIR/app_process" >> $GDBSETUP
48 echo "target remote :$PORT" >> $GDBSETUP 49 echo "target remote :$PORT" >> $GDBSETUP
49 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP 50 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP
50 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP 51 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP
51 52
52 # Launch gdb client 53 # Launch gdb client
53 echo "Entering gdb client shell" 54 echo "Entering gdb client shell"
54 if [ "$ANDROID_ARCH" == "x86" ] 55 if [ "$ANDROID_ARCH" == "x86" ]
55 then 56 then
56 $ANDROID_TOOLCHAIN/i686-linux-android-gdb -x $GDBSETUP 57 $ANDROID_TOOLCHAIN/i686-linux-android-gdb -x $GDBSETUP
57 else 58 else
58 $ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP 59 $ANDROID_TOOLCHAIN/arm-linux-androideabi-gdb -x $GDBSETUP
59 fi 60 fi
60 61
61 # Clean up 62 # Clean up
62 rm -rf $GDB_TMP_DIR 63 rm -rf $GDB_TMP_DIR
63 64
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