Android Studio中外部剥离共享库的本机调试 [英] Native debugging of external stripped shared library in Android Studio

查看:38
本文介绍了Android Studio中外部剥离共享库的本机调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经剥离和未剥离共享库.使用 LLDB 在 Android Studio 中调试时如何加载符号?

I have stripped and unstripped shared library. How to load symbols while debugging stripped in Android Studio with LLDB?

我可以成功调试位于jniLibs"文件夹中的完整未剥离的 .so.但它太大了,部署时间太长.

I can successfully debug full unstripped .so located in "jniLibs" folder. But it is too big, and deploying takes too long.

在调试配置中指定符号目录不适用于标准和实验插件.

Specifying of symbols directory in Debug configuration doesn't work with standart and experemental plugin.

推荐答案

您需要使用--build-id"标志链接您的库,以便 Android Studio 中的 LLDB 可以找到它,而不是从设备中提取它.如果您使用 NDK 工具链,只需将以下内容添加到链接器标志中:

You need to link your libraries with the "--build-id" flag so LLDB in Android Studio can find it instead of pulling it from the device. If your using the NDK toolchain just add the following to your linker flags:

'-Wl,--build-id'

您可能还需要告诉 Android Studio 在哪里查找未剥离的库(如果您自己剥离了库).您可以通过转到运行->编辑配置->调试器选项卡->符号目录并添加您的路径来执行此操作.

You may also need to tell Android Studio where to look for the unstripped libraries (if you stripped the libraries yourself). You can do this by going to Run->Edit Configurations->Debugger Tab->Symbols Directories and add your path.

要检查使用哪个库是 LLDB,您可以暂停您的应用程序,然后转到 Native Debugger 选项卡 -> LLDB 控制台并键入:

To check which library is LLDB using you can pause your app then go to the Native Debugger tab -> LLDB console and type:

image list

如果您使用 ndk-build,只需将标志添加到 Android.mk 中的 LOCAL_LDFLAGS 或仅使用 NDK r12b 或更高版本(该标志默认启用).

If your using ndk-build, just add the flag to the LOCAL_LDFLAGS in the Android.mk or just use NDK r12b or higher (the flag is enabled by default).

这篇关于Android Studio中外部剥离共享库的本机调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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