12th Chapter-Exception Handling and program debugging (III.) (1)

Source: Internet
Author: User

Use of 12.4.3 breakpoints

12.4.3.1 Set Breakpoints

To set a breakpoint first select the line of code that you want to set the breakpoint in editor, and then do any of the following:

Click white space to the left of the selected line of code

Press F5

Select the Toggle breakpoint item of the Code Editor Accelerator menu

Select run| Add Breadpoint Opens the Breakpoint Edit dialog box (Edit breakpoint Dialog box) and then selects new to confirm a new breakpoint setting or select Modify to modify an existing breakpoint

Select Add Breakpoint from the Breakpoint List Accelerator menu

The breakpoint must be on an executable line of code, which is not valid for comments, blank lines, and variable descriptions. In addition, breakpoints can be set either in the design state or in the Run debug state.

Operation of 12.4.3.2 Breakpoint

The Breakpoints List window (breakpoint list windows) lists the source filename, line number, condition, and number of times that all breakpoints are in. If a breakpoint is illegal or loses functionality, it is dimmed in the List window.

The Breakpoints List window can be selected by selecting view| The breakpoint menu opens.

The Breakpoint List window is the basis for the breakpoint operation.

1. Show and edit the code at the breakpoint

Use the Breakpoints List window to quickly find the location of the breakpoint in the source code.

First select the breakpoint and then choose View Source or edit source from the accelerator menu. At this point, the Code Editor is updated to show where the breakpoint is located. If you select View Source, the Breakpoint List window remains active, and if you select Edit Source, the code editor gets the input focus and can modify the source code at the breakpoint location.

2. Loss and recovery of breakpoint function

Making a breakpoint lose functionality allows breakpoints to be hidden from the current program's operation. This is useful if you define a breakpoint that is not currently needed, but may be used later.

The Disable breakpoint and disable all breakpoints items in the Breakpoints List window Accelerator menu can cause the current selected breakpoint or all breakpoints to lose functionality.

The Enable breakpoint and enable all breakpoint in the Accelerator menu enable the appropriate breakpoint to be restored to function.

3. Deletion of breakpoints

Breakpoint deletions can be made from the Code Editor or the Breakpoints List window.

From Code Editor:

Stop the cursor to the line containing the breakpoint and press F5 (or select the toggle Breakpoint of the Accelerator menu)

Click the Terminator to the left of the line containing the breakpoint

From the Breakpoints List window:

Select the breakpoint you want to remove and select the Delete breakpoint entry for the accelerator menu

Delete all current breakpoints, select the Accelerator menu's Delete all breakpoints entry

12.4.3.3 Modify Breakpoint Properties

Breakpoints List Window Double-click the selected breakpoint or select the Edit breakpoint item from the Accelerator menu to open the Breakpoint Editing dialog box to display and modify the properties of the breakpoint.

Use breakpoints to edit the dialog box to change the location of the breakpoint and set the breakpoint condition.

The breakpoint condition includes two kinds: Boolean representation and number of passes.

The condition edit box is used to set the Boolean expression condition. If the expression value is true (or not 0), the program runs at the breakpoint, otherwise the debugger ignores the breakpoint.

The Pass count edit box is used to set the passing times condition, that is, the program will only be aborted at that breakpoint when it is run at that breakpoint by a set number of times. This is often used for debugging internal statements in the loop.

One thing that should be noted is that when condition and pass count are set at the same time, passing count refers to the number of passes that satisfy the condition.

For the following procedure:

Var

I,re,s:integer;

Begin

s: = 1;

Re: = 0;

For I:=1 Todo

Re:=re+s*i;

End

in Re: = re + s*i; Set a breakpoint on one line.

If the condition is set to:

CONDITION:I = 3

Pass Count:4

A value of 7 is detected when the program aborts.

12.4.3.4 breakpoints and program execution point color settings

Select option| Environment enters the Environment Settings dialog box and then selects Editor colors page labels. At this point, you can set the background and foreground color for the items you want.

12.4.4 the value of the monitored data

The built-in debugger provides the following tools for monitoring the values of data in your program:

Watch List Window

Calculation/Modify dialog box

Adjust Stack window

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.