xcode Time Profiler 未显示符号名称

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12610779/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:39:36  来源:igfitidea点击:

xcode Time Profiler not showing symbol name

iosxcodeprofile

提问by jdog

Updated to xCode 4.5 and when time profiling my app Symbol Name doesn't show classes or objects anymore, but shows memory addresses see below.

更新到 xCode 4.5,当时间分析我的应用程序符号名称不再显示类或对象,但显示内存地址见下文。

0x2fd42e13
0x38014448

I used to see the following

我曾经看到以下内容

main
NSManagedObjectContext

When I could see the class names then I can track down the issues in the extended detail. Now the extended detail shows the same thing as the 0x2fd42e13.

当我可以看到类名时,我就可以在扩展细节中追踪问题。现在扩展细节显示与 0x2fd42e13 相同的内容。

采纳答案by jdog

Solved it myself:

自己解决了:

Edit your scheme where it says "WhateverProjectNameIs>iPad 6.0 simulator"

编辑您的方案,其中显示“WhateverProjectNameIs>iPad 6.0 模拟器”

Then click on "Profile" on the left On the Info tab, change Build Configuration to Debug (probably set to Release) 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.

然后单击左侧的“配置文件”在信息选项卡上,将构建配置更改为调试(可能设置为发布)那应该就可以了。请注意,无论出于何种原因,构建目标未设置为与配置文件目标相同的构建配置,这让我绊倒了一两次。

回答by Nathan F.

To resolve my issue I had to tell Instruments where my binary was as it had lost track of it for some reason.

为了解决我的问题,我不得不告诉 Instruments 我的二进制文件在哪里,因为它由于某种原因丢失了它的踪迹。

1. Run Instruments as you normally would to get the masked data.

1.像往常一样运行 Instruments 来获取屏蔽数据。

enter image description here

在此处输入图片说明

2. In the Project Navigator, expand the Products folder and click your application (either provider (.appex) or application (.app). If your File Inspector is not visible, right click the application and click "Show File Inspector"

2.在 Project Navigator 中,展开 Products 文件夹并单击您的应用程序(提供程序(.appex)或应用程序(.app)。如果您的文件检查器不可见,请右键单击该应用程序并单击“显示文件检查器”)

enter image description here

在此处输入图片说明

3. On the right side of your screen you should now see the file inspector for your binary. Opposite click on the "Full Path" property and click "Copy".

3.在屏幕右侧,您现在应该会看到二进制文件的文件检查器。相反单击“完整路径”属性,然后单击“复制”。

enter image description here

在此处输入图片说明

4. Go back into Instruments and go to File->Symbols

4.返回 Instruments 并转到File->Symbols

enter image description here

在此处输入图片说明

5. Drop down your application or provider on the left and click on the item with the dot next to it (it should have the same name as your application)

5.在左侧下拉您的应用程序或提供程序,然后单击旁边带有点的项目(它应该与您的应用程序同名)

enter image description here

在此处输入图片说明

6. You'll notice that the Binary Path is red. This means that Instruments has lost track of your binary file. Click the small folder icon on the bottom right to bring up a Select File dialog. Press Command+Shift+Gto enter a directory path, and paste the path that we copied from xcode earlier.

6.您会注意到二进制路径是红色的。这意味着 Instruments 已经失去了对您的二进制文件的跟踪。单击右下角的小文件夹图标以打开“选择文件”对话框。按Command+Shift+G进入目录路径,粘贴我们之前从xcode复制的路径。

enter image description here

在此处输入图片说明

7. You should now have the binary selected, click Opento open it. Click done on the Dialog to close the windows. Instruments should now show the proper details and symbol names while profiling your code.

7.您现在应该选择了二进制文件,单击Open打开它。单击对话框上的完成以关闭窗口。仪器现在应该在分析代码时显示正确的详细信息和符号名称。

enter image description here

在此处输入图片说明

  1. If this reoccurs, and your binary is located at a path like /Users/<User>/Library/Developer/Xcode/DerivedData/..., you will need to add this to your default search path in Instruments. /Libraryis not indexed by Spotlight, so is not searched for by Instruments. Go to Instruments > Preferences > Symbols, and add /Users/<User>/Library/Developer/Xcode/DerivedData/.
  1. 如果这种情况再次发生,并且您的二进制文件位于类似 的路径中/Users/<User>/Library/Developer/Xcode/DerivedData/...,您需要将其添加到 Instruments 中的默认搜索路径中。/Library没有被 Spotlight 索引,所以没有被 Instruments 搜索。转到 Instruments > Preferences > Symbols,然后添加/Users/<User>/Library/Developer/Xcode/DerivedData/.

回答by fishinear

Profiling the debug configuration will not give you correct profile values. The debug configuration is not compiled for speed, and all your NSLog statements are still in.

分析调试配置不会为您提供正确的配置文件值。调试配置不是为了速度而编译的,你所有的 NSLog 语句仍然在。

I created a "Profile" build configuration to deal with this issue. See my answerto a similar Stackoverflow question.

我创建了一个“配置文件”构建配置来处理这个问题。请参阅对类似 Stackoverflow 问题的回答。

回答by Mithuzz

Me too had the same issue and I tried all steps that others suggested. But none of them fixed the issue for me. So, what I did is, I just opened the Instrumentsand next to the Recordbutton, click on the drop down menu and select the target using Choose targetoption. Then click on Recordbutton, now I could see all the methods in the instruments panel :)

我也有同样的问题,我尝试了其他人建议的所有步骤。但他们都没有为我解决这个问题。所以,我所做的是,我只是打开按钮Instruments旁边的Record,单击下拉菜单并选择目标使用Choose target选项。然后点击Record按钮,现在我可以看到仪器面板中的所有方法:)

回答by Yon

I know this is an old question, but none of the solutions mentioned above worked for me. I need to switch to the latest iOS simulator (use iOS 9 instead of iOS 8 currently) to show symbol name correctly. I think Xcode Instruments can only work with simulator which run latest iOS SDK.

我知道这是一个老问题,但上面提到的解决方案都不适合我。我需要切换到最新的 iOS 模拟器(当前使用 iOS 9 而不是 iOS 8)以正确显示符号名称。我认为 Xcode Instruments 只能与运行最新 iOS SDK 的模拟器一起使用。

回答by Sai

Restart Instruments and Xcode solved my problem :(

重新启动仪器和 Xcode 解决了我的问题:(

回答by JerryZhou

Reset the build path to default. I have changed it to tmp/ folder previously and symbol can't show the code. After reset this path and profiler can show the code correct. Build Path(Relative to Derived Data) setting as bellow: Build Path

将构建路径重置为默认值。我之前已将其更改为 tmp/ 文件夹,并且符号无法显示代码。重置此路径后,分析器可以正确显示代码。构建路径(相对于派生数据)设置如下: 构建路径

回答by Beyond Chao

I have same problem in Xcode 11.4 1. Show your YOUR_PROJECT.app folder in Xcode while build success , find Release-iphoneos or Debug-iphoneos folder, select which on determined by your Profile`s build setting. normally we choice Release-iphoneos. 2. Add that path to Instruments in 【Preferences】->【Symbols】 to search YOUR_PROJECT.app.dSYM file.

我在 Xcode 11.4 中遇到了同样的问题 1. 在构建成功时在 Xcode 中显示您的 YOUR_PROJECT.app 文件夹,找到 Release-iphoneos 或 Debug-iphoneos 文件夹,选择哪个由您的配置文件的构建设置确定。通常我们选择Release-iphoneos。2.在【Preferences】->【Symbols】中添加那个路径到Instruments,搜索YOUR_PROJECT.app.dSYM文件。

enter image description here

在此处输入图片说明

回答by Chris Garrett

I was the having same problem and tried the other solutions to no avail. The Scheme issue is usually the problem, so I started there. But in my case it was already configured properly. Here's what finally worked for me:

我遇到了同样的问题,并尝试了其他解决方案无济于事。Scheme问题通常是问题所在,所以我从那里开始。但就我而言,它已经正确配置。这是最终对我有用的方法:

  • In Instruments, stop the process if it's running.
  • Go to File -> Symbols, and under dSYM path, find the library that isn't being symbolicated.
  • In my case, it was pointing to items in the Trash. So I emptied the Trash, deleted the Module Cache and project in the Derived Data folder, and when I rebuilt the project it started working again. In your case it could be pointing to some other file that either doesn't exist or isn't reachable by Instruments.
  • 在 Instruments 中,如果进程正在运行,请停止该进程。
  • 转到文件 -> 符号,然后在 dSYM 路径下,找到未被符号化的库。
  • 就我而言,它指向垃圾箱中的项目。所以我清空了垃圾箱,删除了派生数据文件夹中的模块缓存和项目,当我重建项目时,它又开始工作了。在您的情况下,它可能指向其他一些不存在或 Instruments 无法访问的文件。