运行NDK-GDB带包装没有发现的摩托罗拉手机上的错误 [英] Running ndk-gdb with package not found error on motorola phone

查看:357
本文介绍了运行NDK-GDB带包装没有发现的摩托罗拉手机上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我想要与NDK-GDB调试C ++的Andr​​oid应用程序。该应用程序使用多个线程,但NDK的所谓R5支持多线程。此外,我还没有得到到启动gdb的地步。我运行命令:

  NDK-GDB --start --force --verbose

然后,它发现了NDK和SDK(或至少ADB)和所需的ABI和诸如此类的东西正确的路径。

  $ NDK-GDB --start --force --verbose
Android的NDK安装路径:/家庭/雷夫/月食/ Android的NDK-R5B
使用默认ADB命令:/家庭/雷夫/月食/ Android的SDK-linux_86 /平台工具/ ADB
发现ADB版本:Android的调试桥版本1.0.26
最后使用ADB命令:'/家庭/雷夫/月食/ Android的SDK-linux_86 /平台工具/亚行'
使用自动检测到的项目路径。
发现包名:net.leifandersen.mobile.android.marblemachine
ABI的按应用针对性:armeabi
设备API等级:10
设备CPU的ABI:armeabi-V7A armeabi
兼容设备ABI:armeabi

据然后查找GDB服务器,并认为,包括正确的PID,随后开始活动。

不过,它告诉我,该包无法找到:

 设置网络重定向
##命令:/家庭/雷夫/月食/ Android的SDK-linux_86 /平台的工具/ ADB shell中运行,为<包名称> LIB / gdbserver的调试+插座--attach 16040
##命令:/家庭/雷夫/月食/ Android的SDK-linux_86 /平台的工具/ ADB转发TCP:5039 localfilesystem:运行方式:包'<包名称>'未知/调试插座

然后,它吐出来,如果​​你不当使用adb(帮助文件),其次是你会得到什么:

 错误:无法安装网络重定向GDBSERVER?
       也许使用--port =<港口>使用不同的TCP端口可能会帮助?
运行方式:包'<包名称>'不明

我看着/data/system/packages.list,是的,我的APK肯定是在那里,它指向的位置是​​在文件系统上是正确的。所以这不是问题。

本教程:<一href=\"http://vilimpoc.org/blog/2010/09/23/hello-gdbserver-a-debuggable-jni-example-for-android/\">http://vilimpoc.org/blog/2010/09/23/hello-gdbserver-a-debuggable-jni-example-for-android/建议删除并重新安装,以及清洁您的Eclipse构建。

我没有使用Eclipse来构建软件包,但我没有干净的所有的东西,从头编译,删除并重新安装到没有运气。

有没有人有类似的问题,以及你是如何解决的?谢谢你。

编辑:哦,我已经尝试了不同的端口无济于事,似乎没有要上5039(默认端口)反正任何事情。而据我所知,我没有阻止该连接的任何防火墙。我在Ubuntu 11.04开发也是如此。

EDIT2:嗯...这看起来像新的NDK(R5C),错误消息已经改变过:

 错误:无法提取数据包的数据目录。你确定
       您安装的应用程序调试的?

是的,可调试设置为true在清单,和所有的本地code是建有:

  LOCAL_CFLAGS:= -Wall -g
LOCAL_LDFLAGS:=轮候册, - 地图,xxx.map


解决方案

 运行方式:包'net.leifandersen.mobile.android.marblemachine'未知

因此​​,很不幸,你的设备是不能够与NDK-gdb的使用,因为运行作为不起作用。如果你想使用该设备,必须具有根权限。

编辑:

修改NDK-gdb的脚本来摆脱运行的依赖。它仅适用于root权限(亚行外壳WHOAMI'应该是'根')

  --- NDK-GDB 2011-02-24 16:55:07.000000000 0900
+++ NDK-GDB根2011-06-09 08:35:04.000000000 0900
@@ -465,7 +465,7 @@
 登录使用应用了目录:$ APP_OUT #找的&lt;&DATADIR GT;封装在装置上的
-DATA_DIR =`adb_shell运行为$ PACKAGE_NAME /系统/ bin / sh的-c pwd`
+ DATA_DIR =/数据/数据​​/ $ PACKAGE_NAME
 登录找到数据目录:$ DATA_DIR'
 如果[$? != 0 -o -z$ DATA_DIR];然后
     回声错误:无法提取数据包的数据目录确定这一点。
@@ -543,7 +543,7 @@ 现在推出#gdbserver的
 DEBUG_SOCKET =调试插座
-run $ ADB_CMD shell中运行,如$ PACKAGE_NAME的lib / gdbserver的+ $ DEBUG_SOCKET --attach $ PID和放大器;
+运行$ ADB_CMD壳(CD $ DATA_DIR; LIB / gdbserver的+ $ DEBUG_SOCKET --attach $ PID)&放大器;
 如果[$? != 0];然后
     回声错误:无法启动gdbserver的设备上?
     1号出口

I have a C++ Android application that I'm trying to debug with ndk-gdb. The application does use multiple threads, but supposedly r5 of the ndk supports multiple threads. Also, I'm not even getting to the point where gdb starts up. I run the command:

ndk-gdb --start --force --verbose

It then finds the proper path for the ndk and sdk (or at least adb), and the needed ABIs and whatnot.

$ ndk-gdb --start --force --verbose
Android NDK installation path: /home/leif/eclipse/android-ndk-r5b
Using default adb command: /home/leif/eclipse/android-sdk-linux_86/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.26
Using final ADB command: '/home/leif/eclipse/android-sdk-linux_86/platform-tools/adb'
Using auto-detected project path: .
Found package name: net.leifandersen.mobile.android.marblemachine
ABIs targetted by application: armeabi
Device API Level: 10
Device CPU ABIs: armeabi-v7a armeabi
Compatible device ABI: armeabi

It then looks for gdb server, and finds it, including the proper PID, followed by starting the activity.

But then, it tells me that the the package cannot be found:

Setup network redirection
## COMMAND: /home/leif/eclipse/android-sdk-linux_86/platform-tools/adb shell run-as <package name> lib/gdbserver +debug-socket --attach 16040
## COMMAND: /home/leif/eclipse/android-sdk-linux_86/platform-tools/adb forward tcp:5039 localfilesystem:run-as: Package '<package name>' is unknown/debug-socket

It then spits out what you would get if you improperly use adb (the help file), followed by:

ERROR: Could not setup network redirection to gdbserver?
       Maybe using --port=<port> to use a different TCP port might help?
run-as: Package '<package name>' is unknown

I looked into /data/system/packages.list, and yes, my apk is most certainly in there, and the location it's pointing to is correct on the file system. So that's not the problem.

This tutorial: http://vilimpoc.org/blog/2010/09/23/hello-gdbserver-a-debuggable-jni-example-for-android/ recommends deleting and reinstalling, as well as cleaning your eclipse build.

I didn't use eclipse to build the package, but I did clean everything out and compile from scratch, deleted, and reinstalled to no luck.

Has anyone had similar problems, and how did you resolve them? Thank you.

Edit: Oh, and I have tried a different port to no avail, there does not appear to be anything on 5039 (the default port) anyway. And afaik, I don't have any firewalls blocking that connection. I'm developing on Ubuntu 11.04 as well.

Edit2: Hmm...it looks like with the new ndk (r5c), the error message has now changed too:

ERROR: Could not extract package's data directory. Are you sure that
       your installed application is debuggable?

And yes, debuggable is set to true in the manifest, and all of the native code is built with:

LOCAL_CFLAGS           := -Wall -g
LOCAL_LDFLAGS          := -Wl,-Map,xxx.map

解决方案

run-as: Package 'net.leifandersen.mobile.android.marblemachine' is unknown

Thus, unfortunately, your device is not able to be used with ndk-gdb, because run-as doesn't work. If you want to use that device, you must have root privilege.

EDITED:

Modify ndk-gdb script to get rid of the dependency of run-as. It works only on root privilege ('adb shell whoami' should be 'root').

--- ndk-gdb 2011-02-24 16:55:07.000000000 +0900
+++ ndk-gdb-root    2011-06-09 08:35:04.000000000 +0900
@@ -465,7 +465,7 @@
 log "Using app out directory: $APP_OUT"

 # Find the <dataDir> of the package on the device
-DATA_DIR=`adb_shell run-as $PACKAGE_NAME /system/bin/sh -c pwd`
+DATA_DIR="/data/data/$PACKAGE_NAME"
 log "Found data directory: '$DATA_DIR'"
 if [ $? != 0 -o -z "$DATA_DIR" ] ; then
     echo "ERROR: Could not extract package's data directory. Are you sure that"
@@ -543,7 +543,7 @@

 # Launch gdbserver now
 DEBUG_SOCKET=debug-socket
-run $ADB_CMD shell run-as $PACKAGE_NAME lib/gdbserver +$DEBUG_SOCKET --attach $PID &
+run $ADB_CMD shell "(cd $DATA_DIR; lib/gdbserver +$DEBUG_SOCKET --attach $PID)" &
 if [ $? != 0 ] ; then
     echo "ERROR: Could not launch gdbserver on the device?"
     exit 1

这篇关于运行NDK-GDB带包装没有发现的摩托罗拉手机上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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