使用/ Zi vs / Z7对Visual Studio C ++项目的影响是什么? [英] What are the implications of using /Zi vs /Z7 for Visual Studio C++ projects?

查看:1682
本文介绍了使用/ Zi vs / Z7对Visual Studio C ++项目的影响是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景



有几种不同的调试标志,您可以使用Visual Studio C ++编译器。它们是:




  • (无)


    • 不创建调试信息

    • 更快的编译时间


  • / strong>


    • 使用CodeView格式在.obj文件中生成完整符号调试信息


  • / Zi


    • 在目标的.pdb文件中生成全符号调试信息程序数据库格式。

    • 启用对最小重建(/ Gm)的支持,可减少重新编译所需的时间。


  • / ZI


    • 生成调试信息,例如/ Zi,但支持编辑并继续




问题




  • / Gm标记与 / MP标记为Multiple过程构建(Visual Studio 2005/2008)


  • 如果要启用最小重建,则/ Zi标志必须位于/ Z7


  • 如果你打算使用/ MP标志,似乎没有区别/ Z7和/ Zi看MSDN。但是, SCons文档说明您必须使用/ Z7来支持并行构建。




问题


$ b b

  • 在Visual Studio C ++项目中使用/ Zi vs / Z7有何影响?


  • 我错过了这些选项的其他优点或缺点吗?


  • 具体来说,每个源的目标vs多个CodeView格式(.obj)文件的单个程序数据库格式(PDB)文件的好处是什么?




参考



MDSN / Z7,/ Zi,/ ZI(调试信息格式)



MSDN / MP(使用多进程构建)



SCons构造变量CCPDBFLAG



调试信息

解决方案

Codeview是一个更旧的调试格式与微软的旧独立调试器回到微软C编译器在20世纪80年代中期的日子。它占用更多的磁盘空间,并且调试器需要更长的时间来解析,这是链接过程中的一个主要痛苦。当我在1998-2000年在Windows上使用CodeWarrior for Windows时,我们从编译器生成它。



一个优点是Codeview是一种记录格式,当他们无法处理PDB格式的调试数据库时,可以经常处理它。此外,如果一次创建多个文件,则没有争用写入项目的调试数据库。然而,对于大多数使用这些天,使用PDB格式是一个伟大的胜利,无论是在构建时间,特别是在调试器启动时间。


Background

There are several different debug flags you can use with the Visual Studio C++ compiler. They are:

  • (none)
    • Create no debugging information
    • Faster compilation times
  • /Z7
    • Produce full-symbolic debugging information in the .obj files using CodeView format
  • /Zi
    • Produce full-symbolic debugging information in a .pdb file for the target using Program Database format.
    • Enables support for minimal rebuilds (/Gm) which can reduce the time needed for recompilation.
  • /ZI
    • Produce debugging information like /Zi except with support for Edit-and-Continue

Issues

  • The /Gm flag is incompatible with the /MP flag for Multiple Process builds (Visual Studio 2005/2008)

  • If you want to enable minimal rebuilds, then the /Zi flag is necessary over the /Z7 flag.

  • If you are going to use the /MP flag, there is seemingly no difference between /Z7 and /Zi looking at MSDN. However, the SCons documentation states that you must use /Z7 to support parallel builds.

Questions

  • What are the implications of using /Zi vs /Z7 in a Visual Studio C++ project?

  • Are there other pros or cons for either of these options that I have missed?

  • Specifically, what is the benefit of a single Program Database format (PDB) file for the target vs multiple CodeView format (.obj) files for each source?

References

MDSN /Z7, /Zi, /ZI (Debug Information Format)

MSDN /MP (Build with Multiple Processes)

SCons Construction Variables CCPDBFLAG

Debug Info

解决方案

Codeview is a much older debugging format that was introduced with Microsoft's old standalone debugger back in the "Microsoft C Compiler" days of the mid-1980s. It takes up more space on disk and it takes longer for the debugger to parse, and it's a major pain to process during linking. We generated it from our compiler back when I was working on the CodeWarrior for Windows in 1998-2000.

The one advantage is that Codeview is a documented format, and other tools can often process it when they couldn't deal with PDB-format debug databases. Also, if you're building multiple files at a time, there's no contention to write into the debug database for the project. However, for most uses these days, using the PDB format is a big win, both in build time and especially in debugger startup time.

这篇关于使用/ Zi vs / Z7对Visual Studio C ++项目的影响是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆