如何调试从Android应用程序共享libarary [单独的项目] [英] how to debug a shared libarary [ separate project] from android application

查看:93
本文介绍了如何调试从Android应用程序共享libarary [单独的项目]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序,并通过密集的C ++ code项目, 首先,我把C ++源$ C ​​$ C项目,并使用了以下指南已经在Android应用程序本机调试的NDK能力。

I am developing an android application and using intensive c++ code in the project , First I put the c++ source code in the project and used the following guide to have the NDK capability of Native Debugging in the Android application .

<一个href="http://tools.android.com/recent/usingthendkplugin">http://tools.android.com/recent/usingthendkplugin

但发展weaks后,我决定分开本土code在一个独立的项目,并使用输出,所以在Android应用程序。

but after weaks of development I decided to separate the Native code in a standalone project and use the output SO in the Android Application .

我的问题是我怎么可以调试SO库,它是在Android应用程序一个单独的项目的结果?

推荐答案

使用NKD-GDB这个(你的。所以就必须包含在您的应用程序的应用程序特定的安装,在正常位置的APK .so文件),它是NDK的一部分。见$ NDK /文档/ NDK-GDB.html

Use nkd-gdb for this (your .so will have to be included in the APK that you installed for your application, in the normal location for app-specific .so files) It is part of the NDK. See $NDK/docs/NDK-GDB.html

不过,要注意:NKD-GDB只会GDB和你的。所以在应用程序启动后一段时间。所以,你可能会错过一些断点。我知道有2种方式来解决这个问题,一个IDE插件之外的:

But, be warned: nkd-gdb will only attach GDB to your .so sometime after the application has started. So, you might miss some breakpoints. I know of 2 ways to solve that problem, outside of an IDE plugin:

  1. 将在最早的入口点你。所以一个无限循环,然后用GDB打出来的无限循环中,您已设置断点后
  2. 在下载待处理的更新NDK-gdb的,它修复了这个问题,从的https: //android-review.googlesource.com/#/c/48029/ (一人已报告有问题,我修复,所以它没有被批准用于AOSP尚未...但我从来没有重现他们的问题。请让我知道如果你使用它,以及它是否适合你或没有。)
  1. Place an infinite loop at the earliest entry-point of your .so, then use GDB to break out of that infinite loop, after you have set your breakpoints
  2. Download my pending update to ndk-gdb, which fixes this problem, from https://android-review.googlesource.com/#/c/48029/ (One person has reported having problems with my fix, so it is not approved for AOSP yet... but I have never reproduced their problem. Please let me know if you use it, and whether it works for you or not.)

这篇关于如何调试从Android应用程序共享libarary [单独的项目]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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