You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Causes a call to the `_penter` function at the start of every method or function.
11
12
12
13
## Syntax
13
14
14
-
```
15
-
/Gh
16
-
```
15
+
> **`/Gh`**
17
16
18
17
## Remarks
19
18
20
-
The `_penter` function is not part of any library and it is up to you to provide a definition for `_penter`.
19
+
The `_penter` function isn't part of any library. It's up to you to provide a definition for `_penter`.
21
20
22
-
Unless you plan to explicitly call `_penter`, you do not need to provide a prototype. The function must appear as if it had the following prototype, and it must push the content of all registers on entry and pop the unchanged content on exit:
21
+
Unless you plan to explicitly call `_penter`, you don't need to provide a prototype. The function must push the content of all registers on entry and pop the unchanged content on exit. It must appear as if it had the following prototype:
23
22
24
23
```cpp
25
24
void__declspec(naked) __cdecl _penter( void );
26
25
```
27
26
28
-
This declaration is not available for 64-bit projects.
27
+
This declaration isn't available for 64-bit projects.
29
28
30
29
### To set this compiler option in the Visual Studio development environment
31
30
32
31
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
33
32
34
-
1. Click the **C/C++** folder.
35
-
36
-
1. Click the **Command Line** property page.
33
+
1. Open the **Configuration Properties** > **C/C++** > **Command Line** property page.
37
34
38
-
1. Type the compiler option in the **Additional Options** box.
35
+
1. Enter the compiler option in the **Additional Options** box.
39
36
40
37
### To set this compiler option programmatically
41
38
42
39
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
43
40
44
41
## Example
45
42
46
-
The following code, when compiled with **/Gh**, shows how `_penter` is called twice; once when entering function `main` and once when entering function `x`.
43
+
The following code, when compiled with **/Gh**, shows how `_penter` is called twice; once when entering function `main` and once when entering function `x`. The example consists of two source files, which you compile separately.
Calls the `_pexit` function at the end of every method or function.
11
12
12
13
## Syntax
13
14
14
-
```
15
-
/GH
16
-
```
15
+
> **`/GH`**
17
16
18
17
## Remarks
19
18
20
-
The `_pexit` function is not part of any library and it is up to you to provide a definition for `_pexit`.
19
+
The `_pexit` function isn't part of any library. It's up to you to provide a definition for `_pexit`.
21
20
22
-
Unless you plan to explicitly call `_pexit`, you do not need to provide a prototype. The function must appear as if it had the following prototype, and it must push the content of all registers on entry and pop the unchanged content on exit:
21
+
Unless you plan to explicitly call `_pexit`, you don't need to provide a prototype. The function must push the content of all registers on entry and pop the unchanged content on exit. It must appear as if it had the following prototype:
23
22
24
23
```cpp
25
24
void__declspec(naked) __cdecl _pexit( void );
26
25
```
27
26
28
-
`_pexit` is similar to `_penter`; see [/Gh (Enable _penter Hook Function)](gh-enable-penter-hook-function.md) for an example of how to write a `_pexit` function.
27
+
This declaration isn't available for 64-bit projects.
28
+
29
+
`_pexit` is similar to `_penter`; see [`/Gh` (Enable _penter Hook Function)](gh-enable-penter-hook-function.md) for an example of how to write a `_penter` function.
29
30
30
31
### To set this compiler option in the Visual Studio development environment
31
32
32
33
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
33
34
34
-
1. Click the **C/C++** folder.
35
-
36
-
1. Click the **Command Line** property page.
35
+
1. Open the **Configuration Properties** > **C/C++** > **Command Line** property page.
37
36
38
-
1. Type the compiler option in the **Additional Options** box.
37
+
1. Enter the compiler option in the **Additional Options** box.
39
38
40
39
### To set this compiler option programmatically
41
40
42
41
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
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.
9
+
The **`/Z7`**, **`/Zi`**, and **`/ZI`** compiler options specify 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.
10
10
11
11
## Syntax
12
12
13
-
> **/Z**{**7**|**i**|**I**}
13
+
> **`/Z7`**\
14
+
> **`/Zi`**\
15
+
> **`/ZI`**
14
16
15
17
## Remarks
16
18
17
-
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.
19
+
When you specify a debug option, the compiler produces symbol names for functions and variables, type information, and line 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.
18
20
19
21
### None
20
22
21
23
By default, if no debug information format option is specified, the compiler produces no debugging information, so compilation is faster.
22
24
23
25
### /Z7
24
26
25
-
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.
27
+
The **`/Z7`** option produces object files that also contain full symbolic debugging information for use with the debugger. These object files and any libraries built from them can be substantially larger than files that have no debugging information. The symbolic debugging information includes the names and types of variables, functions, and line numbers. No PDB file is produced by the compiler. However, a PDB file can still be generated from these object files or libraries if the linker is passed the **`/DEBUG`** option.
26
28
27
-
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)](yl-inject-pch-reference-for-debug-library.md) option, which is enabled by default, when you build the library.
29
+
For distributors of debug versions of third-party libraries, there's 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's only type information (and no code) in the *`.pch`* object file, you must also use the [`/Yl` (Inject PCH Reference for Debug Library)](yl-inject-pch-reference-for-debug-library.md) option, which is enabled by default, when you build the library.
28
30
29
-
The deprecated [/Gm (Enable Minimal Rebuild)](gm-enable-minimal-rebuild.md) option is not available when **/Z7** is specified.
31
+
The deprecated [`/Gm` (Enable Minimal Rebuild)](gm-enable-minimal-rebuild.md) option is unavailable when **`/Z7`** is specified.
30
32
31
33
### /Zi
32
34
33
-
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.
35
+
The **`/Zi`** option produces a separate PDB file that contains all the symbolic debugging information for use with the debugger. The debugging information isn't included in the object files or executable, which makes them much smaller.
34
36
35
-
Use of **/Zi**does not affect optimizations. However, **/Zi** does imply **/debug**; see [/DEBUG (Generate Debug Info)](debug-generate-debug-info.md) for more information.
37
+
Use of **`/Zi`**doesn't affect optimizations. However, **`/Zi`** does imply **`/debug`**. For more information, see [`/DEBUG` (Generate Debug Info)](debug-generate-debug-info.md).
36
38
37
-
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).
39
+
When you specify both **`/Zi`** and **`/clr`**, the <xref:System.Diagnostics.DebuggableAttribute> attribute isn't 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).
38
40
39
-
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.
41
+
The compiler names the PDB file *`<project>.pdb`*, where *`<project>`* is the name of your project. 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. This name and signature point 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 doesn't have a similar option to load mismatched symbols.
40
42
41
-
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.
43
+
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. That means, 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.
42
44
43
45
### /ZI
44
46
45
-
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 [__LINE__ predefined macro](../../preprocessor/predefined-macros.md); code compiled with **/ZI**cannot use **__LINE__** as a non-type template argument, although **__LINE__** can be used in macro expansions.
47
+
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 [`__LINE__` predefined macro](../../preprocessor/predefined-macros.md); code compiled with **`/ZI`**can't use `__LINE__` as a non-type template argument, although `__LINE__` can be used in macro expansions.
46
48
47
-
The **/ZI** option forces both the [/Gy (Enable Function-Level Linking)](gy-enable-function-level-linking.md) and [/FC (Full Path of Source Code File in Diagnostics)](fc-full-path-of-source-code-file-in-diagnostics.md) options to be used in your compilation.
49
+
The **`/ZI`** option forces both the [`/Gy` (Enable Function-Level Linking)](gy-enable-function-level-linking.md) and [`/FC` (Full Path of Source Code File in Diagnostics)](fc-full-path-of-source-code-file-in-diagnostics.md) options to be used in your compilation.
48
50
49
-
**/ZI** is not compatible with [/clr (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md).
51
+
**`/ZI`** is incompatible with [`/clr` (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md).
50
52
51
53
> [!NOTE]
52
-
> 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.
54
+
> 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.
53
55
54
56
### To set this compiler option in the Visual Studio development environment
55
57
@@ -65,5 +67,5 @@ The **/ZI** option forces both the [/Gy (Enable Function-Level Linking)](gy-enab
0 commit comments