Eclipse / Cygwin
使用NDK 8c编译共享库时,我无法启动gdbserver。在切换到armeabi-v7a后,我在网上搜索了几个小时,但找不到一个特别处理armeabi-v7a调试问题的主题。
由于使用了依赖于armeabi-v7a的第三方库,我别无选择而必须切换到它。如果没有它,我会遇到这种类型的错误:
D:\TEMP\ccnnGAqD.s:10427: Error: selected processor does not support Thumb mode `ldrex r6,[r3]'
D:\TEMP\ccnnGAqD.s:10429: Error: selected processor does not support Thumb mode `strex r4,r5,[r3]'
在使用'armeabi'的情况下,一切都正常工作,使用此设置:http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/。我所做的唯一更改是将其添加到Application.mk:
APP_ABI := armeabi-v7a
在共享库Android.mk的底部,我添加了以下内容:
$(info TARGET_ARCH = $(TARGET_ARCH))
$(info TARGET_ARCH_ABI = $(TARGET_ARCH_ABI))
$(info TARGET_ABI = $(TARGET_ABI))
它输出以下内容:
TARGET_ARCH = arm
TARGET_ARCH_ABI = armeabi-v7a
TARGET_ABI = android-14-armeabi-v7a
我使用以下步骤卸载了该应用:
adb uninstall com.example.game
AndroidManifest.xml有android:debuggable="true"属性。
在Eclipse中完成了“clean all”操作,并手动删除了./libs和./obj文件夹。然后,ndk-build将输出到正确的文件夹(obj/local/armeabi-v7a和libs/armeabi-v7a),而obj/local/armeabi和libs/armeabi不存在。
但是,当我运行ndk-gdb时会发生以下情况:
user@MACHINENAME /cygdrive/e/projects/game
$ ndk-gdb-eclipse --force --verbose
Android NDK installation path: /cygdrive/e/projects/sdks/android-ndk
Using default adb command: /cygdrive/e/projects/sdks/android-sdk/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.31
Using ADB flags:
Using auto-detected project path: .
Found package name: com.example.game
ABIs targetted by application: armeabi
Device API Level: 15
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /cygdrive/e/projects/sdks/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found debuggable flag: true
ERROR: Could not find gdbserver binary under ./libs/armeabi
This usually means you modified your AndroidManifest.xml to set
the android:debuggable flag to 'true' but did not rebuild the
native binaries. Please call 'ndk-build' to do so,
*then* re-install to the device!
注意应用程序所针对的“ABIs”,使用了错误的“armeabi”。以下是ndk-gdb的相关部分:
get_build_var ()
{
if [ -z "$GNUMAKE" ] ; then
GNUMAKE=make
fi
$GNUMAKE --no-print-dir -f $ANDROID_NDK_ROOT/build/core/build-local.mk -C $PROJECT DUMP_$1 | tail -1
}
APP_ABIS=`get_build_var APP_ABI`
if [ "$APP_ABIS" != "${APP_ABIS%%all*}" ] ; then
# replace first "all" with all available ABIs
ALL_ABIS=`get_build_var NDK_ALL_ABIS`
APP_ABIS_FRONT="${APP_ABIS%%all*}"
APP_ABIS_BACK="${APP_ABIS#*all}"
APP_ABIS="${APP_ABIS_FRONT}${ALL_ABIS}${APP_ABIS_BACK}"
fi
log "ABIs targetted by application: $APP_ABIS"
我在Application.mk中明确将APP_ABI设置为armeabi-v7a,那么这是NDK的错误吗?还是我漏了什么东西?
ndk-build DUMP_APP_ABI
命令来构建你的项目吗? - Alex Cohnndk-build
,然后立即运行 ndk-gdb? - Alex Cohnconfig/<buildConfig>/Application.mk
是单行代码吗?Android.mk
中是否有依赖于<buildConfig>
的某些逻辑?你应该向当前的<buildConfig>
通知你的ndk-gdb
... - Alex CohnApplication.mk
文件中有条件语句,检查我在调用ndk-build
时传递的BUILD_CONFIG
变量。构建工作正常,但我无法调试ARMEABI-V7A构建。如果我调用ndk-build DUMP_APP_ABI
,结果会得到aremeabi
。非常感谢您提供任何指针! - user1222021