xcode 设置——链接映射文件的路径——它是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4926114/
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-14 20:11:56  来源:igfitidea点击:

xcode settings -- path to link map file -- what is it?

xcodelinkersettings

提问by William Jockusch

Can anyone explain what this setting means, and what it does?

谁能解释一下这个设置是什么意思,它有什么作用?

EDIT: Thank you for the answers. Got it about the crash reports. Let me ask this -- does the link map file have any impact on my app's execution?

编辑:谢谢你的回答。了解崩溃报告。让我问一下——链接映射文件对我的应用程序的执行有任何影响吗?

采纳答案by Dave

A link map file is a text file that details where data, code, etc lives inside your executable. Very handy for stack traces when your program crashes, and for examining memory.

链接映射文件是一个文本文件,详细说明数据、代码等在可执行文件中的位置。对于程序崩溃时的堆栈跟踪和检查内存非常方便。

Just ask Xcode to make one, and then open it in textedit or whatever. You'll see all your method names and variable names, alongside addresses.

只需让 Xcode 制作一个,然后在 textedit 或其他任何地方打开它。您将看到所有方法名称和变量名称以及地址。

If you submit your app to the app store, it's vital you keep your map file, so if Apple manage to crash your app, you'll stand a better chance of making head or tail of the crash report.

如果您将您的应用程序提交到应用程序商店,那么保留您的地图文件至关重要,因此如果 Apple 设法使您的应用程序崩溃,您将更有可能成为崩溃报告的头或尾。

回答by Paul R

Only relevant if you're generating link maps. If you look at the bottom of the settings window when you select Path to Link Map Fileit says:

仅当您生成链接映射时才相关。如果您在选择链接映射文件的路径时查看设置窗口的底部,它会显示:

This setting defines the path to the map file written by the linker when the Write Link Map File setting is activated. By default a separate file will be written for each architecture and build variant, and these will be generated in the Intermediates directory for the target whose produce is being linked. [LD_MAP_FILE_PATH, -map]

此设置定义了在激活写入链接映射文件设置时链接器写入的映射文件的路径。默认情况下,将为每个架构和构建变体编写一个单独的文件,这些文件将在中间目录中为正在链接其产品的目标生成。[LD_MAP_FILE_PATH, -map]

For Write Link Map Fileit says:

对于写入链接映射文件,它说:

Activating this setting will cause the linker to write a map file to disk which details all symbols and their addresses in the output image. The path to the map file is defined by the Path to Link Map File setting. [LD_GENERATE_MAP_FILE, -map]

激活此设置将导致链接器将映射文件写入磁盘,其中详细说明了输出图像中的所有符号及其地址。映射文件的路径由链接映射文件设置的路径定义。[LD_GENERATE_MAP_FILE, -map]

It's fairly unusual to have any need to look at link maps, unless you're working on embedded systems.

除非您在嵌入式系统上工作,否则需要查看链接映射是相当不寻常的。

回答by Alex Gray

The default is...

默认是...

$(TARGET_TEMP_DIR)/$(PRODUCT_NAME)-LinkMap-$(CURRENT_VARIANT)-$(CURRENT_ARCH).txt.

$(TARGET_TEMP_DIR)/$(PRODUCT_NAME)-LinkMap-$(CURRENT_VARIANT)-$(CURRENT_ARCH).txt.

So for a target, named AtoZ...

所以对于一个名为AtoZ...

.../DerivedData/AtoZ/Intermediates/AtoZ.build/Debug/AtoZ.build/AtoZ-LinkMap-normal-x86_64.txt

.../DerivedData/AtoZ/Intermediates/AtoZ.build/Debug/AtoZ.build/AtoZ-LinkMap-normal-x86_64.txt

Sample output of such a file can be found here.

可以在此处找到此类文件的示例输出。

回答by hariszaman

In your target build settings make sure Write Link Map Fileis set to YES

在您的目标构建设置中,确保Write Link Map File设置为YES