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
Copy file name to clipboardExpand all lines: docs/c-runtime-library/crt-debugging-techniques.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,15 +18,15 @@ When you debug a program that uses the C run-time library, these debugging techn
18
18
19
19
The C runtime (CRT) library provides extensive debugging support. To use one of the CRT debug libraries, you must link with [`/DEBUG`](/cpp/build/reference/debug-generate-debug-info) and compile with [`/MDd`, `/MTd`, or `/LDd`](../build/reference/md-mt-ld-use-run-time-library.md).
20
20
21
-
The main definitions and macros for CRT debugging can be found in the`<crtdbg.h>` header file.
21
+
The main definitions and macros for CRT debugging can be found in the`<crtdbg.h>` header file.
22
22
23
23
The functions in the CRT debug libraries are compiled with debug information ([/Z7, /Zd, /Zi, /ZI (Debug Information Format)](../build/reference/z7-zi-zi-debug-information-format.md)) and without optimization. Some functions contain assertions to verify parameters that are passed to them, and source code is provided. With this source code, you can step into CRT functions to confirm that the functions are working as you expect and check for bad parameters or memory states. (Some CRT technology is proprietary and doesn't provide source code for exception handling, floating point, and a few other routines.)
24
24
25
25
For more information on the various run-time libraries you can use, see [C Run-Time Libraries](./crt-library-features.md).
26
26
27
27
## Macros for reporting
28
28
29
-
For debugging, you can use the `_RPTn` and `_RPTFn` macros, defined in`<crtdbg.h>`, to replace the use of `printf` statements. You don't need to enclose them in `#ifdef` directives, because they automatically disappear in your release build when `_DEBUG` isn't defined.
29
+
For debugging, you can use the `_RPTn` and `_RPTFn` macros, defined in`<crtdbg.h>`, to replace the use of `printf` statements. You don't need to enclose them in `#ifdef` directives, because they automatically disappear in your release build when `_DEBUG` isn't defined.
30
30
31
31
| Macro | Description |
32
32
|---|---|
@@ -81,7 +81,7 @@ You can write several kinds of custom debug hook functions that allow you to ins
81
81
82
82
### Client block hook functions
83
83
84
-
If you want to validate or report the contents of the data stored in `_CLIENT_BLOCK` blocks, you can write a function specifically for this purpose. The function that you write must have a prototype similar to the following, as defined in`<crtdbg.h>`:
84
+
If you want to validate or report the contents of the data stored in `_CLIENT_BLOCK` blocks, you can write a function specifically for this purpose. The function that you write must have a prototype similar to the following, as defined in`<crtdbg.h>`:
85
85
86
86
```cpp
87
87
void YourClientDump(void *, size_t)
@@ -91,7 +91,7 @@ In other words, your hook function should accept a `void` pointer to the beginni
91
91
92
92
Once you've installed your hook function using [_CrtSetDumpClient](./reference/crtsetdumpclient.md), it will be called every time a `_CLIENT_BLOCK` block is dumped. You can then use [_CrtReportBlockType](./reference/crtreportblocktype.md) to get information on the type or subtype of dumped blocks.
93
93
94
-
The pointer to your function that you pass to `_CrtSetDumpClient` is of type `_CRT_DUMP_CLIENT`, as defined in`<crtdbg.h>`:
94
+
The pointer to your function that you pass to `_CrtSetDumpClient` is of type `_CRT_DUMP_CLIENT`, as defined in`<crtdbg.h>`:
95
95
96
96
```cpp
97
97
typedefvoid (__cdecl *_CRT_DUMP_CLIENT)
@@ -113,7 +113,7 @@ int YourAllocHook(int nAllocType, void *pvData,
113
113
const unsigned char * szFileName, int nLine )
114
114
```
115
115
116
-
The pointer that you pass to [`_CrtSetAllocHook`](./reference/crtsetallochook.md) is of type `_CRT_ALLOC_HOOK`, as defined in`<crtdbg.h>`:
116
+
The pointer that you pass to [`_CrtSetAllocHook`](./reference/crtsetallochook.md) is of type `_CRT_ALLOC_HOOK`, as defined in`<crtdbg.h>`:
0 commit comments