New Breakpoint... / New Data Breakpoint...

Overview

The Debug > New Breakpoint... / Debug > New Data Breakpoint... commands are available in offline and in online mode, in the debug context as well as in the breakpoints view.

The New Breakpoint / New Data Breakpoint dialog box opens. It allows you to define the position and the conditions for a new breakpoint or a new data breakpoint in the active application. In online mode, you can additionally define execution points.

In order to use data breakpoints, the device description file must include target entries that correspond to your controller.

Also refer to the corresponding functions in the Breakpoints dialog box.

For setting a breakpoint at the cursor position, refer to the Toggle Breakpoint command.

Location Tab of the New Breakpoint Dialog Box

Element

Description

POU:

The selection list offers the POUs available in the active application. Select the one where you want to set a breakpoint.

Position:

The selection list offers the possible breakpoint positions of the selected POU. Depending on the editor type, these positions are defined by line and column numbers (text editors) or as network or element numbers (graphic editors). In case of a function block, (Impl)) is added additionally. You have to decide whether the breakpoint should be set in the implementation or in an instance. If it requires setting during the implementation, leave the option Instance Path disabled. If it should be set in an instance, enable the option Instance Path to select the instance.

Instances:

If the selected POU is a function block and this option is disabled, the breakpoint is set in the implementation body of the POU (refer to the Position element). If you want to set the breakpoint in an instance, enable the option and select the instance.

Condition Tab of the New Breakpoint Dialog Box

The Condition tab allows you to define conditions that cause the program execution to stop at the breakpoint:

Element

Description

Tasks:

Only break if breakpoint is hit in one of the following tasks:

Enable this option if the breakpoint only should be effective in case the POU where it is placed is processed by certain tasks. This allows you to set a specific task to stop at the breakpoint within the POU and not in other tasks, which also use the same POU. Refer to Breakpoints and stepping in applications with multiple tasks. The tasks defined in the project will be listed for selection.

Hit Count:

Break always:

The program will stop at the breakpoint.

Alternatively:

The program will not stop at the breakpoint until the breakpoint has been reached the number of times defined (Enter the desired number or select it in the number field):

  • Break when the hit count is equal to

  • Break when the hit count is a multiple of

  • Break when the hit count is greater than or equal to

Condition

Break, if TRUE

If supported by the runtime system, you can use conditional breakpoints. Consult the Programming Guide specific to your controller to see if it supports conditional breakpoints. The condition can only be specified in online mode.

The specified condition is evaluated. Only if the result is TRUE, the program will stop at this breakpoint, the code of the execution point will be executed. You can enter valid boolean expressions as condition.

Example:

x>100, x[y]=z, a AND b, boolVar
NOTE: Using conditional breakpoints slow down the code execution even if the condition is not TRUE.

Data Tab of the New Data Breakpoint Dialog Box

The Data tab allows you to modify the variable for which a data breakpoint is set:

Element

Description

Break execution when the value of the variable or address changes

  • Enter a valid variable name.

  • Select a variable from the Input assistant dialog box (category Watch variables).

Size

Number of bytes of the specified variable or memory address which is monitored.

When a new variable or memory address is specified, a value is assigned that matches the data type.

The maximum size and number of data breakpoints depend on the target system:

Example 1: 4 for data type DWORD

Example 2: 2 for data type DWORD: The first two bytes of the variable are monitored.

Execution point settings Tab of the New Breakpoint Dialog Box

Element

Description

Execution point (Execution does not stop at breakpoint)

The breakpoint becomes an execution point. This means that the processing is not stopped at this point, but the given code is executed.

Execution point enabled:

Execution point disabled:

Execution point of a data breakpoint enabled:

Execution point of a data breakpoint disabled:

Execute the following code

Enter the code to be executed.

The following restrictions apply:

  • Code size < 1200 bytes

  • No conditional statements, loop constructions (IF, CASE, FOR, WHILE)

  • No function block calls

  • No method calls

  • No bit-operations with AND, OR, NOT operators

  • No multiplication and division with other data types than INT

  • No calling properties in instances of an interface type

Additionally, this restriction applies:

The called functions and properties must match at least one of two following conditions:

1. In the View > Properties > Build dialog box, the option Enable system calls is activated.

2. The following attribute is added above the declaration of the function/the property: {attribute 'monitoring' := 'call'}.

Print a message in the device log

This option is available if the option Enable logging in breakpoints is activated in the Project Settings > Compile options dialog box. If the message should contain the present value of a variable, insert the variable name enclosed in curly brackets.

Example:

The present value of variable iCount is: {iCount}.

Enable breakpoint immediately

Select the Enable breakpoint immediately option to activate the breakpoint.

Deselect the Enable breakpoint immediately option to deactivate the breakpoint. To activate the breakpoint later, click the button in the Breakpoints view.