LLDB:添加符号文件? [英] LLDB: add symbols file?
问题描述
我的本机应用程序包含一个由Android Studio和另一个外部libother.so编译和运行的libmain.so由我编辑当调试时,我可以在libmain.so中设置断点,但不能在libother.so中设置断点。
这两个共享对象都被剥离,但是无论如何,Android Studio使得lldb知道libmain.so的未映射版本。我想为libother.so做同样的事情。
我需要什么命令来提供lldb,以便从本地机器上的未分配文件加载符号?
当我执行图像列表
时,我看到主要的.so,其路径指向其本地的未剪切版本:
/Users/username/Projects/gow/android/AppName/app/build/intermediates/binaries/debug/arm7/obj/armeabi-v7a/libmain.so
,第二个.so的路径如
/ var / folders / 3w / 5nr95lxx3qvdm2ylb8c8b7500000gn / T /。 /lldb/module_cache/remote-android/.cache/B5F32653-0000-0000-0000-000000000000/libother.so
如何使lldb找到未分配版本的 libother.so
?
我尝试了 image add
和目标符号添加
,但没有起作用。
这个线程似乎是专门针对MacOSX的。我正在使用Linux,所以这些答案并不是很有帮助。过了一段时间,我已经弄清楚了,这里是一个非常简单的解决方案。在执行进程附加之前,您应该执行以下命令:
settings set target.exec-search-paths / path / to / directory / with / unsripped / library / on / host
使用此设置lldb没有找到问题图书馆的正确版本。
BTW,最新版本的Android Studio在外部库中没有任何问题(实际上,相同的技术用于设置正确的至少如果您正在使用Gradle构建,则会将所有库(内部和外部)都进行路径迁移。但是如果您使用独立的lldb,这可以非常方便。
为避免在每个调试会话开始之后键入,您可以将此命令保存到文件中(例如 lldb.cmd
),然后像这样启动lldb:
./ lldb -S lldb.cmd
I'm trying to debug an android native app from Android Studio's native debugging using lldb.
My native app contains one libmain.so that is compiled and run by Android Studio and another external libother.so compiled by me. when debugging, I am able to set breakpoints in libmain.so but not libother.so.
Both shared objects are stripped but somehow Android Studio makes lldb know about the unstripped version of libmain.so. I want to do the same for libother.so.
What command do I need to give lldb so that it would load the symbols from an unstripped file on my local machine?
When I do image list
I see the main .so with a path the points to its local unstripped version:
/Users/username/Projects/gow/android/AppName/app/build/intermediates/binaries/debug/arm7/obj/armeabi-v7a/libmain.so
and the second .so with a path like
/var/folders/3w/5nr95lxx3qvdm2ylb8c8b7500000gn/T/./lldb/module_cache/remote-android/.cache/B5F32653-0000-0000-0000-000000000000/libother.so
How do I make lldb find the unstripped version of libother.so
?
I tried image add
and target symbols add
but it didn't work.
The answers in this thread seem to be specific for MacOSX. I am using Linux, so these answers weren't very helpful. After some time I've figured it out, and here is a very simple solution. Before you do "process attach" you should execute the following command:
settings set target.exec-search-paths /path/to/directory/with/unstripped/library/on/host
With this setting lldb has no problems finding the correct version of the library.
BTW, latest versions of Android Studio don't have any problems with external libraries (in fact, the same technique is used to set correct paths all libraries, both "internal" and "external", at least if you're building with Gradle). But if you use standalone lldb, this can be very handy.
To avoid typing it after start of each debugging session you can save this command to file (e.g. lldb.cmd
) and then start lldb like this:
./lldb -S lldb.cmd
这篇关于LLDB:添加符号文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!