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

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

Issue 1936163002: Update gdb_app script to work with NDK r11c (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« 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_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
(...skipping 10 matching lines...) Expand all
21 elif [ $(uname) == "Darwin" ]; then 21 elif [ $(uname) == "Darwin" ]; then
22 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs $AD B $DEVICE_SERIAL shell kill 22 $ADB $DEVICE_SERIAL shell ps | grep gdbserver | awk '{print $2}' | xargs $AD B $DEVICE_SERIAL shell kill
23 else 23 else
24 echo "Could not automatically determine OS!" 24 echo "Could not automatically determine OS!"
25 exit 1; 25 exit 1;
26 fi 26 fi
27 27
28 # We need the debug symbols from these files 28 # We need the debug symbols from these files
29 GDB_TMP_DIR=$SKIA_OUT/android_gdb_tmp 29 GDB_TMP_DIR=$SKIA_OUT/android_gdb_tmp
30 mkdir -p $GDB_TMP_DIR 30 mkdir -p $GDB_TMP_DIR
31 echo "Copying symbol files"
32 adb_pull_if_needed /system/bin/app_process $GDB_TMP_DIR
33 adb_pull_if_needed /system/lib/libc.so $GDB_TMP_DIR
34 adb_pull_if_needed /data/data/com.skia.sample_app/lib/libskia_android.so $GDB_TM P_DIR
35 adb_pull_if_needed /data/data/com.skia.sample_app/lib/libSampleApp.so $GDB_TMP_D IR
36 31
37 echo "Pushing gdbserver..." 32 echo "Pushing gdbserver..."
38 adb_push_if_needed $ANDROID_TOOLCHAIN/gdbserver /data/local/tmp 33 adb_push_if_needed $ANDROID_TOOLCHAIN/gdbserver /data/local/tmp
39 34
40 # Launch the app 35 # Launch the app
41 echo "Launching the app..." 36 echo "Launching the app..."
42 $ADB $DEVICE_SERIAL shell am start -n com.skia.sample_app/com.skia.SkiaSampleAct ivity 37 $ADB $DEVICE_SERIAL shell am start -n com.skia.sample_app/com.skia.SkiaSampleAct ivity
43 38
44 # Wait for app process to initialize 39 # Wait for app process to initialize
45 sleep 2 40 sleep 2
46 41
47 # Attach gdbserver to the app process 42 # Attach gdbserver to the app process
48 PID=$($ADB shell ps | grep com.skia.sample_app | awk '{print $2}') 43 PID=$($ADB shell ps | grep com.skia.sample_app | awk '{print $2}')
49 echo "Attaching to pid: $PID" 44 echo "Attaching to pid: $PID"
50 $ADB $DEVICE_SERIAL shell /data/local/tmp/gdbserver :$PORT --attach $PID & 45 $ADB $DEVICE_SERIAL shell /data/local/tmp/gdbserver :$PORT --attach $PID &
51 46
52 # Wait for gdbserver 47 # Wait for gdbserver
53 sleep 2 48 sleep 2
54 49
55 # Set up gdb commands 50 # Set up gdb commands
56 GDBSETUP=$GDB_TMP_DIR/gdb.setup 51 GDBSETUP=$GDB_TMP_DIR/gdb.setup
57 echo "file $GDB_TMP_DIR/app_process" >> $GDBSETUP
58 echo "target remote :$PORT" >> $GDBSETUP 52 echo "target remote :$PORT" >> $GDBSETUP
59 echo "set solib-absolute-prefix $GDB_TMP_DIR" >> $GDBSETUP 53
60 echo "set solib-search-path $GDB_TMP_DIR" >> $GDBSETUP
61 54
62 # Launch gdb client 55 # Launch gdb client
63 echo "Entering gdb client shell" 56 echo "Entering gdb client shell"
64 GDB_COMMAND=$(command ls "$ANDROID_TOOLCHAIN"/bin/*-gdb | head -n1) 57 ${ANDROID_TOOLCHAIN}/host_prebuilt/bin/gdb-orig -x $GDBSETUP
65 "$GDB_COMMAND" -x $GDBSETUP
66 58
67 # Clean up: 59 # Clean up:
68 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging 60 # We could 'rm -rf $GDB_TMP_DIR', but doing so would cause subsequent debugging
69 # sessions to take longer than necessary. The tradeoff is to now force the user 61 # sessions to take longer than necessary. The tradeoff is to now force the user
70 # to remove the directory when they are done debugging. 62 # to remove the directory when they are done debugging.
71 rm $GDBSETUP 63 rm $GDBSETUP
72 64
73 65
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