我有两个Android项目:一个是库,另一个是使用此库的常规应用程序.我的目标是从Android应用程序调试共享库.我按照这个指南:
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
我评论了最后一行
##$GDBCLIENT -x `native_path $GDBSETUP`
Run Code Online (Sandbox Code Playgroud)
但是以下一行
##cp -f $GDBSETUP_INIT $GDBSETUP
Run Code Online (Sandbox Code Playgroud)
抱怨信息:
it cannot stat ./libs/armeabi-v7a/gdb.setup
所以我评论了它,因为我认为Eclipse会为我上传它.除此之外,我确保:
在Android.mk中我放了LOCAL_CFLAGS:= -Wall -g
我在应用程序的libs库中获取.so
我在应用程序中使debuggable为true
修改了gdb2.setup路径,以便使用solib-search-path ./libs/armeabi-v7a/引用.so,并使用目录引用源代码
在单步执行System.LoadLibrary指令后,我执行了ndk-build-eclipse并且没有产生错误,当我开始本地调试时,我得到了:
无法访问地址0x1处的内存
在Cygwin上我得到了:
从主机0.0.0.0远程调试
这是运行ndk-gdb-eclipse命令的输出:
$ ./ndk-gdb-eclipse --adb=/cygdrive/c/Utilities/adt-bundle-windows/adt-bundle-windows/sdk/platform-tools/adb --project=/cygdrive/c/Projects/IDSmart/IDSmartApp/IDSmart --force --port=5039 --verbose
Android NDK installation path: /cygdrive/c/Utilities/android-ndk-r8c-windows/android-ndk-r8c/.
Using specific adb command: /cygdrive/c/Utilities/adt-bundle-windows/adt-bundle-windows/sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using specified project path: /cygdrive/c/Projects/IDSmart/IDSmartApp/IDSmart
Found package name: uk.co.idscan.idsmart
ABIs targetted by application: armeabi-v7a
Device API Level: 15
Device CPU ABIs: armeabi-v7a …Run Code Online (Sandbox Code Playgroud)