OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # android_gdbserver: Pushes gdbserver. Starts debugging environment. | 3 # android_gdbserver: Pushes gdbserver. Starts debugging environment. |
4 | 4 |
5 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 5 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
6 source $SCRIPT_DIR/android_setup.sh | 6 source $SCRIPT_DIR/android_setup.sh |
7 source $SCRIPT_DIR/utils/setup_adb.sh | 7 source $SCRIPT_DIR/utils/setup_adb.sh |
8 | 8 |
9 APP_NAME=${APP_ARGS[0]} | 9 APP_NAME=${APP_ARGS[0]} |
10 PORT=5039 | 10 PORT=5039 |
11 | 11 |
12 BUILD_DIR="${SKIA_OUT}/${BUILDTYPE}" | 12 BUILD_DIR="${SKIA_OUT}/${BUILDTYPE}" |
13 TARGET_LIBRARY="${BUILD_DIR}/lib/lib${APP_NAME}.so" | 13 TARGET_LIBRARY="${BUILD_DIR}/lib/lib${APP_NAME}.so" |
14 if [ ! -f "$TARGET_LIBRARY" ] | 14 if [ ! -f "$TARGET_LIBRARY" ] |
15 then | 15 then |
16 echo "Unable to find the ${APP_NAME} library at ${TARGET_LIBRARY}." | 16 echo "Unable to find the ${APP_NAME} library at ${TARGET_LIBRARY}." |
17 exit 1 | 17 exit 1 |
18 fi | 18 fi |
19 | 19 |
20 # We need the debug symbols from these files | 20 # We need the debug symbols from these files |
21 GDB_TMP_DIR=$(pwd)/android_gdb_tmp | 21 GDB_TMP_DIR=$(pwd)/android_gdb_tmp |
22 mkdir $GDB_TMP_DIR | 22 mkdir $GDB_TMP_DIR |
23 | 23 |
24 echo "Copying symbol files" | 24 echo "Copying symbol files" |
25 adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR | 25 SYSTEM_LIBRARY_PATH=/system/lib |
| 26 for library_file in \ |
| 27 libc.so \ |
| 28 libstdc++.so \ |
| 29 libm.so \ |
| 30 liblog.so \ |
| 31 libz.so \ |
| 32 libcutils.so \ |
| 33 libgccdemangle.so \ |
| 34 libcorkscrew.so \ |
| 35 libutils.so \ |
| 36 libstlport.so \ |
| 37 libGLES_trace.so \ |
| 38 libEGL.so \ |
| 39 libGLESv2.so \ |
| 40 ; do |
| 41 adb_pull_if_needed "${SYSTEM_LIBRARY_PATH}/${library_file}" $GDB_TMP_DIR |
| 42 done |
| 43 |
| 44 adb_pull_if_needed /system/bin/linker $GDB_TMP_DIR |
26 | 45 |
27 echo "Pushing app..." | 46 echo "Pushing app..." |
28 for file in \ | 47 for file in \ |
29 "${BUILD_DIR}/skia_launcher" \ | 48 "${BUILD_DIR}/skia_launcher" \ |
30 "${BUILD_DIR}/lib/libskia_android.so" \ | 49 "${BUILD_DIR}/lib/libskia_android.so" \ |
31 "${BUILD_DIR}/lib/lib${APP_NAME}.so" \ | 50 "${BUILD_DIR}/lib/lib${APP_NAME}.so" \ |
32 ; do | 51 ; do |
33 cp "$file" $GDB_TMP_DIR | 52 cp "$file" $GDB_TMP_DIR |
34 adb_push_if_needed "$file" /data/local/tmp | 53 adb_push_if_needed "$file" /data/local/tmp |
35 done | 54 done |
36 | 55 |
37 echo "Pushing gdbserver..." | 56 echo "Pushing gdbserver..." |
38 adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver data/local/tmp | 57 adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver data/local/tmp |
39 | 58 |
40 echo "Setting up port forward" | 59 echo "Setting up port forward" |
41 $ADB forward "tcp:5039" "tcp:5039" | 60 $ADB forward "tcp:5039" "tcp:5039" |
42 | 61 |
43 # Kill all previous instances of gdbserver and the app to rid all port overridin
g errors. | 62 # Kill all previous instances of gdbserver and the app to rid all port overridin
g errors. |
44 echo "Killing any running Skia processes." | 63 echo "Killing any running Skia processes." |
45 $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB shell kill | 64 $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB shell kill |
46 $ADB shell ps | grep ${APP_NAME} | awk '{print $2}' | xargs $ADB shell kill | 65 $ADB shell ps | grep ${APP_NAME} | awk '{print $2}' | xargs $ADB shell kill |
47 | 66 |
48 # Starting up gdbserver in android shell | 67 # Starting up gdbserver in android shell |
49 echo "Starting gdbserver with command: ${APP_ARGS[@]}" | 68 echo "Starting gdbserver with command: ${APP_ARGS[@]}" |
50 $ADB shell /data/local/tmp/gdbserver :5039 /data/local/tmp/skia_launcher ${APP_A
RGS[@]} & | 69 $ADB shell /data/local/tmp/gdbserver :5039 /data/local/tmp/skia_launcher ${APP_A
RGS[@]} & |
OLD | NEW |