简体   繁体   English

iOS静态库调试符号未包含在dSYM中

[英]iOS Static Library Debug Symbols not being in included in dSYM

I'm working on a series of iOS apps which will share a common codebase. 我正在研究一系列将共享公共代码库的iOS应用程序。 I've developed the common codebase as a static library and want it's debug symbols included in the primary app's .dSYM file. 我已经将公共代码库开发为静态库,并希望它的调试符号包含在主应用程序的.dSYM文件中。 My understanding is that this is possible, but I have not gotten it working yet. 我的理解是这是可能的,但我还没有完成它的工作。

The common codebase in its own project which has a static library as a target. 它自己的项目中的公共代码库,它有一个静态库作为目标。 This project is dragged into the primary app's project. 该项目被拖入主应用程序的项目中。 In the primary app's target's Build Phases I've added the static library as a Target Dependency and under Link Binary With Libraries. 在主要应用程序的目标构建阶段中,我已将静态库添加为目标依赖项,并在“链接二进制文件库”下添加。 The project builds and runs as desired. 该项目根据需要构建和运行。

Now, if I generate a archive from the main project, I can view that archive in Finder, and it contains a .dSYM file that can be used to symbolicate crash logs. 现在,如果我从主项目生成存档,我可以在Finder中查看该存档,它包含一个可用于表示崩溃日志的.dSYM文件。 However, the .dSYM only contains symbols for the primary app, not for the static library. 但是,.dSYM仅包含主应用程序的符号,而不包含静态库的符号。 To over-confirm this, I ran the following: 为了过度确认这一点,我运行了以下内容:

dwarfdump /path/to/app.dSYM

And the output (mostly) did not contain any symbols from the static library. 输出(大多数)不包含静态库中的任何符号。 The only exception I have found is that my primary project's AppDelegate is a subclass of an object in the static library, and there are entries for that super class in the .dSYM. 我发现的唯一例外是我的主项目的AppDelegate是静态库中对象的子类,并且.dSYM中有超类的条目。 However, none of the other classes are present. 但是,没有其他类存在。

In the static library's project's target's Build Settings, I have set the following: 在静态库的项目目标的Build Settings中,我设置了以下内容:

  • Strip Debug Symbols During Copy: NO 复制期间剥离调试符号:NO
  • Strip Linked Product: NO 剥离链接产品:没有
  • Generate Debug Symbols: YES 生成调试符号:是
  • Symbols Hidden by Default: NO 默认隐藏的符号:否

If anyone can offer some guidance, I would greatly appreciate it. 如果有人能提供一些指导,我将不胜感激。

Static lib symbols do show up in an app's dSYM file, and dwarfdump will reveal that. 静态lib符号确实显示在应用程序的dSYM文件中,而dwarfdump将显示该文件。

 dwarfdump -a path/to/app.dSYM >dsymAsText.txt

That should show you the lib's symbols. 这应该显示lib的符号。

However if you are (as I have been recently) looking for a symbol table to be generated to go along with just your static lib, I have come to the conclusion that it will be fairly useless; 但是,如果你(正如我最近)正在寻找一个符号表来生成与你的静态库一起使用,我得出结论它将是相当无用的; once it get compiled into a new app those symbols and addresses will all change and you will have an entirely different offset for everything (please someone correct me if I'm wrong). 一旦它被编译成一个新的应用程序,那些符号和地址都将改变,你将有一个完全不同的偏移一切(如果我错了,请有人纠正我)。

I'm not entirely sure there's a way to get around that part. 我不完全确定有办法解决这个问题。

Not sure if you found your answer yet but I had the exact same problem a couple of days ago. 不确定你是否找到了你的答案,但几天前我遇到了完全相同的问题。 I got it to work by doing the following: 我通过执行以下操作让它工作:

  1. Create a workspace to hold your primary project and common code base (static library). 创建一个工作空间来保存主项目和公共代码库(静态库)。 Make sure the projects are siblings and not parent/child. 确保项目是兄弟姐妹,而不是父母/孩子。
  2. Add a target dependency and link the common codebase 添加目标依赖项并链接公共代码库
  3. Make sure to include debug symbols in your common codebase 确保在公共代码库中包含调试符号
  4. Configure the workspace settings to build all projects in a shared directory (I believe this is the key) 配置工作区设置以在共享目录中构建所有项目(我相信这是关键)
  5. If you get complaints about not being able to find headers you may have to modify your user header search path in the build settings or use the source tree feature. 如果您收到有关无法找到标题的投诉,则可能需要在构建设置中修改用户标题搜索路径,或使用源树功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM