VC 6.0 Debugging methods

Source: Internet
Author: User

This is my first article, I hope I can persist in writing. Come on


The most annoying thing is the bug, so it is very important to master the Good debugging skills. This article will introduce


1. Start debugging, press F5 or the down arrow icon of the Debug toolbar.

Function: Press the F5, the program enters the debugging, will continue to run to the breakpoint or the end.

2. Add breakpoint, press F9 or debug toolbar's back icon.

Role: During debugging, the program stops at the breakpoint. Commonly used in conjunction with F5. But you are sure that a certain program is not a bug, you can set a breakpoint at the end of this program, and then use F5 directly to run the breakpoint, so that you do not use F10, step by step debugging, especially when the loop, if you determine the loop is no problem, you can directly in the loop behind a statement set a breakpoint, Run the loop once with F5. In addition, I will combine F11 (enter function use), set a breakpoint in the position of the function that I want to debug, and then can run to this breakpoint position directly with F5 (of course you want to make sure that there is no problem in front), in the use of F11, so you can quickly debug the function.

The right line of code that is similar to a breakpoint: System ("PAUSE"), which is required to press any key in the Black window to continue running when running to this line of code. This can be used to watch the code run to the desired state.

3. Tracking statements

F10 represents the execution of the current entire statement, which is plainly a line of running, where functions are executed directly without entering the function. The advantage of this is that it can be debugged step-by-step to see where the problem is.

F11 into the function, the functions described here include our own functions, also included in the computer's own functions such as CIN, you can press F5 in the CIN location, the program will jump to a I do not know what is the place, this time can use SHIFT+F11, jump out of the function, back to the original position.

3, check the parameters, start the Watch window, or the menu bar "View"--"debugging Window"-"Debugging Window" (unless you shut yourself, otherwise general debugging will have)



Enter variables in the Watch window to view specific values, and the Watch window allows you to make better observations of variable changes. (Tip: When the parameters are more or the programmer's screen compared to the hour, you can drag the Watch window)

6, Shift+f5 stop Debugging. (On my computer once the need to re-open VC6.0, and then in the file-) The recent workspace, open the previous project, the lab, do not know what will happen to you.

7. Several debugging techniques:

cout: (If you're using C as printf) You can output intermediate variables and see if they are the same as the expected values. You can also output a string, observe the time into a loop, in the run to find no value output, it can be speculated that there is a dead loop, then in the loop with cout<< "test", is a good technique. You can call the show function written by yourself in the sort, and it is a good way to see the middle state of each sort.

System ("PAUSE"): This is already described in the previous section, which is explained here.

8. Several shortcut keys:

Alt+f8: You can adjust the selected area code. Generally copied down the online code format will be very messy, at this time, CTRL + A and ALT + F8 will be able to put the code is very good (some may need to manually adjust, such as the location of {).

ALT + space + E + P: can be pasted in a black window.

There are many other shortcut keys, or the operation requires you to randomly click on those options to explore. For example, the following:

Compare these two pictures with what you see differently.

Iostream and digital colors are different. This helps to differentiate.

Settings are as follows:

Tools, options, colors find number and string set to the color you like, there are other places you can change the color, you need to explore.


Debugging is just a tool, want to really progress, it is best to be a bug abuse hundreds of back. Try to find the problem yourself, and try to solve the problem yourself, this is the real progress of the method.


* Note: Do not reprint without my consent.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.