Skip to content

Commit 3038840

Browse files
author
Colin Robertson
authored
Update z7-zi-zi-debug-information-format.md (MicrosoftDocs#178)
Fix some readability issues, add useful info.
1 parent 5dfa5ff commit 3038840

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

docs/build/reference/z7-zi-zi-debug-information-format.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,36 @@ Specifies the type of debugging information created for your program and whether
2222
2323
## Remarks
2424

25-
The debug information format options are described in the following sections.
25+
When code is compiled and built in debug mode, the compiler produces symbol names for functions and variables, type information, and line number locations for use by the debugger. This symbolic debugging information can be included either in the object files (.obj files) produced by the compiler, or in a separate PDB file (a .pdb file) for the executable. The debug information format options are described in the following sections.
2626

2727
### None
2828

2929
By default, if no debug information format option is specified, the compiler produces no debugging information, so compilation is faster.
3030

3131
### /Z7
3232

33-
The **/Z7** option produces an *object file*, a file that has a .obj extension, containing full symbolic debugging information for use with the debugger. The symbolic debugging information includes the names and types of variables, as well as functions and line numbers. No *PDB file*, a file with a .pdb extension, is produced.
33+
The **/Z7** option produces object files that also contain full symbolic debugging information for use with the debugger. These object files and the built executable can be substantially larger than files that have no debugging information. The symbolic debugging information includes the names and types of variables, as well as functions and line numbers. No PDB file is produced.
3434

35-
For distributors of third-party libraries, there is an advantage to not having a PDB file. However, the object files for the precompiled headers are necessary during the link phase, and for debugging. If there is only type information (and no code) in the .pch object files, you must also use the [/Yl (Inject PCH Reference for Debug Library)](../../build/reference/yl-inject-pch-reference-for-debug-library.md) option, which is enabled by default.
35+
For distributors of debug versions of third-party libraries, there is an advantage to not having a PDB file. However, the object files for any precompiled headers are necessary during the library link phase, and for debugging. If there is only type information (and no code) in the .pch object file, you must also use the [/Yl (Inject PCH Reference for Debug Library)](../../build/reference/yl-inject-pch-reference-for-debug-library.md) option, which is enabled by default, when you build the library.
36+
37+
The [/Gm (Enable Minimal Rebuild)](../../build/reference/gm-enable-minimal-rebuild.md) option is not available when **/Z7** is specified.
3638

3739
### /Zi
3840

39-
The **/Zi** option produces a PDB file that contains type information and symbolic debugging information for use with the debugger. The symbolic debugging information includes the names and types of variables, as well as functions and line numbers.
41+
The **/Zi** option produces a separate PDB file that contains all the symbolic debugging information for use with the debugger. The debugging information is not included in the object files or executable, which makes them much smaller.
4042

4143
Use of **/Zi** does not affect optimizations. However, **/Zi** does imply **/debug**; see [/DEBUG (Generate Debug Info)](../../build/reference/debug-generate-debug-info.md) for more information.
4244

43-
When **/Zi** is specified, type information is placed in the PDB file, and not in the object file.
4445

45-
You can use [/Gm (Enable Minimal Rebuild)](../../build/reference/gm-enable-minimal-rebuild.md) together with **/Zi**, but **/Gm** is not available when **/Z7** is specified.
46+
When you specify both **/Zi** and **/clr**, the <xref:System.Diagnostics.DebuggableAttribute> attribute is not placed in the assembly metadata. If you want it, you must specify it in the source code. This attribute can affect the runtime performance of the application. For more information about how the **Debuggable** attribute affects performance and how you can modify the performance impact, see [Making an Image Easier to Debug](/dotnet/framework/debug-trace-profile/making-an-image-easier-to-debug).
47+
48+
The compiler names the PDB file *project*.pdb. If you compile a file outside of a project, the compiler creates a PDB file named VC*x*.pdb, where *x* is a concatenation of the major and minor version number of the compiler version in use. The compiler embeds the name of the PDB and an identifying timestamped signature in each object file created using this option, which points the debugger to the location of symbolic and line-number information. The name and signature in the PDB file must match the executable for symbols to be loaded in the debugger. The WinDBG debugger can load mismatched symbols by using the `.symopt+0x40` command. Visual Studio does not have a similar option to load mismatched symbols.
4649

47-
When you specify both **/Zi** and **/clr**, the <xref:System.Diagnostics.DebuggableAttribute> attribute is not placed in the assembly metadata. If you want it, you must specify it in source code. This attribute can affect the runtime performance of the application. For more information about how the **Debuggable** attribute affects performance and how you can modify the performance impact, see [Making an Image Easier to Debug](/dotnet/framework/debug-trace-profile/making-an-image-easier-to-debug).
50+
If you create a library from objects that were compiled using **/Zi**, the associated .pdb file must be available when the library is linked to a program. Thus, if you distribute the library, you must also distribute the PDB file. To create a library that contains debugging information without using PDB files, you must select the **/Z7** option. If you use the precompiled headers options, debugging information for both the precompiled header and the rest of the source code is placed in the PDB file.
4851

4952
### /ZI
5053

51-
The **/ZI** option produces a PDB file in a format that supports the [Edit and Continue](/visualstudio/debugger/edit-and-continue-visual-cpp) feature. If you want to use Edit and Continue debugging, you must use this option. The Edit and Continue feature is useful for developer productivity, but can cause issues in compiler conformance, code size and performance. Because most optimizations are incompatible with Edit and Continue, using **/ZI** disables any `#pragma optimize` statements in your code. The **/ZI** option is also incompatible with use of the [&#95;&#95;LINE&#95;&#95; predefined macro](../../preprocessor/predefined-macros.md). Code compiled with **/ZI** cannot use **&#95;&#95;LINE&#95;&#95;** as a non-type template argument, although **&#95;&#95;LINE&#95;&#95;** can used in macro expansions.
54+
The **/ZI** option is similar to **/Zi**, but it produces a PDB file in a format that supports the [Edit and Continue](/visualstudio/debugger/edit-and-continue-visual-cpp) feature. To use Edit and Continue debugging features, you must use this option. The Edit and Continue feature is useful for developer productivity, but can cause issues in code size, performance, and compiler conformance. Because most optimizations are incompatible with Edit and Continue, using **/ZI** disables any `#pragma optimize` statements in your code. The **/ZI** option is also incompatible with use of the [&#95;&#95;LINE&#95;&#95; predefined macro](../../preprocessor/predefined-macros.md); code compiled with **/ZI** cannot use **&#95;&#95;LINE&#95;&#95;** as a non-type template argument, although **&#95;&#95;LINE&#95;&#95;** can be used in macro expansions.
5255

5356
The **/ZI** option forces both the [/Gy (Enable Function-Level Linking)](../../build/reference/gy-enable-function-level-linking.md) and [/FC (Full Path of Source Code File in Diagnostics)](../../build/reference/fc-full-path-of-source-code-file-in-diagnostics.md) options to be used in your compilation.
5457

@@ -57,12 +60,6 @@ The **/ZI** option forces both the [/Gy (Enable Function-Level Linking)](../../b
5760
> [!NOTE]
5861
> The **/ZI** option is only available in the compilers targeting x86 and x64 processors; this compiler option is not available in the compilers targeting ARM processors.
5962
60-
The compiler names the PDB file *project*.pdb. If you compile a file outside of a project, the compiler creates a PDB file named VC*x*0.pdb, where *x* is the major version number of the Visual Studio version in use. The compiler embeds the name of the PDB in each .obj file created using this option, pointing the debugger to the location of symbolic and line-number information. When you use this option, your .obj files are smaller, because debugging information is stored in the .pdb file rather than in .obj files.
61-
62-
If you create a library from objects that were compiled using this option, the associated .pdb file must be available when the library is linked to a program. Thus, if you distribute the library, you must distribute the PDB.
63-
64-
To create a library that contains debugging information without using .pdb files, you must select the compiler's C 7.0-Compatible (**/Z7**) option. If you use the precompiled headers options, debugging information for both the precompiled header and the rest of the source code is placed in the PDB file. The **/Yd** option is ignored when the Program Database option is specified.
65-
6663
### To set this compiler option in the Visual Studio development environment
6764

6865
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).

0 commit comments

Comments
 (0)