Android NDK调试:armeabi-v7a不工作 [英] Android NDK debugging: armeabi-v7a not working

查看:307
本文介绍了Android NDK调试:armeabi-v7a不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse / Cygwin



NDK 8c



建立共用资料库



在切换到armeabi-v7a后,我无法获取gdbserver启动。我在线搜索了几个小时,但找不到专门处理armeabi-v7a调试问题的主题。



我无法切换到armeabi-v7a使用依赖于它的第三方库。没有它,我得到这样的错误:

  D:\TEMP\ccnnGAqD.s:10427:处理器不支持Thumb模式`ldrex r6,[r3]'
D:\TEMP\ccnnGAqD.s:10429:错误:所选处理器不支持Thumb模式`strex r4,r5,[r3]

使用这个设置,在'armeabi'之前所有工作都很好: http://mhandroid.wordpress.com/2011/01/23/使用-eclipse-for-android-cc-development /



我做的唯一的改变是添加到Application.mk:

  APP_ABI:= armeabi-v7a 


b $ b

在共享库Android.mk的最底部,我添加了:

  $(info TARGET_ARCH = $(TARGET_ARCH))
$(信息TARGET_ARCH_ABI = $(TARGET_ARCH_ABI))
$(信息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中执行全部清除 ,并手动删除./libs和./obj文件夹。然后,ndk-build输出到正确的文件夹(obj / local / armeabi-v7a和libs / armeabi-v7a)和obj / local / armeabi和libs / armeabi 不存在。 >

但是,这里是当我运行ndk-gdb会发生什么:

  MACHINENAME / cygdrive / e / projects / game 
$ ndk-gdb-eclipse --force --verbose
Android NDK安装路径:/ cygdrive / e / projects / sdks / android-ndk
使用默认adb命令:/ cygdrive / e / projects / sdks / android-sdk / platform-tools / adb
找到的ADB版本:Android Debug Bridge版本1.0.31
使用ADB标志:
使用自动检测的项目路径:。
找到的软件包名称:com.example.game
应用程序定义的ABI:armeabi
设备API级别:15
设备CPU ABI:armeabi-v7a armeabi
兼容设备ABI:armeabi
使用gdb setup init:./libs/armeabi/gdb.setup
使用工具链前缀:/ cygdrive / e / projects / sdks / android-ndk / toolchains / arm-linux-androideabi- 4.6 / prebuilt / windows / bin / arm-linux-androideabi-
使用应用程序输出目录:./obj/local/armeabi
找到debuggable标志:true
错误:找不到gdbserver二进制under ./libs/armeabi
这通常意味着您修改了AndroidManifest.xml以将
的android:debuggable标记设置为true,但没有重建
原生二进制文件。请调用'ndk-build'这样做,
*然后*重新安装到设备!

请注意应用程序定义的ABI使用错误的armeabi。这是ndk-gdb的相关部分:

  get_build_var()
{
if [-z $ GNUMAKE];然后
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 *}];然后
#用所有可用的ABI替换第一个all
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
日志ABIs由应用程序定向:$ APP_ABIS

我在Application.mk中清楚地设置了APP_ABI到armeabi-v7a,那么这是NDK中的一个错误吗?

解决方案

我有同样的问题。我配置eclipse下面这篇文章:
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/
然后我从armeabi更改为armeabi-v7a。



我修复了此问题:

1)您必须修复调试配置中的文件夹




  • 主标签页更改... obj / local / armeabi / app_process to ... obj / local / armeabi-v7a / app_process

  • 调试器选项卡更改... obj / local / armeabi / gdb2.setup到obj / local / armeabi-v7a / gdb2.setup

  • 调试器选项卡更改... /工具链/ arm-linux-androideabi-4.4 / prebuilt / linux-x86_64 / bin / arm-linux-androideabi-gdb到工具链/ androideabi-gdb



2)可能这是解决方法,但它工作。在调试配置 - >调试器 - >共享库添加/ obj / local / armeabi-v7a并选中自动加载共享库符号


Eclipse / Cygwin

NDK 8c

Building a shared library

I can't get gdbserver to start anymore after switching to armeabi-v7a. I've searched online for hours but can't find a topic that deals specifically with armeabi-v7a debugging issues.

I have no choice to switch to armeabi-v7a due to using a third party library which depends on it. Without it, I get these kind of errors:

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]'

It was all working fine before with 'armeabi', using this setup: http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/

The only change I've made is to add this to Application.mk:

APP_ABI := armeabi-v7a

At the very bottom of the shared library Android.mk I added this:

$(info TARGET_ARCH     = $(TARGET_ARCH))
$(info TARGET_ARCH_ABI = $(TARGET_ARCH_ABI))
$(info TARGET_ABI      = $(TARGET_ABI))

which outputs the following:

TARGET_ARCH     = arm
TARGET_ARCH_ABI = armeabi-v7a
TARGET_ABI      = android-14-armeabi-v7a

I've uninstalled the app using

adb uninstall com.example.game

AndroidManifest.xml does have the android:debuggable="true" property.

Done a "clean all" in Eclipse, and manually deleted the ./libs and ./obj folders. Then, ndk-build outputs to the right folders (obj/local/armeabi-v7a and libs/armeabi-v7a), and obj/local/armeabi and libs/armeabi do not exist.

However, here's what happens when I run 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!

Notice the "ABIs targetted by application" using the wrong 'armeabi'. Here's the relevant part of 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"

I clearly set APP_ABI to armeabi-v7a in Application.mk, so is this a bug in the NDK? Or am I missing something?

解决方案

I had the same issue. I configured eclipse following this article: http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/ Then I change from armeabi to armeabi-v7a. Then I couldn't debug.

I fixed this issue:
1) You must fix the folders in "Debug configurations"

  • Main tab change ...obj/local/armeabi/app_process to ...obj/local/armeabi-v7a/app_process
  • Debugger tab change ...obj/local/armeabi/gdb2.setup to obj/local/armeabi-v7a/gdb2.setup
  • Debugger tab change .../toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb to toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb

2) May be this is workaround but it works. In "Debug configurations" ->Debugger->Shared Libraries add /obj/local/armeabi-v7a and check "Load shared library symbols automatically"

这篇关于Android NDK调试:armeabi-v7a不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆