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 |
(...skipping 16 matching lines...) Expand all Loading... |
27 else | 27 else |
28 SYSTEM_LIBRARY_PATH=/system/lib | 28 SYSTEM_LIBRARY_PATH=/system/lib |
29 fi | 29 fi |
30 for library_file in \ | 30 for library_file in \ |
31 libc.so \ | 31 libc.so \ |
32 libstdc++.so \ | 32 libstdc++.so \ |
33 libm.so \ | 33 libm.so \ |
34 liblog.so \ | 34 liblog.so \ |
35 libz.so \ | 35 libz.so \ |
36 libgccdemangle.so \ | 36 libgccdemangle.so \ |
37 libcorkscrew.so \ | 37 libsigchain.so \ |
| 38 libcutils.so \ |
| 39 libunwind.so \ |
| 40 libunwind-ptrace.so \ |
| 41 libbacktrace.so \ |
38 libutils.so \ | 42 libutils.so \ |
39 libstlport.so \ | 43 libstlport.so \ |
40 libGLES_trace.so \ | 44 libGLES_trace.so \ |
41 libEGL.so \ | 45 libEGL.so \ |
42 libGLESv2.so \ | 46 libGLESv2.so \ |
43 ; do | 47 ; do |
44 adb_pull_if_needed "${SYSTEM_LIBRARY_PATH}/${library_file}" $GDB_TMP_DIR | 48 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld ${SYSTEM_LIBRARY_PATH}/${librar
y_file}` |
| 49 if [ "${ANDROID_LS:0:1}" == "-" ]; then |
| 50 adb_pull_if_needed "${SYSTEM_LIBRARY_PATH}/${library_file}" $GDB_TMP_DIR |
| 51 fi |
45 done | 52 done |
46 | 53 |
47 adb_pull_if_needed /system/bin/linker $GDB_TMP_DIR | 54 if [[ $ANDROID_ARCH == *64* ]]; then |
| 55 adb_pull_if_needed /system/bin/linker64 $GDB_TMP_DIR |
| 56 else |
| 57 adb_pull_if_needed /system/bin/linker $GDB_TMP_DIR |
| 58 fi |
48 | 59 |
49 echo "Pushing app..." | 60 echo "Pushing app..." |
50 for file in \ | 61 for file in \ |
51 "${BUILD_DIR}/skia_launcher" \ | 62 "${BUILD_DIR}/skia_launcher" \ |
52 "${BUILD_DIR}/lib/libskia_android.so" \ | 63 "${BUILD_DIR}/lib/libskia_android.so" \ |
53 "${BUILD_DIR}/lib/lib${APP_NAME}.so" \ | 64 "${BUILD_DIR}/lib/lib${APP_NAME}.so" \ |
54 ; do | 65 ; do |
55 cp "$file" $GDB_TMP_DIR | 66 cp "$file" $GDB_TMP_DIR |
56 adb_push_if_needed "$file" /data/local/tmp | 67 adb_push_if_needed "$file" /data/local/tmp |
57 done | 68 done |
58 | 69 |
59 echo "Pushing gdbserver..." | 70 echo "Pushing gdbserver..." |
60 adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver /data/local/tmp | 71 adb_push_if_needed $ANDROID_TOOLCHAIN/../gdbserver /data/local/tmp |
61 | 72 |
62 echo "Setting up port forward" | 73 echo "Setting up port forward" |
63 $ADB forward "tcp:5039" "tcp:5039" | 74 $ADB forward "tcp:5039" "tcp:5039" |
64 | 75 |
65 # Kill all previous instances of gdbserver and the app to rid all port overridin
g errors. | 76 # Kill all previous instances of gdbserver and the app to rid all port overridin
g errors. |
66 echo "Killing any running Skia processes." | 77 echo "Killing any running Skia processes." |
67 $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB shell kill | 78 $ADB shell ps | grep gdbserver | awk '{print $2}' | xargs $ADB shell kill |
68 $ADB shell ps | grep ${APP_NAME} | awk '{print $2}' | xargs $ADB shell kill | 79 $ADB shell ps | grep ${APP_NAME} | awk '{print $2}' | xargs $ADB shell kill |
69 | 80 |
70 # Starting up gdbserver in android shell | 81 # Starting up gdbserver in android shell |
71 echo "Starting gdbserver with command: ${APP_ARGS[@]}" | 82 echo "Starting gdbserver with command: ${APP_ARGS[@]}" |
72 $ADB shell LD_LIBRARY_PATH=/data/local/tmp:\$LD_LIBRARY_PATH /data/local/tmp/gdb
server :5039 /data/local/tmp/skia_launcher ${APP_ARGS[@]} & | 83 $ADB shell LD_LIBRARY_PATH=/data/local/tmp:\$LD_LIBRARY_PATH /data/local/tmp/gdb
server :5039 /data/local/tmp/skia_launcher ${APP_ARGS[@]} & |
OLD | NEW |