Home | Sign in | English UK
  • This lesson will teach you the following concepts
  • Overview
  • Using the debugger
Lesson 6.4. Debugging a project
This lesson will teach you the following concepts
  • Overview.
  • Using the debugger.

Estimated time: 15 mn
Previous LessonTable of contentsNext Lesson
Let's take a look at the debugger supplied with WINDEV.
What is the debugger?
The debugger is a powerful tool used to follow the code or application progress, step by step. Enhancing a process or even an application becomes child's play.
We are going to use the debugger on the long process found in the WIN_PerformanceProfiler window.
Using the debugger
  • To debug the WIN_PerformanceProfiler window:
    1. Open the "WIN_PerformanceProfiler" window in the window editor (double-click its name in the project explorer).
    2. Run the test of "WIN_PerformanceProfiler" window ( among the quick access buttons).
    3. Start the debugger by using one of the following methods:
      • Press Ctrl + [Pause]: the debugger will be automatically started during the next user action in the window whose test is run.
      • Go back to the WINDEV editor and position a breakpoint in the code of the button "Process to analyze" (click next to the first line of code of the event "Click" or press Ctrl + B; a red dot will appear). The debugger will be automatically started when the line preceded by the breakpoint is run.


        Several methods can be used to start the debugger.
        See Start modes of debugger for more details.
    4. Click the "Process to analyze" button. The debugger starts. The current line is preceded by a little arrow.
      The "Debugger" pane appears in the lower section of the screen. This pane displays two distinct areas:
      • the call stack: This area is used to find out the hierarchy of processes displayed in the debugger. In our example, we are currently debugging the event "Click BTN_LongProcess".
      • the list of expressions to evaluate. The main variables used in the code are displayed in this area. You have the ability to add variables in order to follow their evolution (this feature will be presented later).
We are going to perform some operations in the debugger to discover its capabilities.
  • First of all, we are going to run the different statements step by step and see the content of variables:
    1. Press the F8 key (or click the "Step by step" button found in the ribbon). The line following the current line is automatically run. The values of variables are modified (if necessary) in the "Debugger" pane (displayed at the bottom of the screen).
    2. When the cursor shaped like an arrow reaches the "PROGBAR_Progress..MaxValue = ..." line, hover "PROGBAR_Progress" with the mouse. A tooltip is displayed with the expression value:
    3. The value of "PROGBAR_Progress..MaxValue" is displayed in a tooltip. This value corresponds to 100 because the code line was not run.
    4. Press F8 to run the line.
    5. Hover "PROGBAR_Progress..MaxValue" again. The value of "PROGBAR_Progress..MaxValue" displayed in the tooltip corresponds to the result of HNbRec(Product).
  • Let's continue our operations in the debugger. We are now going to run the UpdateProductStock procedure step by step in the debugger.
    1. To run this procedure step by step, press the F7 key (or click the "Detailed step by step" button in the ribbon).
    2. The procedure code is displayed in the debugger.
  • We are now going to add an expression to monitor the evolution of its value in the "Debugger" pane. This expression can have any type: variable, function, operation on variables, ... The expression result is calculated and displayed.
This expression is used to perform a custom debugging. For example, you can find out the content of a variable while it is being used in the application.
  1. Press F7 to run the different lines of UpdateProductStock procedure until you reach the line:
  2. Hover "PROGBAR_Progress". The value displayed in the tooltip is 0.
  3. Select "PROGBAR_Progress" in the code editor and open the popup menu (right click). Select "Add the expression to the debugger".
  4. The expression is automatically added into the debugger pane at the bottom of the screen.
  • The debugger can also be used to run a set of code lines:
    1. Press F8 until you reach the line:
      The F8 key is used to run the code of InterrogateSupplierDatabase procedure without running it step by step in the debugger.
    2. Click the following line with the mouse (caution: click inside the line and not in front of it):
      IF HExecuteQuery(QRY_QuantityOrdered) THEN
    3. Press the F6 key (or click the "Run until cursor" button found in the ribbon).
    4. The arrow indicating the line currently run moves until it reaches the code line where the cursor is positioned. The code lines found before the cursor are automatically run.
  • We are now going to add a breakpoint and to run the code until it reaches the breakpoint:
    1. Click in the hatched area with the mouse, in front of HModify. A breakpoint (red bullet) appears.
    2. Press the F5 key (or click the "Continue" button found in the ribbon). The code is run until it reaches the breakpoint. The arrow used to identify the current line moves until it reaches the breakpoint.
    3. Click the breakpoint to remove it.
  • To end this test, we will be using an "Auto-stop" expression. An "Auto-stop" expression is used to start the debugger as soon as a condition is checked or when the value of a variable is modified. In our example, the debugger will be started as soon as the value of progress bar is set to 50%:
    1. In the "Debugger" pane, select the "PROGBAR_Progress" expression that was added beforehand.
    2. Click the green circle.
    3. Press F5 to continue the test.
    4. A message is displayed, indicating that the value of "PROGBAR_Progress" expression changed.
    5. Validate.
    6. In the "Debugger" pane, select the "PROGBAR_Progress" expression. Click the expression again: the "Expression" column becomes editable. In the "Expression" area, add "=50". You will get "PROGBAR_Progress = 50".
    7. Press F5. The program continues to run. The debugger is started again when the value of the progress bar is set to 50.
  • That's it, the main features of debugger have been presented here. To stop the test in the debugger, click "End the test" found in the ribbon.
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 24
Click [Add] to post a comment