Xcode Instruments is stripping symbols despite all build settings to the contrary

jaredsinclair picture jaredsinclair · Jun 27, 2012 · Viewed 8.2k times · Source

Problem

Instruments' Time Profiler is stripping all symbols except system libraries from my app, despite the fact that I have disabled this behavior in all relevant build settings in Xcode — but only on one development machine. The other dev machine behaves normally.

Description

Instruments' Time Profiler is stripping all symbols except system libraries, despite the fact that I have disabled this behavior in all relevant build settings in Xcode — but this is only happening on one of my development machines. I have two development machines running the same version of OS X, Xcode, and Instruments, and each machine is using an identical copy of the same Xcode project with identical build settings, schemes, and other configurations, and the app is profiled using the same test device (iPhone 4S with the latest public version of iOS 5).

Machine 1
- Mac OS X 10.7.4
- Xcode 4.3.2 (4E2002)
- Instruments 4.3 (4321)

Machine 2
- Mac OS X 10.7.4
- Xcode 4.3.2 (4E2002)
- Instruments 4.3 (4321)

Steps To Reproduce

  1. Open included sample project on each machine.
  2. Make sure the iPhone 4S is selected as the test device.
  3. Select Product > Profile
  4. When Instruments launches, select Time Profiler and continue.
  5. Run the app.
  6. Notice how the symbols are stripped when running on the iMac (Machine 1) but not on the MacBook Air (Machine 2).

Expected Behavior

Symbols from my own code should appear in the Time Profiler on both machines.

Regression

I have tried all of the following, with no change in the actual results:

  1. Rebooting the machine.

  2. Trying other Xcode projects

  3. Deleting the "Derived Data" for all projects in the Xcode Organizer.

  4. Re-symbolicating the document in Instruments (carefully selecting the correct DSYM file in ~/Library/blahBlahBlah…)

Final Notes

Here is a link to a .zip file of a sample project: Sample Project .zip

Answer

jaredsinclair picture jaredsinclair · Jul 5, 2012

I was finally able to get it to work by a method that's just shy of a nuke-and-pave scenario:

  1. Make absolutely sure all symbol stripping is disabled for your current build configuration. Make sure you've done this for your Release config if that's what's being profiled for Instruments.
  2. Delete the app from the iOS device.
  3. Restart the iOS device.
  4. Restart the Mac (I don't trust Xcode or Lion at all to quit all relevant processes otherwise).
  5. Launch Xcode, go to Organizer > Projects and delete Derived Data for the affected project.
  6. Clean your project. Hell, why not?
  7. Build and profile for Instruments.
  8. Choose the Time Profiler in Instruments for clarity.
  9. The first run will not show the symbols, but don't quit. Leave Instruments running!
  10. Re-symbolicate the document in Instruments, navigating carefully to the correct dSYM file for the current build. This should be easier since you've deleted the derived data in step 5.
  11. Now you should be able to see your symbols. It helps if you hide non-objective-C symbols.

Why do I suggest that you delete the app and restart the iOS device in Steps 2 and 3? I have a suspicion that Xcode doesn't perform a clean installation of each build, but may install deltas, such that the symbol addresses present in Instruments are a mixture of the current build plus previous builds. If so, then this issue is even more common for someone like me, who shares a single test device between more than one Mac. This assumption could be wildly incorrect.

If the above steps don't work for you, please let me know in the comments. I'd like to create a detailed radar report at some point in the future.