Skip to content

Commit 7ac8916

Browse files
authored
Merge pull request #2352 from iRaindrop/vbruham_debugger_d
Visual Studio Debugger CATS QA: M - end
2 parents e354db7 + 73362ff commit 7ac8916

22 files changed

+106
-117
lines changed

docs/debugger/macros-for-reporting.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ ms.workload:
2626
- "multiple"
2727
---
2828
# Macros for Reporting
29-
You can use the **_RPTn**, and **_RPTFn** macros, defined in CRTDBG.H, to replace the use of `printf` statements for debugging. These macros automatically disappear in your release build when **_DEBUG** is not defined, so there is no need to enclose them in **#ifdef**s.
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 inclose them in **#ifdef**s, because they automatically disappear in your release build when **_DEBUG** isn't defined.
3030

3131
|Macro|Description|
3232
|-----------|-----------------|
3333
|**_RPT0**, **_RPT1**, **_RPT2**, **_RPT3**, **_RPT4**|Outputs a message string and zero to four arguments. For _RPT1 through **_RPT4**, the message string serves as a printf-style formatting string for the arguments.|
34-
|**_RPTF0**, **_RPTF1**, **,_RPTF2**, **_RPTF4**|Same as **_RPTn**, but these macros also output the file name and line number where the macro is located.|
34+
|**_RPTF0**, **_RPTF1**, **_RPTF2**, **_RPTF4**|Same as **_RPTn**, but these macros also output the file name and line number where the macro is located.|
3535

3636
Consider the following example:
3737

38-
```
38+
```cpp
3939
#ifdef _DEBUG
4040
if ( someVar > MAX_SOMEVAR )
4141
printf( "OVERFLOW! In NameOfThisFunc( ),
@@ -46,13 +46,13 @@ You can use the **_RPTn**, and **_RPTFn** macros, defined in CRTDBG.H, to replac
4646

4747
This code outputs the values of `someVar` and `otherVar` to **stdout**. You can use the following call to `_RPTF2` to report these same values and, additionally, the file name and line number:
4848

49-
```
49+
```cpp
5050
if (someVar > MAX_SOMEVAR) _RPTF2(_CRT_WARN, "In NameOfThisFunc( ), someVar= %d, otherVar= %d\n", someVar, otherVar );
5151
```
5252

53-
If you find that a particular application needs debug reporting that the macros supplied with the C run-time library do not provide, you can write a macro designed specifically to fit your own requirements. In one of your header files, for example, you could include code like the following to define a macro called **ALERT_IF2**:
53+
You might find that a particular application needs debug reporting that the macros supplied with the C run-time library do not provide. For these cases, you can write a macro designed specifically to fit your own requirements. In one of your header files, for example, you could include code like the following to define a macro called **ALERT_IF2**:
5454

55-
```
55+
```cpp
5656
#ifndef _DEBUG /* For RELEASE builds */
5757
#define ALERT_IF2(expr, msg, arg1, arg2) do {} while (0)
5858
#else /* For DEBUG builds */
@@ -66,14 +66,14 @@ if (someVar > MAX_SOMEVAR) _RPTF2(_CRT_WARN, "In NameOfThisFunc( ), someVar= %d,
6666
#endif
6767
```
6868

69-
One call to **ALERT_IF2** could perform all the functions of the **printf** code at the start of this topic:
69+
One call to **ALERT_IF2** could do all the functions of the **printf** code:
7070

71-
```
71+
```cpp
7272
ALERT_IF2(someVar > MAX_SOMEVAR, "OVERFLOW! In NameOfThisFunc( ),
7373
someVar=%d, otherVar=%d.\n", someVar, otherVar );
7474
```
7575
76-
Because a custom macro can easily be changed to report more or less information to different destinations (depending on what is more convenient), this approach can be particularly useful as your debugging requirements evolve.
76+
You can easily change a custom macro to report more or less information to different destinations. This approach is particularly useful as your debugging requirements evolve.
7777
7878
## See Also
79-
[CRT Debugging Techniques](../debugger/crt-debugging-techniques.md)
79+
[CRT Debugging Techniques](../debugger/crt-debugging-techniques.md)

docs/debugger/managing-exceptions-with-the-debugger.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ If you select an exception in the **Exception Settings** window, debugger execut
8787

8888
If you have **AccessViolationException** checked in **Exception Settings**, when you run this code in the debugger execution will break on the `throw` line. You can then continue execution. The console should display both lines:
8989

90-
```
90+
```cmd
9191
caught exception
9292
goodbye
9393
```
@@ -191,4 +191,4 @@ To add conditional exceptions, choose the **Edit condition** icon in the Excepti
191191
[How to: Examine System Code After an Exception](../debugger/how-to-examine-system-code-after-an-exception.md)
192192
[How to: Use Native Run-Time Checks](../debugger/how-to-use-native-run-time-checks.md)
193193
[Using Run-Time Checks Without the C Run-Time Library](../debugger/using-run-time-checks-without-the-c-run-time-library.md)
194-
[Debugger Basics](../debugger/debugger-basics.md)
194+
[Debugger Basics](../debugger/debugger-basics.md)

docs/debugger/mfc-debugging-techniques.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ If you are debugging an MFC program, these debugging techniques may be useful.
5959
## <a name="BKMK_AfxDebugBreak"></a> AfxDebugBreak
6060
MFC provides a special [AfxDebugBreak](/cpp/mfc/reference/diagnostic-services#afxdebugbreak) function for hard-coding breakpoints in source code:
6161

62-
```
62+
```cpp
6363
AfxDebugBreak( );
6464

6565
```
6666
6767
On Intel platforms, `AfxDebugBreak` produces the following code, which breaks in source code rather than kernel code:
6868
69-
```
69+
```cpp
7070
_asm int 3
7171
```
7272

@@ -81,7 +81,7 @@ _asm int 3
8181

8282
The following examples show some of the ways you can use the **TRACE** macro. Like `printf`, the **TRACE** macro can handle a number of arguments.
8383

84-
```
84+
```cpp
8585
int x = 1;
8686
int y = 16;
8787
float z = 32.0;
@@ -96,7 +96,7 @@ TRACE( "x = %d and y = %x and z = %f\n", x, y, z );
9696
9797
The TRACE macro appropriately handles both char* and wchar_t\* parameters. The following examples demonstrate the use of the TRACE macro together with different types of string parameters.
9898
99-
```
99+
```cpp
100100
TRACE( "This is a test of the TRACE macro that uses an ANSI string: %s %d\n", "The number is:", 2);
101101
102102
TRACE( L"This is a test of the TRACE macro that uses a UNICODE string: %s %d\n", L"The number is:", 2);
@@ -117,7 +117,7 @@ TRACE( _T("This is a test of the TRACE macro that uses a TCHAR string: %s %d\n")
117117

118118
If you do not want to rewrite your entire program to use `DEBUG_NEW` in place of **new**, you can define this macro in your source files:
119119

120-
```
120+
```cpp
121121
#define new DEBUG_NEW
122122
```
123123
@@ -162,7 +162,7 @@ TRACE( _T("This is a test of the TRACE macro that uses a TCHAR string: %s %d\n")
162162
163163
This example shows what the code looks like:
164164
165-
```
165+
```cpp
166166
// Declare the variables needed
167167
#ifdef _DEBUG
168168
CMemoryState oldMemState, newMemState, diffMemState;
@@ -194,7 +194,7 @@ TRACE( _T("This is a test of the TRACE macro that uses a TCHAR string: %s %d\n")
194194
195195
Consider the following example:
196196
197-
```
197+
```cpp
198198
if( diffMemState.Difference( oldMemState, newMemState ) )
199199
{
200200
TRACE( "Memory leaked!\n" );
@@ -204,7 +204,7 @@ if( diffMemState.Difference( oldMemState, newMemState ) )
204204

205205
A sample dump from the example looks like this:
206206

207-
```
207+
```cpp
208208
0 bytes in 0 Free Blocks
209209
22 bytes in 1 Object Blocks
210210
45 bytes in 4 Non-Object Blocks
@@ -235,7 +235,7 @@ Total allocations: 67 bytes
235235
236236
The following code tests for a memory leak by comparing two memory states and dumps all objects if a leak is detected.
237237

238-
```
238+
```cpp
239239
if( diffMemState.Difference( oldMemState, newMemState ) )
240240
{
241241
TRACE( "Memory leaked!\n" );
@@ -245,7 +245,7 @@ if( diffMemState.Difference( oldMemState, newMemState ) )
245245

246246
The contents of the dump look like this:
247247

248-
```
248+
```cmd
249249
Dumping objects ->
250250
251251
{5} strcore.cpp(80) : non-object block at $00A7521A, 9 bytes long
@@ -273,7 +273,7 @@ Phone #: 581-0215
273273
#### <a name="BKMK_Interpreting_memory_dumps"></a> Interpreting memory dumps
274274
Look at this object dump in more detail:
275275

276-
```
276+
```cmd
277277
{5} strcore.cpp(80) : non-object block at $00A7521A, 9 bytes long
278278
{4} strcore.cpp(80) : non-object block at $00A751F8, 5 bytes long
279279
{3} strcore.cpp(80) : non-object block at $00A751D6, 6 bytes long
@@ -288,7 +288,7 @@ Phone #: 581-0215
288288

289289
The program that generated this dump had only two explicit allocations—one on the stack and one on the heap:
290290

291-
```
291+
```cpp
292292
// Do your memory allocations and deallocations.
293293
CString s("This is a frame variable");
294294
// The next object is a heap object.
@@ -305,7 +305,7 @@ CPerson* p = new CPerson( "Smith", "Alan", "581-0215" );
305305
306306
In general, you should not worry about heap objects associated with frame variables because they are automatically deallocated when the frame variables go out of scope. To avoid clutter in your memory diagnostic dumps, you should position your calls to `Checkpoint` so that they are outside the scope of frame variables. For example, place scope brackets around the previous allocation code, as shown here:
307307
308-
```
308+
```cpp
309309
oldMemState.Checkpoint();
310310
{
311311
// Do your memory allocations and deallocations ...
@@ -318,7 +318,7 @@ newMemState.Checkpoint();
318318

319319
With the scope brackets in place, the memory dump for this example is as follows:
320320

321-
```
321+
```cmd
322322
Dumping objects ->
323323
324324
{5} strcore.cpp(80) : non-object block at $00A7521A, 9 bytes long
@@ -341,7 +341,7 @@ Phone #: 581-0215
341341

342342
For objects allocated on the heap, however, you must explicitly delete the object to prevent a memory leak. To clean up the last memory leak in the previous example, delete the `CPerson` object allocated on the heap, as follows:
343343

344-
```
344+
```cpp
345345
{
346346
// Do your memory allocations and deallocations.
347347
CString s("This is a frame variable");
@@ -362,7 +362,7 @@ Phone #: 581-0215
362362

363363
The declaration of the `Dump` function looks like this:
364364

365-
```
365+
```cpp
366366
class CPerson : public CObject
367367
{
368368
public:
@@ -380,7 +380,7 @@ public:
380380

381381
In the following example, the `Dump` function first calls the `Dump` function for its base class. It then writes a short description of each member variable along with the member's value to the diagnostic stream.
382382

383-
```
383+
```cpp
384384
#ifdef _DEBUG
385385
void CPerson::Dump( CDumpContext& dc ) const
386386
{
@@ -396,7 +396,7 @@ void CPerson::Dump( CDumpContext& dc ) const
396396

397397
You must supply a `CDumpContext` argument to specify where the dump output will go. The Debug version of MFC supplies a predefined `CDumpContext` object named `afxDump` that sends output to the debugger.
398398

399-
```
399+
```cpp
400400
CPerson* pMyPerson = new CPerson;
401401
// Set some fields of the CPerson object.
402402
//...

docs/debugger/pseudovariables.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ Pseudovariables are terms used to display certain information in a variable wind
2626
## Example
2727
Suppose you are writing a native code application and want to see the number of handles allocated in your application. In the **Watch** window, you can enter the following pseudovariable in the **Name** column, then press Return to evaluate it:
2828

29-
```
30-
$handles
31-
```
29+
`$handles`
3230

3331
In native code, you can use the pseudovariables shown in this table:
3432

docs/debugger/remote-debugger-port-assignments.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ The Visual Studio Remote Debugger can run as an application or as a background s
4646
## Remote Debugger Ports on Azure
4747
The following ports are used by the remote debugger on Azure. The ports on the cloud service are mapped to the ports on the individual VM. All ports are TCP.
4848

49-
||||
49+
|Connection|Port on Cloud Service|Port on VM|
5050
|-|-|-|
51-
|**Connection**|**Port on Cloud Service**|**Port on VM**|
5251
|Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector|30400|30398|
5352
|Microsoft.WindowsAzure.Plugins.RemoteDebugger.Forwarder|31400|31398|
5453
|Microsoft.WindowsAzure.Plugins.RemoteDebugger.FileUpload|32400|32398|

docs/debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ For information on running the remote debugger as a service, see [Run the remote
209209
In most setups, required ports are opened by the installation of ASP.NET and the remote debugger. However, you may need to verify that ports are open.
210210

211211
> [!NOTE]
212-
> On an Azure VM, you must open ports through the [Network security group](/azure/virtual-machines/virtual-machines-windows-hero-role#open-port-80).
212+
> On an Azure VM, you must open ports through the [Network security group](/azure/virtual-machines/virtual-machines-windows-hero-role#open-port-80-for-web-traffic).
213213

214214
Required ports:
215215

docs/debugger/remote-debugging-aspnet-on-a-remote-iis-computer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ For information on running the remote debugger as a service, see [Run the remote
193193
In most setups, required ports are opened by the installation of ASP.NET and the remote debugger. However, you may need to verify that ports are open.
194194

195195
> [!NOTE]
196-
> On an Azure VM, you must open ports through the [Network security group](/azure/virtual-machines/virtual-machines-windows-hero-role#open-port-80).
196+
> On an Azure VM, you must open ports through the [Network security group](/azure/virtual-machines/virtual-machines-windows-hero-role#open-port-80-for-web-traffic).
197197
198198
Required ports:
199199

docs/debugger/remote-debugging-azure.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Debugging between two computers connected through a proxy is not supported. Debu
5757

5858
## <a name="remote_debug_azure_app_service"></a> Remote Debug ASP.NET Core on an Azure App Service
5959

60-
From Visual Studio, you can quickly publish and debug your app to a fully provisioned instance of IIS. However, the configuration of IIS is preset and you cannot customize it. For more detailed instructions, see [Deploy an ASP.NET Core web app to Azure using Visual Studio](/aspnet/core/tutorials/publish-to-azure-webapp-using-vs). (If you need the ability to customize IIS, try debugging on an [Azure VM](#BKMK_azure_vm).)
60+
From Visual Studio, you can quickly publish and debug your app to a fully provisioned instance of IIS. However, the configuration of IIS is preset and you cannot customize it. For more detailed instructions, see [Deploy an ASP.NET Core web app to Azure using Visual Studio](/aspnet/core/tutorials/publish-to-azure-webapp-using-vs). (If you need the ability to customize IIS, try debugging on an [Azure VM](#remote_debug_azure_vm).)
6161

6262
#### To deploy the app and remote debug using Server Explorer
6363

@@ -227,7 +227,7 @@ If you have trouble opening the page with the remote debugger download, see [Unb
227227

228228
In most setups, required ports are opened by the installation of ASP.NET and the remote debugger. However, if you are troubleshooting deployment issues and the app is hosted behind a firewall, you may need to verify that the correct ports are open.
229229

230-
On an Azure VM, you must open ports through the [Network security group](/azure/virtual-machines/virtual-machines-windows-hero-role#open-port-80).
230+
On an Azure VM, you must open ports through the [Network security group](/azure/virtual-machines/virtual-machines-windows-hero-role#open-port-80-for-web-traffic).
231231

232232
Required ports:
233233

docs/debugger/remote-debugging-csharp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The debugger cannot deploy Visual C# or Visual Basic desktop applications to a r
9595

9696
15. On the Visual Studio machine, you should see that execution has stopped at the breakpoint.
9797

98-
If you have non-code files that need to be used by the application, you need to include them in the Visual Studio project. Create a project folder for the additional files (in the **Solution Explorer**, click **Add > New Folder**). Then add the files to the folder (in the **Solution Explorer**, click **Add > Existing Item**, then select the files). On the **Properties** page for each file, set **Copy to Output Directory** to **Copy always**.
98+
If you have any non-code files that need to be used by the application, you need to include them in the Visual Studio project. Create a project folder for the additional files (in the **Solution Explorer**, click **Add > New Folder**). Then add the files to the folder (in the **Solution Explorer**, click **Add > Existing Item**, then select the files). On the **Properties** page for each file, set **Copy to Output Directory** to **Copy always**.
9999

100100
## Set Up Debugging with Remote Symbols
101101

docs/debugger/remote-debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ You can find the remote debugger (*msvsmon.exe*) on a computer with Visual Studi
9595

9696
2. Share the **Remote Debugger** folder on the Visual Studio computer.
9797

98-
3. On the remote computer, run *msvsmon.exe*. Follow the [setup instructions](#bkmk_setup).
98+
3. On the remote computer, run *msvsmon.exe*. Follow the [Set up the remote debugger](#Requirements).
9999

100100
> [!TIP]
101101
> For command line installation and command line reference, see the Help page for *msvsmon.exe* by typing ``msvsmon.exe /?`` in the command line on the computer with Visual Studio installed (or go to **Help > Usage** in the remote debugger).

docs/debugger/report-hook-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ ms.workload:
2929
# Report Hook Functions
3030
A report hook function, installed using [_CrtSetReportHook](/cpp/c-runtime-library/reference/crtsetreporthook), is called every time [_CrtDbgReport](/cpp/c-runtime-library/reference/crtdbgreport-crtdbgreportw) generates a debug report. You can use it, among other things, for filtering reports to focus on specific types of allocations. A report hook function should have a prototype like the following:
3131

32-
```
32+
```cpp
3333
int YourReportHook(int nRptType, char *szMsg, int *retVal);
3434
```
3535
3636
The pointer that you pass to **_CrtSetReportHook** is of type **_CRT_REPORT_HOOK**, as defined in CRTDBG.H:
3737
38-
```
38+
```cpp
3939
typedef int (__cdecl *_CRT_REPORT_HOOK)(int, char *, int *);
4040
```
4141

@@ -45,4 +45,4 @@ typedef int (__cdecl *_CRT_REPORT_HOOK)(int, char *, int *);
4545

4646
## See Also
4747
[Debug Hook Function Writing](../debugger/debug-hook-function-writing.md)
48-
[crt_dbg2 Sample](http://msdn.microsoft.com/en-us/21e1346a-6a17-4f57-b275-c76813089167)
48+
[crt_dbg2 Sample](http://msdn.microsoft.com/en-us/21e1346a-6a17-4f57-b275-c76813089167)

docs/debugger/stop-statements-in-visual-basic.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The Visual Basic Stop statement provides a programmatic alternative to setting a
3333

3434
To avoid the necessity of removing Stop statements, you can use conditional compilation:
3535

36-
```
36+
```cpp
3737
#If DEBUG Then
3838
Stop
3939
#Else
@@ -43,17 +43,17 @@ The Visual Basic Stop statement provides a programmatic alternative to setting a
4343

4444
Another alternative is to use an Assert statement instead of the Stop statement. A Debug.Assert statement breaks execution only when a specified condition is not met and is automatically removed when you build a Release version. For more information, see [Assertions in Managed Code](../debugger/assertions-in-managed-code.md). If you want an Assert statement that always breaks execution in the Debug version, you can do this:
4545

46-
```
46+
```csharp
4747
Debug.Assert(false)
4848
```
4949

5050
Yet another alternative is to use the Debug.Fail method:
5151

52-
```
52+
```csharp
5353
Debug.Fail("a clever output string goes here")
5454
```
5555

5656
## See Also
5757
[Debugger Security](../debugger/debugger-security.md)
5858
[C#, F#, and Visual Basic Project Types](../debugger/debugging-preparation-csharp-f-hash-and-visual-basic-project-types.md)
59-
[Debugging Managed Code](../debugger/debugging-managed-code.md)
59+
[Debugging Managed Code](../debugger/debugging-managed-code.md)

docs/debugger/unable-to-connect-to-the-microsoft-visual-studio-remote-debugging-monitor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Visual Studio could not connect to the remote debugger. This message may occur f
7878
- The remote debugger version does not match Visual Studio. To get the correct version of the remote debugger, see [Remote Debugging](../debugger/remote-debugging.md)
7979

8080

81-
## <a name="#valid_name"></a> The requested name was valid, but no data of the requested type was found
81+
## <a name="valid_name"></a> The requested name was valid, but no data of the requested type was found
8282

8383
The remote computer exists, but Visual Studio could not connect to the remote debugger. This message may occur for several reasons:
8484

0 commit comments

Comments
 (0)