aboutsummaryrefslogtreecommitdiff
path: root/ndk-gdb
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-05-06 15:31:34 -0700
committerDavid 'Digit' Turner <digit@google.com>2010-05-06 15:31:34 -0700
commit2e063fe130190c48101e4150afee80802d0c7a3e (patch)
tree16555a68f60496614a2d0580298acbe72e16a59b /ndk-gdb
parentf78e926710927bb3f90b9ac3f97b6acec9357041 (diff)
downloadndk-2e063fe130190c48101e4150afee80802d0c7a3e.tar.gz
ndk-gdb: Improve detection of common user errors. Clarify some error messages.android-sdk-tools_r6
Change-Id: If72f42324848823a01cffcad56c304b5c7e46d7d
Diffstat (limited to 'ndk-gdb')
-rwxr-xr-xndk-gdb33
1 files changed, 29 insertions, 4 deletions
diff --git a/ndk-gdb b/ndk-gdb
index 23462bed8..8028068db 100755
--- a/ndk-gdb
+++ b/ndk-gdb
@@ -318,7 +318,7 @@ ADB_TEST=`$ADB_CMD shell ls`
if [ $? != 0 ] ; then
echo "ERROR: Could not connect to device or emulator!"
echo " Please check that an emulator is running or a device is connected"
- echo " through USB to this machine. You can use the -e, -d and -s <serial>"
+ echo " through USB to this machine. You can use -e, -d and -s <serial>"
echo " in case of multiple ones."
exit 1
fi
@@ -354,6 +354,28 @@ if [ "$COMPAT_ABI" = none ] ; then
fi
log "Compatible device ABI: $COMPAT_ABI"
+# Let's check that the user didn't change the debuggable flag in
+# the manifest without calling ndk-build afterwards.
+if [ ! -f $PROJECT/libs/$COMPAT_ABI/gdbserver ] ; then
+ echo "ERROR: Could not find gdbserver binary under $PROJECT/libs/$COMPAT_ABI"
+ echo " This usually means you modified your AndroidManifest.xml to set"
+ echo " the android:debuggable flag to 'true' but did not rebuild the"
+ echo " native binaries. Please call 'ndk-build' to do so,"
+ echo " *then* re-install to the device !"
+ exit 1
+fi
+
+# Let's check that 'gdbserver' is properly installed on the device too. If this
+# is not the case, the user didn't install the proper package after rebuilding.
+#
+DEVICE_GDBSERVER=`$ADB_CMD shell ls /data/data/$PACKAGE_NAME/lib/gdbserver`
+log "Found device gdbserver: $DEVICE_GDBSERVER"
+if pattern_match "No such file or directory" "$DEVICE_GDBSERVER" ] ; then
+ echo "ERROR: Non-debuggable application installed on the target device."
+ echo " Please re-install the debuggable version !"
+ exit 1
+fi
+
# Get information from the build system
GDBSETUP_INIT=`get_build_var_for_abi NDK_APP_GDBSETUP $COMPAT_ABI`
log "Using gdb setup init: $GDBSETUP_INIT"
@@ -416,9 +438,12 @@ log "Found running PID: $PID"
if [ $? != 0 -o "$PID" = "0" ] ; then
echo "ERROR: Could not extract PID of application on device/emulator."
if [ -n "$OPTION_LAUNCH" ] ; then
- echo " Weird, this probably means that the installed package does not"
- echo " match your current manifest. Try using the --verbose option and"
- echo " look at its output for details."
+ echo " Weird, this probably means one of these:"
+ echo ""
+ echo " - The installed package does not match your current manifest."
+ echo " - The application process was terminated."
+ echo ""
+ echo " Try using the --verbose option and look at its output for details."
else
echo " Are you sure the application is already started?"
echo " Consider using --start or --launch=<name> if not."