2013-02-08 07:59:23 +01:00
|
|
|
#!/bin/bash
|
2013-02-08 08:18:21 +01:00
|
|
|
THIS_LOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
# Get native library path on host
|
|
|
|
nativelib=$1
|
|
|
|
if [ -z "$nativelib" ]; then
|
|
|
|
echo "Native library was not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ ! -f "$nativelib" ]; then
|
|
|
|
echo "Specified '$nativelib' native library can not be found."
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-02-08 07:59:23 +01:00
|
|
|
|
|
|
|
# Get pid of our process
|
|
|
|
pid=`adb shell ps | grep 'net.osmand' | head -n1 | awk '{print $2}'`
|
|
|
|
package=`adb shell ps | grep 'net.osmand' | head -n1 | awk '{print $9}'`
|
|
|
|
echo "OsmAnd package: $package"
|
|
|
|
echo "OsmAnd pid: $pid"
|
|
|
|
|
|
|
|
# Launch gdbserver on target
|
|
|
|
adb shell run-as $package /data/data/$package/lib/gdbserver :5039 --attach $pid &
|
|
|
|
|
2013-03-11 08:12:12 +01:00
|
|
|
# Forward port
|
|
|
|
adb forward tcp:5039 tcp:5039
|
|
|
|
|
2013-02-08 07:59:23 +01:00
|
|
|
# Launch gdb on host
|
2013-03-11 08:12:12 +01:00
|
|
|
echo "Execute manually in gdb: target remote :5039"
|
2013-02-08 08:18:21 +01:00
|
|
|
"$ANDROID_NDK/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-gdb" $nativelib
|