将源附加到Xcode中的二进制dylib [英] Attaching sources to a binary dylib in Xcode

查看:169
本文介绍了将源附加到Xcode中的二进制dylib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iOS应用程序中有一个带有dylib的框架,该框架是在另一台机器上编译的。
我检查了机器上的来源,并尝试指示 lldb 使用以下方式映射源代码路径:

I've a framework with a dylib in my iOS app which was compiled on another machine. I checked out the sources on my machine and tried instructing lldb to map the source code path using:

settings set target.source-map /source/code/path/in/dylib/prefix /source/code/path/on/my/machine/prefix

无济于事,仍然看到装配。

To no avail, still seeing assembly.

注意#1: dylib是在同一版本的Xcode中用C ++代码编译的。

Note #1: the dylib was compiled from C++ code in the same version of Xcode.

注意#2:我用 nm -pa / path / to / dylib 确定文件路径是否嵌入到调试信息中,并且它们是lldb由于某种原因不能播放。

Note #2: I'm used nm -pa /path/to/dylib to determine whether file paths are embedded into the debug info, and they are, lldb doesn't play along for some reason.

谢谢

更新

我跟随Jim Ingham的回答并创建了一个自动执行此操作的脚本,脚本在我写的文章中作为主要链接提供: https:// medium.com/@maxraskin/background-1b4b6a9c65be

I've followed Jim Ingham's answer below and created a script that automates this, the script is available as a gist link in this article I wrote: https://medium.com/@maxraskin/background-1b4b6a9c65be

推荐答案

要调试在一台机器上构建但在另一台机器上调试的代码,您必须构建一个dSYM并在您正在调试的机器上使用该代码。如果你还没有这样做,那么什么都不会起作用。

To debug code built on one machine but debugged on another you have to build a dSYM and have that available on the machine on which you are debugging. If you haven't done that, nothing is going to work.

接下来要检查的是lldb正在拿起dSYM。此页面介绍了此过程的工作原理:

Next thing to check is that lldb is picking up the dSYM. This page has some description of how this process works:

http://lldb.llvm.org/symbols.html

但如果所有其他方法都失败了,您可以使用添加-dsym 命令手动添加它。

but if all else fails, you can use the add-dsym command to add it by hand.

如果仍然没有修复你的问题,那么在你的dylib中选择一些符号,然后执行:

If that still hasn't fixed your problem, then pick some symbol in your dylib, and do:

(lldb) image lookup -vn <SYMBOL_NAME>

或者在加载的dylib中找到一些地址并执行:

or alternately find some address in the loaded dylib and do:

(lldb) image lookup -va <ADDRESS>

如果lldb发现dSYM并且调试信息正确,则其中一行输出应为进入编制单位。这就是调试信息所说的源文件路径。该路径的适当基础是您应该在target.source-map中使用的。如果你没有看到那个条目,那么该编译单元的调试信息就会以某种方式丢失。

If lldb found the dSYM and the debug info is correct, one of the lines of output should be the entry for the "Compile Unit". That is what the debug info says the path to the source file is. The appropriate base of that path is what you should use in target.source-map. If you don't see that entry, then the debug information for that compilation unit is getting lost somehow.

如果所有这些看起来都很好并且lldb仍然没有看到源文件,那么你可能会遇到一个错误,在这种情况下,请提交 http://bugreporter.apple.com

If all those things look good and lldb still isn't seeing the source files, then you are likely hitting a bug, in which case please file a bug with http://bugreporter.apple.com.

这篇关于将源附加到Xcode中的二进制dylib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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