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

8

13

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

Adorl answered 27/6, 2012 at 0:9 Comment(0)
A
9

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.

Adorl answered 5/7, 2012 at 19:35 Comment(7)
I havent tested your method, but am sure it will work, for it is a total clean installation of the app. But yes, please file a radar report and update here, that would be very kind of you :)Iscariot
I am not able to do this, when I select the dsym instruments says that: "Re-Symbolication requires MyApp.app.dSYM and AppleProfileKEventAction to have matching UUIDs. "Conceive
I'm not sure what AppleProfileKEventAction is. I do know that the .dSYM files get long UUID names (find them in whatever directory Xcode is saving them to see what I mean). Let me know what you discover.Adorl
You were selecting "Locate" when AppleProfileKEventAction was selected. You should be able to scroll to your binary and then "Locate" your dSYM file. I can not however find my binary there...Physician
Do you know whether this problem can be solved with your method?Chiton
Still run into this issue from time to time on Xcode 5.x. It seems to be correlate with having more than one build product in the derived products folder.Impercipient
Thank you, you save me.Residual
C
1

I'm not sure that it has been fixed in the 4.3 but this is a known problem in 4.2 seen here

Instruments There is a known issue with the Profile action from Xcode 4.2. After a build in which no source files have changed, Instruments will be unable to gather symbols for the target application.

This affects projects where both:

  1. The Release configuration is selected for the Profile action. (default)
  2. The Strip Linked Product build setting is set to "Yes”, or a custom Run Script build phase strips the product. (non-default)

The workaround is to do any one of the following:

  1. Perform a "Clean" on the product before initiating the Profile action.
  2. Do a Clean of the product and temporarily set the Strip Linked Product build setting to "No" while Profiling.
  3. Set the configuration of the Profile action to Debug.
  4. Run successive profiles directly from within Instruments when you do not need to rebuild. When developing Mac apps, using the GC Monitor template in Instruments may cause Instruments to crash. To workaround the problem please consider migrating your application to ARC.
Calabria answered 17/11, 2012 at 22:12 Comment(0)
L
1

I've had a similar problem for days. I was able to profile the Debug configuration, but not Release. First I tried to make a copy of the release configuration (as suggested somewhere on the web), but that copy did not work either.

Then I made a copy of Debug, called it Profile, tried it and the symbols of Profile were shown in the profiler. Great! I then changed the optimization levels etc. to the same as Release, and now it works! Just wanted to share this, as this comment would have spared me hours...

Lamebrain answered 3/1, 2013 at 16:23 Comment(1)
This is the most useful comment here! Thanks very much, it worked. The other solutions only made me to bang my head at the wall. Like "locate dSYM in ~/Library/", when the open file dialog does not show ~/Library/ at all, it is hidden in Mountain Lion...Huysmans
I
0

Have been facing the same and stumbled upon this thread.

I realized that I first profiled the app with release build and after changing the scheme in Xcode for the same app, the profiler was still unable to symbolize. I have tried all obvious solutions you mentioned above but in vain.

The profiler somehow is still referring to the first build (release build)'s settings and hence it is not able to symbolize. So, I just changed the app's bundle identifier for testing purpose so that a new app is created altogether for profiling purpose. I could check the code where leaks exist now.

Try it out and let me know if this works for you too. Still pondering over why Instruments is failing to symbolize though.

Iscariot answered 4/7, 2012 at 7:49 Comment(3)
Have you tried deleting the app from your test device, powering it off and back on again, and then building it again?Adorl
I have a suspicion that Xcode doesn't perform a clean installation of each build, but may install deltas, such that the symbol addresses are mixed. This assumption could be wildly incorrect.Adorl
Yes, I suspect the same. That is why I created a new app bundle identifier and build it across the wildcard provisioning profile.Iscariot
G
0

I had a similar issue where I had no symbols in my os x application that I built from the command line (so in this case it is not an iphone or xcode issue). It turned out the problem was due to a bad DYLD_LIBRARY_PATH that contained my PATH. When I got rid of all those non-library paths, such as /usr/bin/, it worked.

Guiltless answered 3/7, 2013 at 21:29 Comment(0)
O
0

I have a lot of third party frameworks whose symbols and binaries are unfortunately getting lost.

Additionally, my app's binary was getting lost.

I.e. if I selected File > Symbols, clicked my target, and found the similarly named item, the Binary Path was showing up red.

The solution was to go to Instruments > Preferences > Symbols, and add /Users/<MY_USER>/Library/Developer/Xcode/DerviedData to the search paths. Library is not indexed by Spotlight. After doing this, I have at least had the symbols for my app. The little circle next to my app's name goes from Yellow to Green when I do this, and persists between restarting Instruments, unlike other solutions to manually set the binary.

Let me know if you can tell me how to get all the ones for my third party frameworks. I use Carthage for some, others installed manually. Have had no luck with these yet.

Osi answered 6/8, 2018 at 19:17 Comment(0)
F
0

I've managed to solve this by:

  1. Disconnecting the device
  2. Deleting the iOS Device Support files for the device's version of iOS in ~/Library/Developer/Xcode/iOS Device Support
  3. Reconnecting the device and letting Xcode reinstall device support.

To be safe I first quit Xcode and Instruments, deleted derived data, and did a clean build as mentioned above, but no need to delete the app or restart any devices this way.

Forborne answered 6/5, 2022 at 13:59 Comment(0)
E
-1

Try open XCode 3 and him Organizer. And try add from this Organizer a devices to both machines.

Just open Organizer and wait him processes. If you're see a button "Use for development" then click him.

Sometimes, XCode 4 can't add a device a truely for full development.

Errick answered 27/6, 2012 at 0:30 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.