Analysis of VC debugging-control program running

Source: Internet
Author: User

We have discussed how to set various breakpoints. Next we will introduce how to control program running. From the menu build to the sub-menu start debuging, select go program to start running in the debug state. After the program pauses due to the breakpoint, we can see a small arrow, it points to the code to be executed.

We have discussed how to set various breakpoints. Next we will introduce how to control program running. From the menu build to the sub-menu start debuging, select go program to start running in the debug state. After the program pauses due to the breakpoint, we can see a small arrow, it points to the code to be executed.

 

 

Fig 4.12

Then, we can control program running as required: There are four commands: Step over, step into, step out, run to cursor.

 

Fig 4.13

In Figure 4.13:

The step over function is to run the code pointed to by the current arrow (only one code is run ).

Step into is used to enter the function for one-step execution if the code indicated by the current arrow is a function call.

The step out function enables the code pointed to by the current arrow to run the program in a function and return it to the function.

Run to cursor enables the program to run to the code indicated by the cursor.

View the use of the tool

The most important thing in the debugging process is to observe the state of the program during running so that we can find out the program errors. The State mentioned here includes the value of each variable, the value in storage, the value in memory, and the value in the stack. Therefore, we need various tools to help us check the state of the program.

  • Pop-up debugging information bubble (Data tips pop_up information ).

When a program stops at a breakpoint, the easiest way to observe the value of a variable or expression is to use the debugging information bubble. To view the value of a variable, you only need to hover the mouse over the variable in the source program window. You will see an information bubble pop-up, showing the value of the variable.

Fig 4.14

To view the value of an expression, first select the expression, and then place the mouse over the selected expression. The information bubble pops up to display the value 4.15 of the expression.

 

Fig 4.15

  • Variable Window ).

In the View menu, select variables window in debug window. The variable window appears on the screen. The variable name and its corresponding value are displayed. You will see three labels in the lower part of the variable observation window: auto, local, and this select different labels. Different types of variables will be displayed in this window.

  • Watch window ):

 

 

In the View menu, select the debug window command and the watch window sub-command. The Variable Window appears on the screen.

Fig 4.17

In the observation window in Figure 4.17, double-click an empty row in the name column and enter the variable name or expression you want to view.

Fig 4.18

After you press enter, you will see the corresponding value. The observed window can contain multiple pages, corresponding to the tags wattings, watch2, and watch3. If the expression you entered is a structure or an object, you can use the mouse to take the shape + on the right of the expression to further observe the value of the member variable 4.19.

 

Fig 4.19

  • Quick watch );
  1. In the Debug menu, select the quick watch command. The Quick watch dialog box is displayed on the screen;

     

    Fig 4.20

  2. Enter the variable name in the expression editing box and press Enter;

 

Fig 4.21

(3) The variable name and its current value 4.22 will appear in the current value grid: Figure 4.22

(4) To change the value of a variable, double-click the name column corresponding to the variable and enter the value you want to change;

(5) to add the variable to the observation window, click Add watch;

(6) Click the close button to return;

  • We can also directly view the values in the memory.

(1) Select debug windows and memory sub-commands from the View menu. Memory window appears;

(2) enter the memory address you want to view in the address edit box and press Enter. The values in the corresponding memory address are displayed in the memory window.

 

Fig 4.24

  • During the debugging process, we sometimes need to view or change the value in the register. We only need:

(1) Select the debug window and registers sub-options from the View menu. The registers window appears. In the registers window, the information is displayed in the form of register = value, where register represents the register name, and value represents the value in the register.

Fig 4.25

(2) If you want to modify the value of a register, use the tab key or mouse to move the cursor to the right of the value you want to change, and then enter the value you want. Press enter to return.

In registers, there is a special type of register called a flag Register, which has eight flag bits:

OV indicates overflow;

Up indicates the direction;

EI indicates the interruption enable;

Sign is a symbol,

Zero indicates zero.

Parity indicates the parity check.

Carry is the carry sign.

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.