在 MacOS 中编译 C++ 代码时的 dSYM 目录

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

dSYM Directories While Compiling C++ Code in MacOS

c++macoscompiler-constructiondebug-symbols

提问by neversaint

Why compiling C++ in Mac always create *.dSYM directories? Is there a way to disable that?

为什么在 Mac 中编译 C++ 总是创建 *.dSYM 目录?有没有办法禁用它?

回答by Nik Reiman

It's because your Xcode project is set up to build debug symbols with an external dSYM file. This is actually very handy for release builds, as it means that you can strip debug symbols from your app, and when a user sends a crashdump to you, you can use the original dSYM file to generate a proper stacktrace for debugging.

这是因为您的 Xcode 项目设置为使用外部 dSYM 文件构建调试符号。这对于发布版本实际上非常方便,因为这意味着您可以从应用程序中去除调试符号,并且当用户向您发送故障转储时,您可以使用原始 dSYM 文件生成适当的堆栈跟踪以进行调试。

Anyways, you don'tneed to disable debug symbol generation in your project. Instead, just change the debug symbol type to DWARF (instead of "DWARF with dSYM File"). You can also use Stabs, but that's the old format.

无论如何,您不需要在项目中禁用调试符号生成。相反,只需将调试符号类型更改为 DWARF(而不是“DWARF with dSYM File”)。您也可以使用 Stabs,但这是旧格式。

Edit: Ah, I see you meant from the command line, not from Xcode. I'm not sitting in front of my mac atm, but I see from the gcc4 manpagethan you can specify -gstabs to use the Stabs format.

编辑:啊,我明白你的意思是从命令行,而不是从 Xcode。我没有坐在我的 mac atm 前面,但我从gcc4 联机帮助页中看到,您可以指定 -gstab 来使用 Stabs 格式。

回答by daustin777

I assume your using Xcode. Go to "Project"/"Edit Project Settings" menu item, click on build tab, under "GCC 4.0 - Code Generation" section, uncheck Generate Debug Symbols. You can type in "sym" in search field to help find it.

我假设您使用 Xcode。转到“项目”/“编辑项目设置”菜单项,单击构建选项卡,在“GCC 4.0 - 代码生成”部分下,取消选中生成调试符号。您可以在搜索字段中输入“sym”以帮助找到它。