Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. I've developed the common codebase as a static library and want it's debug symbols included in the primary app's .dSYM file. 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. However, the .dSYM only contains symbols for the primary app, not for the static library. 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. However, none of the other classes are present.

In the static library's project's target's Build Settings, I have set the following:

  • Strip Debug Symbols During Copy: 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.

like image 504
jmac Avatar asked Jul 17 '12 22:07

jmac


2 Answers

Static lib symbols do show up in an app's dSYM file, and dwarfdump will reveal that.

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

That should show you the lib's symbols.

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.

like image 92
Miles Alden Avatar answered Oct 17 '22 06:10

Miles Alden


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.
like image 1
rvelasquez Avatar answered Oct 17 '22 05:10

rvelasquez