Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 Instruments doesn't show source lines

I've just started playing with Xcode 4, and found that, no matter how I setup debugging symbols in the project, Instruments refuses to display source lines for stack trace items that correspond to my code. In only shows hex offsets and identifies my executable as the owning module. Turning on "Source Location" draws a blank too. This occurs even for the skeleton OpenGL ES project generated by Xcode (File → New → New Project... → iOS → Application → OpenGL ES Application).

This problem only occurs in Instruments (I've tried CPU and OpenGL tracing so far). Gdb picks up debug symbols just fine.

Do I have to do something special to see the source code for stack traces in Instruments, or is this a bug in Xcode 4?

So far, I've:

  • Changed Debug Information Format from DWARF with dSYM File to DWARF.
  • Changed Strip Debug Symbols During Copy from Yes to No.
  • Changed the build scheme to use the Debug build instead of the Release build with Instruments.
like image 842
Marcelo Cantos Avatar asked Mar 11 '11 01:03

Marcelo Cantos


3 Answers

The other answers are good long-term fixes. If you'd rather not wait for Spotlight to rebuild its index and just need to get symbols for one Instruments session, you can ask Instruments to symbolicate the current session.

  1. Choose File → Re-Symbolicate Document… screenshot of re-symbolicate menu item
  2. Locate your binary in the list that appears. It should be the same name you see on the Springboard. Select your binary and click "Locate." enter image description here
  3. Go back to Xcode. Control-click on your .app build product and choose "Show in Finder".right-click menu screenshot showing show in finder item
  4. This will reveal the directory containing your binary as well as its dSYM file. Go back to Instruments, navigate to this directory, and select your dSYM file. The easiest way is to just drag the dSYM file straight from the Finder to the "Select dSYM" dialog in Instruments.
  5. Finally, click "Symbolicate" in Instruments. You should now see symbols in the traces rather than hex offsets.
like image 52
Phil Calvin Avatar answered Nov 13 '22 00:11

Phil Calvin


I had this issue today and solved it this way:

  1. Edit scheme
  2. Click on "Profile" on the left (this is the important step)
  3. Change Build Configuration to Debug

That should do it. Note that for whatever reason, the build target is not set to the same build configuration as the profile target and this has tripped me up more than a time or two.

like image 45
JonnyBoy Avatar answered Nov 13 '22 00:11

JonnyBoy


Try selecting a different code signing identity, i.e. provisioning profile, for the Release configuration.

like image 3
leo Avatar answered Nov 13 '22 02:11

leo