Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
264 views
in Technique[技术] by (71.8m points)

What are the implications of using /Zi vs /Z7 for Visual Studio C++ projects?

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

question from:https://stackoverflow.com/questions/284778/what-are-the-implications-of-using-zi-vs-z7-for-visual-studio-c-projects

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...