Skip to content

Commit 7b26cf4

Browse files
openpublishbuildColin Robertson
authored andcommitted
Confirm merge from FromPublicMasterBranch to master to sync with https://github.com/MicrosoftDocs/cpp-docs (branch master) (#624)
* Update cricheditctrl-class.md LineLength is a wrapper of EM_LINELENGTH, which returns length in characters not bytes. * Update csettingsstore-class.md contraction between the meaning of bAdmin in the parameters and remarks section of CSettingsStore::CSettingsStore * Update clistbox-class_23.cpp the buffer required by later code would be 16 bytes in ANSI and 32 bytes in Unicode, preallocating 10 bytes is useless. * Fix unwind opcode values * Update algorithm.md Fix minor typo in Remarks section * Undesired indentation in CFile. Fix for undesired indentation in CFile constructor documentation. * Update cricheditctrl-class.md clarify that length is in TCHARs, add situations when index is out of bound, and when there's a carriage return based on EM_LINELENGTH docs * Update compiler-warning-level-4-c4295.md Clarify warning intent and ways to fix it, per comment by Kinichiro_Inoguchi * Fix type error on the namespace * Merge to live for offline publishing (MicrosoftDocs#532) * Confirm merge from FromPublicMasterBranch to master to sync with https://github.com/MicrosoftDocs/cpp-docs (branch master) (#527) * Update cricheditctrl-class.md LineLength is a wrapper of EM_LINELENGTH, which returns length in characters not bytes. * Update csettingsstore-class.md contraction between the meaning of bAdmin in the parameters and remarks section of CSettingsStore::CSettingsStore * Update clistbox-class_23.cpp the buffer required by later code would be 16 bytes in ANSI and 32 bytes in Unicode, preallocating 10 bytes is useless. * Fix unwind opcode values * Update algorithm.md Fix minor typo in Remarks section * Undesired indentation in CFile. Fix for undesired indentation in CFile constructor documentation. * Update cricheditctrl-class.md clarify that length is in TCHARs, add situations when index is out of bound, and when there's a carriage return based on EM_LINELENGTH docs * Update compiler-warning-level-4-c4295.md Clarify warning intent and ways to fix it, per comment by Kinichiro_Inoguchi * Fix type error on the namespace * Add /Zc:ternary switch docs (#525) * Create topic, not linked yet * Include links in TOC and overview * Fix dash * Add link to Zc:ternary to permissive * Fix link typo * fixed up art files for VC++ directories (#529) * CMake updates for 15.6 (#524) * added new content on cmake cache import * added new art for cmake * updates to cmake tools intro * new art for 15.6 updates * updates for environment variables and inherited environments * proofreading pass * updated art for what's new page (MicrosoftDocs#528) * Second attempt at merge (#531) * added new content on cmake cache import * added new art for cmake * updates to cmake tools intro * new art for 15.6 updates * updates for environment variables and inherited environments * proofreading pass * Update cmake-tools-for-visual-cpp.md (MicrosoftDocs#530) I played editor in this file. I only meant to change one thing, but it was hard to stop. * [mkdir-wmkdir.md] Fix wrong indentation Remove redundant spaces in the code. * Change integer limits and header name to use standard names. * Fix double code quote. * Fix indentation [ _rotl ] * Update get-wpgmptr.md Mention entry point restriction on using _get_wpgmptr() - only for programs for wide entry points. * Update get-pgmptr.md Mention entry point restriction on calling _get_pgmptr * Fix formatting * Remove __declspec(noalias) from example Remove __declspec(noalias) from example to make it clearer what is going on. I'm submitting a second PR that updates __declspec(alias) to have its own example. Clean up other text. * Remove __declspec(restrict) from example Remove __declspec(restrict) from example to make it clearer what is going on. I'm submitting a second PR that updates __declspec(restrict) to have its own example. Clean up other text. * Update compiler-error-c2512.md Expand explanations to address some common confusion. Remove examples that now generate different errors. * Update date for changed article * Update date, formatting and some wording. * Update date, additional language cleanup * Update char-wchar-t-char16-t-char32-t.md Address issue #169 Fix dangling "Unicode is the" fragment. Expand explanation of types and where they are used. * Update char-wchar-t-char16-t-char32-t.md Fix date and pointer/array mention. * Fix links to samples and interface * "Users" of the C++ compiler are "developers" Users of the C++ compiler are generally developers. Isn't it a bit more precise and a bit more humanizing to refer to them as such? * Typo fixed in __popcnt * Update indirection-and-address-of-operators.md Bring descriptions into compliance with C99 standard (as of 2007). Fix some formatting issues. * Update configuring-programs-for-windows-xp.md Fix typo. * Update set-se-translator.md (MicrosoftDocs#176) * Update set-se-translator.md Update example with a more complicated pattern so that the compiler doesn't optimize out the exception generation when directed to be optimizing. Moved _set_se_translator out of the "try" as having it is very dangerous because it's possible an exception occurs beforehand and this function would not be called. Fixed spacing issues in code examples. * Update set-se-translator.md Modernize code examples slightly, build /W4 clean. Clean up formatting, lint markdown. * Update date in _set_se_translator.md Missed the date earlier. * Fix date some more in _set_se_translator * Update c4473.md Fix missing "the" * Capitalization of 'M' in CMake * Oops * Note that /ZI is incompatible with LINE macro (MicrosoftDocs#177) * Note that /ZI is incompatible with LINE macro See this bug for context: https://developercommunity.visualstudio.com/content/problem/195665/-line-cannot-be-used-as-an-argument-for-constexpr.html * Update z7-zi-zi-debug-information-format.md Do a light edit pass over the entire document. * Update z7-zi-zi-debug-information-format.md Add useful link to Edit and Continue doc
1 parent 2d5e860 commit 7b26cf4

File tree

2 files changed

+74
-77
lines changed

2 files changed

+74
-77
lines changed
Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,82 @@
11
---
22
title: "-Z7, -Zi, -ZI (Debug Information Format) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
5-
ms.reviewer: ""
6-
ms.suite: ""
4+
ms.date: "02/22/2018"
75
ms.technology: ["cpp-tools"]
8-
ms.tgt_pltfrm: ""
9-
ms.topic: "article"
10-
f1_keywords: ["VC.Project.VCCLCompilerTool.DebugInformationFormat", "/zi", "/z7", "VC.Project.VCCLWCECompilerTool.DebugInformationFormat"]
6+
ms.topic: "reference"
7+
f1_keywords: ["VC.Project.VCCLCompilerTool.DebugInformationFormat", "/ZI", "/Zi", "/Z7", "VC.Project.VCCLWCECompilerTool.DebugInformationFormat"]
118
dev_langs: ["C++"]
12-
helpviewer_keywords: ["C7 compatible compiler option [C++]", "-Zl compiler option [C++]", "Debug Information Format compiler option", "ZI compiler option", "-Zi compiler option [C++]", "/ZI compiler option [C++]", "Z7 compiler option [C++]", "debugging [C++], debug information files", "Zi compiler option [C++]", "none compiler option [C++]", "/Zi compiler option [C++]", "program database compiler option [C++]", "full symbolic debugging information", "/Z7 compiler option [C++]", "line numbers only compiler option [C++]", "cl.exe compiler, debugging options", "-Z7 compiler option [C++]"]
13-
ms.assetid: ce9fa7e1-0c9b-47e3-98ea-26d1a16257c8
14-
caps.latest.revision: 21
9+
helpviewer_keywords: ["C7 compatible compiler option [C++]", "Debug Information Format compiler option", "ZI compiler option", "-Zi compiler option [C++]", "/ZI compiler option [C++]", "Z7 compiler option [C++]", "debugging [C++], debug information files", "Zi compiler option [C++]", "/Zi compiler option [C++]", "program database compiler option [C++]", "full symbolic debugging information", "/Z7 compiler option [C++]", "line numbers only compiler option [C++]", "cl.exe compiler, debugging options", "-Z7 compiler option [C++]"]
1510
author: "corob-msft"
1611
ms.author: "corob"
1712
manager: "ghogen"
1813
ms.workload: ["cplusplus"]
1914
---
2015
# /Z7, /Zi, /ZI (Debug Information Format)
21-
Select the type of debugging information created for your program and whether this information is kept in object (.obj) files or in a program database (PDB).
22-
23-
## Syntax
24-
25-
```
26-
/Z{7|i|I}
27-
```
28-
29-
## Remarks
30-
The options are described in the following table.
31-
32-
None
33-
Produces no debugging information, so compilation is faster.
34-
35-
**/Z7**
36-
Produces an .obj file 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 is produced.
37-
38-
For distributors of third-party libraries, there is an advantage to not having a .pdb file. However, the .obj files for the precompiled headers are necessary during the link phase, and debugging. If there is only type information (and no code) in the .pch object files, you will also have to compile with [/Yl (Inject PCH Reference for Debug Library)](../../build/reference/yl-inject-pch-reference-for-debug-library.md).
39-
40-
**/Zi**
41-
Produces a program database (PDB) 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.
42-
43-
**/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.
44-
45-
Type information is placed in the .pdb file, and not in the .obj file.
46-
47-
You can use [/Gm (Enable Minimal Rebuild)](../../build/reference/gm-enable-minimal-rebuild.md) with **/Zi**, whereas **/Gm** is not available when compiling with **/Z7**.
48-
49-
When compiling with **/Zi** and **/clr**, the <xref:System.Diagnostics.DebuggableAttribute> attribute will not be placed in the assembly metadata; you must specify it in source code, if you want it. 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-
51-
**/ZI**
52-
Produces a program database, as described above, in a format that supports the Edit and Continue feature. If you want to use Edit and Continue debugging, you must use this option. Because most optimizations are incompatible with Edit and Continue, using **/ZI** disables any `#pragma optimize` statements in your code.
53-
54-
**/ZI** causes [/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) to be used in your compilation.
55-
56-
**/ZI** is not compatible with [/clr (Common Language Runtime Compilation)](../../build/reference/clr-common-language-runtime-compilation.md).
57-
16+
17+
Specifies the type of debugging information created for your program and whether this information is kept in object files or in a program database (PDB) file.
18+
19+
## Syntax
20+
21+
> **/Z**{**7**|**i**|**I**}
22+
23+
## Remarks
24+
25+
The debug information format options are described in the following sections.
26+
27+
### None
28+
29+
By default, if no debug information format option is specified, the compiler produces no debugging information, so compilation is faster.
30+
31+
### /Z7
32+
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.
34+
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.
36+
37+
### /Zi
38+
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.
40+
41+
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.
42+
43+
When **/Zi** is specified, type information is placed in the PDB file, and not in the object file.
44+
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+
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).
48+
49+
### /ZI
50+
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.
52+
53+
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.
54+
55+
**/ZI** is not compatible with [/clr (Common Language Runtime Compilation)](../../build/reference/clr-common-language-runtime-compilation.md).
56+
5857
> [!NOTE]
59-
> **/ZI** is only available in the compilers targeting x86 and x64 processors; this compiler option is not available in the compilers targeting ARM processors.
60-
61-
The compiler names the program database *project*.pdb. If you compile a file without a project, the compiler creates a database named VC*x*0.pdb., where *x* is the major version of [!INCLUDE[vcprvc](../../build/includes/vcprvc_md.md)] 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 will be smaller, because debugging information is stored in the .pdb file rather than in .obj files.
62-
63-
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.
64-
65-
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. The **/Yd** option is ignored when the Program Database option is specified.
66-
67-
### To set this compiler option in the Visual Studio development environment
68-
69-
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
70-
71-
2. Click the **C/C++** folder.
72-
73-
3. Click the **General** property page.
74-
75-
4. Modify the **Debug Information Format** property.
76-
77-
### To set this compiler option programmatically
78-
79-
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.DebugInformationFormat%2A>.
80-
81-
## See Also
82-
[Compiler Options](../../build/reference/compiler-options.md)
83-
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
58+
> 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.
59+
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+
66+
### To set this compiler option in the Visual Studio development environment
67+
68+
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
69+
70+
1. Open the **Configuration Properties** > **C/C++** > **General** property page.
71+
72+
1. Modify the **Debug Information Format** property. Choose **OK** to save your changes.
73+
74+
### To set this compiler option programmatically
75+
76+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.DebugInformationFormat%2A>.
77+
78+
## See also
79+
80+
[Compiler Options](../../build/reference/compiler-options.md)
81+
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
82+

docs/ide/cmake-tools-for-visual-cpp.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ usage: ninja [options] [targets...]
243243
| -w FLAG | adjust warnings (use -w list to list warnings)|
244244

245245
### Inherited environments (Visual Studio 2017 version 15.5)
246-
247-
CmakeSettings.json now supports inherited environments. This feature enables you to (1) inherit default environments and (2) create custom environment variables that are passed to CMake.exe when it runs.
246+
CMakeSettings.json now supports inherited environments. This feature enables you to (1) inherit default environments and (2) create custom environment variables that are passed to CMake.exe when it runs.
248247

249248
```json
250249
"inheritEnvironments": [ "msvc_x64_x64" ]
@@ -266,7 +265,7 @@ The following table shows the default values and their command line equivalents:
266265
|msvc_arm64_x64|Compile for ARM64 using 64-bit tools|
267266

268267
### Custom environment variables
269-
In CmakeSettings.json, you can define custom environment variables globally or per-configuration in the **environments** property. The following example defines one global variable, **BuildDir**, which is inherited in both the x86-Debug and x64-Debug configurations. Each configuration uses the variable to specify the value for the **buildRoot** property for that configuration. Note also how each configuration uses the **inheritEnvironments** property to specify a variable that applies only to that configuration.
268+
In CMakeSettings.json, you can define custom environment variables globally or per-configuration in the **environments** property. The following example defines one global variable, **BuildDir**, which is inherited in both the x86-Debug and x64-Debug configurations. Each configuration uses the variable to specify the value for the **buildRoot** property for that configuration. Note also how each configuration uses the **inheritEnvironments** property to specify a variable that applies only to that configuration.
270269

271270
```json
272271
{
@@ -285,8 +284,7 @@ In CmakeSettings.json, you can define custom environment variables globally or p
285284
"configurationType": "Debug",
286285
// Inherit the defaults for using the MSVC x86 compiler.
287286
"inheritEnvironments": [ "msvc_x86" ],
288-
"buildRoot": "${env.BuildDir}\\${name}"
289-
},
287+
"buildRoot": "${env.BuildDir}\\${name}" },
290288
{
291289
"name": "x64-Debug",
292290
"generator": "Ninja",
@@ -341,7 +339,7 @@ In the next example, the x86-Debug configuration defines its own value for the *
341339
}
342340
```
343341

344-
## Cmake configure step
342+
## CMake configure step
345343

346344
When significant changes are made to the CMakeSettings.json or to CMakeLists.txt files, Visual Studio automatically re-runs the CMake configure step. If the configure step finishes without errors, the information that is collected is available in C++ IntelliSense and language services and also in build and debug operations.
347345

0 commit comments

Comments
 (0)