Missing character names when profiling an iPhone application with tools

I am compiling the IPhone application via the command line (so there were no Xcode parameters), and I cannot get my symbol names to be displayed when profiling with tools. I tried several flags like -gdawrf-2 and -g without any success. I also tried using dsymutils to generate the .dSYM file, but I don't know how I should use it so that it fails.

Any help would be greatly appreciated!

+51
profiling iphone xcode instruments symbol
May 05 '10 at 20:15
source share
12 answers

How tools get debugging information:

The tools receive debugging information from the .dSYM file that Xcode automatically generates when setting the debugging data format to DWARF using the dSYM file in combination with a checkmark in the "Create debugging symbols" box. Setting these parameters will add an additional step to the Xcode build process and generate the dSYM file after compiling the application. Each dSYM is built with a UUID that corresponds to the UUID in the Mach-O section in the binary format from which it is derived. The Spotlight importer indexes the UUID of each dSym file located in a location accessible by Spotlight on your Mac. Therefore, SPOTLIGHT does all the black magic and is responsible for creating the connection between the .app you are running and its corresponding .dSYM file.

How to create debug information and a dSYM file without Xcode:

Make sure you compile the -gdwarf-2 and -g flags. (Other flag combinations possible)

-g Produce debugging information in the native format of the operating system (stabs, COFF, XCOFF or DWARF 2). GDB can work with this debug info. On most systems that use stabs format, -g allows you to use additional debugging information that only GDB can use; this additional information does more efficient debugging work in GDB, but is likely to crash other debuggers or refuse to read the program. if you want to precisely control whether additional information should be generated, use -gstabs +, -gstabs, -gxcoff +, -gxcoff or -gvms (see below). GCC allows you to use -g with -O. Labels taken by optimized code may occasionally surprise the results: some variables that you specify may not exist at all; the flow of control may briefly move where you do not expect it; some statements cannot be fulfilled because they calculate constant results or their values ​​were already at hand; some statements can be performed in different places because they have been moved out of loops.
However, this proves optimized debug output. This makes it wise to use an optimizer for programs that may have errors.

-gdwarf-2 Produce debugging information in DWARF version 2 format (if supported). This is the format used by DBX on IRIX 6. With this option, GCC uses DWARF version 3 functions when they are useful; version 3 is compatible with version 2, but it can still cause problems for older debuggers.

Create a dSYM file using dsymutil. If the tool is not recognized on the command line, use the spotlight to find it. IMPORTANT: place the .app file on your Mac HD before creating dSYM if you are working with a network drive.

dsymutil MyApp.app/MyApp -o MyApp.app.dSYM

Place the .dSYM file on the local Mac drive and launch the Tools as usual.

Resettig Spotlight Installation:

If characters are not displayed, this may be due to a spotligh error. You can try reprogramming the searchlight indexing by adding the folder containing the dSYM file (or even your drive) to “Prevent the searchlight from searching in these places” in the searchlight settings, and then delete it immediately.

+34
May 20 '10 at 18:55
source share

I changed my project settings to not include the dSYM file when creating:

enter image description here

Changing it to include the dSYM file helped the profiler to desymbol the characters and fix my problem:

enter image description here

+61
Mar 20 '15 at 8:03
source share

I still had problems with this.

My problem was that I was able to see the dSYM file being created, but the tools did not collect it.

To fix this, follow these steps:

  • Locate your dSYM file (should be in ~ / Library / Developer / DerivedData / APP_NAME-XXXXXXX / Build / Products / [BUILD_TYPE] - [DEVICE-TYPE] /
  • When the tools are stopped, click File → Repeated Symbolic Document
  • Scroll down to the entry with the name of your application
  • Click "Find" and select the folder from step 1
  • Click the start button to begin profiling.
+56
Oct 20 2018-11-17T00:
source share

In Xcode 4.5, you can select a profile from debug or release. Release default to delete characters when copying to the device. It is very easy to switch to a Debug configuration for profiling without breaking the release configuration. To do this, select "Product → Change Schema" in the Xcode menu. Select "Profile" in the list of schemas that appear, and then select the correct assembly configuration for it.

Or you can create a separate release / profile configuration and use it in the "Profile" section of your schema. How to add a separate build configuration is described in the Xcode User Guide .

+14
Nov 13 '12 at 11:23
source share

Three days passed, trying to figure it out for Xcode 7.1 / 7.3 ...

Changing the deployment target to the latest version (9.3 at the time) fixed this problem for me. My company is targeting 7.0, so I will probably have to create a custom scheme for profiling the code in the Tools to avoid having to change the target (or forget to change the target) when we do the production release.

Does this seem to be a bug if dSYM are not working based on the deployment target?

+4
May 05 '16 at 16:27
source share

With Xcode 6 Instruments, you can provide a dSYM file as follows:

  • File -> Symbols ... menu (when profiling is stopped)
  • select your application and click Find
  • select the path that contains dSYM (usually ~ / Library / Developer / DerivedData / APP_NAME-XXXXXXX / Build / Products / [BUILD_CONFIGURATION] - [TARGET_PLATFORM] /). Tip. You can copy this path from the terminal and use the OS X ⌘+SHIFT+G shortcut in the dialog box.

Instruments will also ask you if you should use the selected path to download dSYM for this application in the future. Answer:)

+3
Feb 19 '15 at 9:50
source share

The problem is that the spotlight cannot find .dSYM files. This is because Apple has changed the location of the DerivedData folder. DerivedData now goes to ~ / Library

Spotlight will not index ~ / Library , and as far as I was able to set, it cannot be indexed either (for example, mdimport is ignored).

Work to get characters in the profiler, just copy the data outside of ~ / Library , for example. Your home directory will work fine.

I used this command line:

 $ cp -r ~/Library/Developer/Xcode/DerivedData/AppName-xxxxxxxxxxx/Build/Products/Release-iphoneos/ ~/ 

When you kill your profiler and start a new profile run, you will see that the characters are available again.

+2
05 Oct 2018-11-11T00:
source share

Check the build log and make sure that your -g switch goes to the compiler - it's easy to get it wrong when changing settings at the project level and / or target levels for different build configurations, etc.

+1
May 05 '10 at 20:54
source share

Another work in the tool version that ships with Xcode 4 is to use the Re-Symbolicate Document menu item in the File menu for Tools. This menu item allows you to use the characters located in the .dSYM file in the ~ / Library / .... directory.

+1
08 Oct 2018-11-11T00:
source share

In my experience, this usually happens because the “Profile” was called before the latest version of the application was installed on the target device.

Try to run the application on the device / target, then call the "Profile" again after reinstalling it.

+1
Jan 15 '17 at 9:25
source share

I had this problem because the Xcode project was on a network share where Spotlight did not find dSYM files. Make sure the local drive.

0
May 27 '10 at 9:11
source share

I created a profile build configuration to deal with this problem. See my answer to a similar Stackoverflow question.

0
Nov 23
source share



All Articles