Skip to content

Commit 49abb91

Browse files
authored
Merge pull request #5252 from MicrosoftDocs/main638780022157815412sync_temp
Repo sync for protected branch
2 parents c1787d6 + 986f2ab commit 49abb91

File tree

6 files changed

+141
-19
lines changed

6 files changed

+141
-19
lines changed

docs/build/how-to-debug-a-release-build.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
---
22
description: "Learn more about: How to: Debug a Release Build"
33
title: "How to: Debug a Release Build"
4-
ms.date: "11/04/2016"
4+
ms.date: 03/14/2025
55
helpviewer_keywords: ["debugging [C++], release builds", "release builds, debugging"]
6-
ms.assetid: d333e4d1-4e6c-4384-84a9-cb549702da25
76
---
87
# How to: Debug a Release Build
98

10-
You can debug a release build of an application.
9+
This article explains which compiler and linker switches to set to enable you to debug a release build of an application.
1110

12-
### To debug a release build
11+
A better experience is available starting in Visual Studio 2022 version 17.14 that allows you to debug optimized code as if it were compiled unoptimized, while retaining the speed of optimized code. For more information, see [C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging).
1312

14-
1. Open the **Property Pages** dialog box for the project. For details, see [Set C++ compiler and build properties in Visual Studio](working-with-project-properties.md).
13+
## To debug a release build
1514

15+
1. Open the **Property Pages** dialog box for the project. For details, see [Set C++ compiler and build properties in Visual Studio](working-with-project-properties.md).
1616
1. Click the **C/C++** node. Set **Debug Information Format** to [C7 compatible (/Z7)](reference/z7-zi-zi-debug-information-format.md) or **Program Database (/Zi)**.
17-
1817
1. Expand **Linker** and click the **General** node. Set **Enable Incremental Linking** to [No (/INCREMENTAL:NO)](reference/incremental-link-incrementally.md).
19-
20-
1. Select the **Debugging** node. Set **Generate Debug Info** to [Yes (/DEBUG)](reference/debug-generate-debug-info.md).
21-
22-
1. Select the **Optimization** node. Set **References** to [/OPT:REF](reference/opt-optimizations.md) and **Enable COMDAT Folding** to [/OPT:ICF](reference/opt-optimizations.md).
23-
18+
1. Under **Linker**, select the **Debugging** node. Set **Generate Debug Info** to [Yes (/DEBUG)](reference/debug-generate-debug-info.md).
19+
1. Under **Linker**, select the **Optimization** node. Set **References** to [No (/OPT:NOREF)](reference/opt-optimizations.md) and **Enable COMDAT Folding** to [No (/OPT:NOICF)](reference/opt-optimizations.md).
2420
1. You can now debug your release build application. To find a problem, step through the code (or use Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.
2521

2622
If an application works in a debug build, but fails in a release build, one of the compiler optimizations may be exposing a defect in the source code. To isolate the problem, disable selected optimizations for each source code file until you locate the file and the optimization that is causing the problem. (To expedite the process, you can divide the files into two groups, disable optimization on one group, and when you find a problem in a group, continue dividing until you isolate the problem file.)
2723

28-
You can use [/RTC](reference/rtc-run-time-error-checks.md) to try to expose such bugs in your debug builds.
24+
Use [/RTC](reference/rtc-run-time-error-checks.md) to try to expose such bugs in your debug builds.
2925

3026
For more information, see [Optimizing Your Code](optimizing-your-code.md).
3127

docs/build/reference/compiler-options-listed-alphabetically.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Compiler options listed alphabetically"
33
description: "Reference listing in alphabetical order of the Microsoft C/C++ compiler command-line options."
4-
ms.date: 11/13/2023
4+
ms.date: 2/5/2025
55
helpviewer_keywords: ["compiler options, C++"]
66
---
77
# Compiler options listed alphabetically
@@ -37,6 +37,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
3737
| [`/constexpr:depth<N>`](constexpr-control-constexpr-evaluation.md) | Recursion depth limit for `constexpr` evaluation (default: 512). |
3838
| [`/constexpr:steps<N>`](constexpr-control-constexpr-evaluation.md) | Terminate `constexpr` evaluation after N steps (default: 100000) |
3939
| [`/D<name>{=|#}<text>`](d-preprocessor-definitions.md) | Defines constants and macros. |
40+
| [`/dynamicdeopt`](dynamic-deopt.md) | Enable [C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging) and step in anywhere with on-demand function deoptimization. |
4041
| [`/diagnostics`](diagnostics-compiler-diagnostic-options.md) | Diagnostics format: prints column information. |
4142
| [`/diagnostics:caret[-]`](diagnostics-compiler-diagnostic-options.md) | Diagnostics format: prints column and the indicated line of source. |
4243
| [`/diagnostics:classic`](diagnostics-compiler-diagnostic-options.md) | Use legacy diagnostics format. |
@@ -83,7 +84,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
8384
| [`/fsanitize`](fsanitize.md) | Enables compilation of sanitizer instrumentation such as AddressSanitizer. |
8485
| [`/fsanitize-coverage`](fsanitize-coverage.md) | Enables compilation of code coverage instrumentation for libraries such as LibFuzzer. |
8586
| `/Ft<dir>` | Location of the header files generated for `#import`. |
86-
| [`/FU<file>`](fu-name-forced-hash-using-file.md) | Forces the use of a file name, as if it had been passed to the [`#using`](../../preprocessor/hash-using-directive-cpp.md) directive. |
87+
| [`/FU<file>`](fu-name-forced-hash-using-file.md) | Forces the use of a file name, as if it were passed to the [`#using`](../../preprocessor/hash-using-directive-cpp.md) directive. |
8788
| [`/Fx`](fx-merge-injected-code.md) | Merges injected code with the source file. |
8889
| [`/GA`](ga-optimize-for-windows-application.md) | Optimizes for Windows applications. |
8990
| [`/Gd`](gd-gr-gv-gz-calling-convention.md) | Uses the **`__cdecl`** calling convention. (x86 only) |

docs/build/reference/compiler-options-listed-by-category.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Compiler Options Listed by Category"
33
description: "Reference listing by category of the Microsoft C/C++ compiler command-line options."
4-
ms.date: 11/13/2023
4+
ms.date: 2/5/2025
55
helpviewer_keywords: ["compiler options, C++"]
66
---
77
# Compiler options listed by category
@@ -12,6 +12,7 @@ This article contains a categorical list of compiler options. For an alphabetica
1212

1313
| Option | Purpose |
1414
|--|--|
15+
| [`/dynamicdeopt`](dynamic-deopt.md) | Enable [C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging) to debug optimized code as if it had been compiled deoptimized. |
1516
| [`/favor:<blend|AMD64|INTEL64|ATOM>`](favor-optimize-for-architecture-specifics.md) | Produces code that is optimized for a specified architecture, or for a range of architectures. |
1617
| [`/O1`](o1-o2-minimize-size-maximize-speed.md) | Creates small code. |
1718
| [`/O2`](o1-o2-minimize-size-maximize-speed.md) | Creates fast code. |
@@ -208,7 +209,7 @@ This article contains a categorical list of compiler options. For an alphabetica
208209
| [`/Zc:zeroSizeArrayNew[-]`](zc-zerosizearraynew.md) | Call member `new`/`delete` for 0-size arrays of objects (on by default). |
209210
| [`/Ze`](za-ze-disable-language-extensions.md) | Deprecated. Enables C89 language extensions. |
210211
| [`/Zf`](zf.md) | Improves PDB generation time in parallel builds. |
211-
| [`/ZH:[MD5|SHA1|SHA_256]`](zh.md) | Specifies MD5, SHA-1, or SHA-256 for checksums in debug info. |
212+
| [`/ZH`:[MD5|SHA1|SHA_256]](zh.md) | Specifies MD5, SHA-1, or SHA-256 for checksums in debug info. |
212213
| [`/ZI`](z7-zi-zi-debug-information-format.md) | Includes debug information in a program database compatible with Edit and Continue. (x86 only) |
213214
| [`/Zi`](z7-zi-zi-debug-information-format.md) | Generates complete debugging information. |
214215
| [`/Zl`](zl-omit-default-library-name.md) | Removes the default library name from the *`.obj`* file. |
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: "/DYNAMICDEOPT (Support C++ Dynamic Debugging) (Preview)"
3+
description: "Learn more about: /DYNAMICDEOPT (Support C++ Dynamic Debugging)."
4+
ms.date: 03/14/2025
5+
f1_keywords: ["VC.Project.VCLinkerTool.GenerateDynamicDeoptInformation", "/dynamicdeopt"]
6+
helpviewer_keywords: ["DYNAMICDEOPT linker option", "/DYNAMICDEOPT linker option", "-DYNAMICDEOPT linker option", "c++ dynamic debugging"]
7+
---
8+
# | `/DYNAMICDEOPT` (Support C++ Dynamic Debugging) (Preview)
9+
> [!IMPORTANT]
10+
> The `/DYNAMICDEOPT` linker switch is currently in PREVIEW.
11+
> This information relates to a prerelease feature that might be substantially modified before release. Microsoft makes no warranties, expressed or implied, with respect to the information provided here.
12+
13+
The **`/DYNAMICDEOPT`** linker option, when used with the compiler switch [`/dynamicdeopt`](dynamic-deopt.md), enables [C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging), which allows you to debug optimized code as if it were compiled deoptimized and step in anywhere with on-demand function deoptimization.
14+
15+
## Syntax
16+
17+
> **`/DYNAMICDEOPT`**
18+
> **`/DYNAMICDEOPT:SUFFIX=<suffix>`**
19+
> **`/DYNAMICDEOPT:SYNC`**
20+
21+
## Arguments
22+
23+
*`suffix`*\
24+
Specify the file extension for the deoptimized output.
25+
26+
With no options and given `test.cpp` as input, the compiler output includes `test.obj`, `test.exe`, and `test.pdb`, as well as `test.alt.obj`, `test.alt.exe`, and `test.alt.pdb`. This switch allows you to change the suffix for the unoptimized binary build artifacts from `.alt` to something else. If you change the suffix, all files must use the new suffix, and it needs to match the name passed to the compiler using [`/dynamicdeopt:suffix` (Preview)](dynamic-deopt.md). You typically don't use this switch unless you need to avoid filename collisions with other files that you have.
27+
28+
*`SYNC`*\
29+
Builds the deoptimized output after building the optimized output instead of in parallel. By default, the compiler spawns a parallel linker to link the unoptimized binary. This switch makes the second link run serially after the first one. This switch is provided in case this better suits your build environment.
30+
31+
## Remarks
32+
33+
This preview flag, available starting with Visual Studio 2022 Version 17.14 Preview 2, applies only to x64 projects.
34+
35+
### Set this linker option in the Visual Studio development environment
36+
37+
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).
38+
1. Select the **Linker** > **Debugging** property page.
39+
40+
### Set this linker option programmatically
41+
42+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.GenerateDebugInformation%2A>.
43+
44+
## See also
45+
46+
[`/dynamicdeopt` (Enable C++ Dynamic Debugging) (Preview)](dynamic-deopt.md)\
47+
[C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging)\
48+
[MSVC linker reference](linking.md)\
49+
[MSVC linker options](linker-options.md)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: "/dynamicdeopt (Enable C++ Dynamic Debugging (Preview))"
3+
description: "Use the Microsoft C++ compiler option /dynamicdeopt to use C++ Dynamic Debugging."
4+
ms.date: 03/14/2025
5+
f1_keywords: ["/dynamicdeopt", "VC.Project.VCNMakeTool.CompileAsManaged", "VC.Project.VCCLCompilerTool.CompileAsManaged"]
6+
helpviewer_keywords: ["cl.exe compiler, common language runtime option", "-dynamicdeopt compiler option [C++]", "dynamicdeopt compiler option [C++]", "/clr compiler option [C++]", "Managed Extensions for C++, compiling", "common language runtime, /clr compiler option"]
7+
---
8+
# `/dynamicdeopt` (Enable C++ Dynamic Debugging) (Preview)
9+
> [!IMPORTANT]
10+
> The `/dynamicdeopt` compiler switch is currently in PREVIEW.
11+
> This information relates to a prerelease feature that might be substantially modified before release. Microsoft makes no warranties, expressed or implied, with respect to the information provided here.
12+
13+
Enable [C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging) so you can debug optimized code as if it were compiled deoptimized and step in anywhere with on-demand function deoptimization.
14+
15+
## Syntax
16+
17+
> **`/dynamicdeopt`**
18+
> **`/dynamicdeopt:suffix <suffix>`**
19+
> **`/dynamicdeopt:sync`**
20+
21+
## Arguments
22+
23+
*`suffix`*\
24+
Specify the file extension for the deoptimized output.
25+
26+
With no options and given `test.cpp` as input, your output includes `test.obj`, `test.exe`, and `test.pdb`, as well as `test.alt.obj`, `test.alt.exe`, and `test.alt.pdb`. This switch allows you to change the suffix of the unoptimized binary build artifacts from `.alt` to something else. If you change the suffix, all files must use the new suffix, and it needs to match the name passed to the linker using [`/dynamicdeopt:suffix` (Preview)](dynamic-deopt-linker.md). You typically don't use this switch unless you need to avoid filename collisions with other files that you have.
27+
28+
*`sync`*\
29+
Builds the deoptimized output after building the optimized output instead of in parallel. By default, the compiler spawns a parallel instance of the code generator. This switch makes the them run serially, instead. This switch is provided in case this better suits your build environment.
30+
31+
## Remarks
32+
33+
This preview flag, available starting with Visual Studio 2022 Version 17.14 Preview 2, applies only to x64 projects and must be used with the corresponding linker flag, [`/DYNAMICDEOPT`](dynamic-deopt-linker.md).
34+
35+
Compiling with `/dynamicdeopt` generates other binaries that are used for debugging. When you debug an optimized file and debug into an optimized function, the debugger steps into the alternate binary instead. This allows you to debug as if you're debugging unoptimized code while still getting the performance advantages of optimized code.
36+
37+
`/dynamicdeopt` requires:
38+
39+
`/DEBUG` or `/DEBUG:FULL`. If you don't specify `/DEBUG`, or if you specify `/DEBUG:FASTLINK`, the linker gives a fatal error.
40+
If you specify `/INCREMENTAL`, the compiler generates a warning and automatically turns off `/INCREMENTAL`.
41+
If you specify `/OPT:ICF`, the compiler generates a warning that the debug experience isn't as good. This is because ICF can cause functions to be removed from the alt file, which means you can't step into them.
42+
43+
`/dynamicdeopt` is incompatible with edit-and-continue and the following compiler switches:
44+
45+
```cpp
46+
/GL
47+
/ZI
48+
/RTC1
49+
/RTCs
50+
/RTCc
51+
/RTCu
52+
/GH
53+
/Gh
54+
/fastcap
55+
/callcap
56+
/ZW
57+
fsanitize=address
58+
fsanitize=kernel-address
59+
All of the CLR flags
60+
```
61+
62+
### Set this linker option in the Visual Studio development environment
63+
64+
You can set this switch inside Visual Studio. For more information, see [C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging#build-system-integration). There are advantages to setting the switch in Visual Studio because MSBuild automatically suppresses some of the incompatible switches such as `/GL` and `/OPT:ICF`. It also sets the corresponding linker option (`/DYNAMICDEOPT`). You can also set the switch in the command line.
65+
66+
### Set this compiler option programmatically
67+
68+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.CompileAsManaged>.
69+
70+
## See also
71+
72+
[C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging)\
73+
[MSVC Compiler Options](compiler-options.md)\
74+
[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md)

docs/build/reference/linker-options.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
title: "MSVC Linker options"
33
description: "A list of the options supported by the Microsoft LINK linker."
4-
ms.date: 06/10/2024
4+
ms.date: 03/14/2025
55
f1_keywords: ["link"]
66
helpviewer_keywords: ["linker [C++]", "linker [C++], options listed", "libraries [C++], linking to COFF", "LINK tool [C++], linker options"]
77
---
88
# Linker options
99

1010
LINK.exe links Common Object File Format (COFF) object files and libraries to create an executable (EXE) file or a dynamic-link library (DLL).
1111

12-
The following table lists options for LINK.exe. For more information about LINK, see:
12+
The following table lists options for `LINK.exe`. For more information about LINK, see:
1313

1414
- [Compiler-controlled LINK options](compiler-controlled-link-options.md)
1515
- [LINK input files](link-input-files.md)
1616
- [LINK output](link-output.md)
1717
- [Reserved words](reserved-words.md)
1818

19-
On the command line, linker options aren't case-sensitive; for example, `/base` and `/BASE` mean the same thing. For details on how to specify each option on the command line or in Visual Studio, see the documentation for that option.
19+
Linker options aren't case-sensitive; for example, `/base` and `/BASE` mean the same thing. For details on how to specify each option on the command line or in Visual Studio, see the documentation for that option.
2020

2121
You can use the [`comment`](../../preprocessor/comment-c-cpp.md) pragma to specify some linker options.
2222

@@ -52,6 +52,7 @@ You can use the [`comment`](../../preprocessor/comment-c-cpp.md) pragma to speci
5252
| [`/DLL`](dll-build-a-dll.md) | Builds a DLL. |
5353
| [`/DRIVER`](driver-windows-nt-kernel-mode-driver.md) | Creates a kernel mode driver. |
5454
| [`/DYNAMICBASE`](dynamicbase-use-address-space-layout-randomization.md) | Specifies whether to generate an executable image that's rebased at load time by using the address space layout randomization (ASLR) feature. |
55+
| [`/DYNAMICDEOPT`](dynamic-deopt-linker.md) | Enable [C++ Dynamic Debugging (Preview)](/visualstudio/debugger/cpp-dynamic-debugging) and step in anywhere with on-demand function deoptimization. |
5556
| [`/ENTRY`](entry-entry-point-symbol.md) | Sets the starting address. |
5657
| [`/ERRORREPORT`](errorreport-report-internal-linker-errors.md) | Deprecated. Error reporting is controlled by [Windows Error Reporting (WER)](/windows/win32/wer/windows-error-reporting) settings. |
5758
| [`/EXPORT`](export-exports-a-function.md) | Exports a function. |

0 commit comments

Comments
 (0)