Debugging VC ++ – CoderSource.net

  This article does not try to cover all possible details about debugging VC ++. It tries to add some knowledge to the VC++ programmers who are already exposed to some amount of VC++ programming and debugging.

Memory dump:

   Large arrays(esp. character), won’t be able to be viewed in the variables watch window while debugging VC ++. This Memory Dump option provides a nice way to view the values in such large chunks of memory.

   When we try to expand the array in the watch window, the Developer studio prompts “The expansion of this value will take longer time. Do you want to continue?”. Memory dump comes handy in such scenarios. To view the values in memory dump, press ALT+6 or View –>Debug Windows–>Memory.

By default the data is displayed in Byte format. If we have to view this in some other format, click Tools–>Options–>Debug tab–>change memory window format.

Conditional breakpoints:

    Breakpoints in VC++ are good way to reduce the speed of execution for evaluating the programs manually while debugging VC ++. Breakpoints can be executed in two modes viz., conditional breakpoints and unconditional breakpoints.

   Unconditional breakpoints can be set by pressing F9 at the line where the cursor has been placed. After that, execute the program in debug mode by pressing F5. This will ensure execution of the program till the line of breakpoint and break the execution at the breakpoint. Ctrl + F10 will be useful to execute a chunk of lines at a single shot without placing breakpoints, when debugging vc ++.

 Conditional breakpoints while debugging vc ++ are placed by using VC++ Menu–>Edit–>Breakpoints or ALT + F9. We can specify the conditions in the Data tab of the conditional break points window.

Profiling:

   This feature is useful particulary for knowing the execution layouts. Most of the times, we don’t know if a line/function is executed in a program. This feature in VC++, helps in resolving such doubts during debugging vc ++. Click on Project –> Settings –> Link tab and click on the Enable Profiling check box and Build the project. Click Menu Build–>Profile and select the option you want to check. The wizard gives 5 options for evaluation each of them useful at different levels. Select the option and press OK. This will build the profile and show it in the Profile tab (which is normally placed below the workspace window).