- How to?
- Starting the debugger
- Remark: Minimizing (or not) the editor during the test
- Using the debugger in 32 and 64-bit
- Running code in the debugger
- Configuring the stop mode of debugger
- Hierarchy of events/processes
- Viewing the content of variables
- Expression to evaluate
- HFSQL status report and WLanguage status report
- Managing threads
- Ignore certain functions when debugging in "Step by step" mode
Debugger: Running a project step by step
Running the project step by step allows you to start the debugger when starting the application. This solution allows you to monitor the application progress.
Principle of debugging: Debugging an application consists in:
- checking the operating mode of a process,
- understanding the operating mode of an existing program,
- checking the value of variables,
- checking the operating mode of special cases in an application.
The debugger is used to perform these operations. The debugger also allows you to debug the components used in an application. For more details, see Debugging a component
Remark: WINDEV, WEBDEV and WINDEV Mobile also provide you with multiple trace tools (trace window, information box, etc.). For more details, see Debugging without debugger
The debugger allows you to trace the WLanguage programs in order to help you improve these programs.
The source code run is viewed on the screen. The processes run are sorted in hierarchical order in the "Debugger" pane.
The value of variables can be viewed:
- Individually in the on-hover tooltip of each variable.
- In the "Debugger" pane ( to see local variables and to see global variables).
Starting the debugger
Several methods can be used to start the debugger:
- At the beginning of project test: on the "Project" tab, in the "Test mode" group, expand "Test mode" and select "Debug project". The debugger is started when the project is run.
This method is recommended if you want to check the initialization processes of project and the initialization processes of first window or page.
- During the test, by starting the debugger from the code editor. This method is recommended to start the debugger when a process seems to take an unusual long time (endless loop for example). In this case, perform the following operations:
- Click the WINDEV, WEBDEV or WINDEV Mobile icon in the taskbar.
- Answer "No" to the question "Do you want to stop the test?".
- In the "Debugger" tab, click "Pause" .
- Through programming, by adding the Stop keyword where the debugger must be started.
This method is recommended when the process from which the debugger must be started is known.
Remark: The Stop keyword is only taken into account when testing the application in the WINDEV, WINDEV Mobile or WEBDEV editor. The Stop keyword is ignored when using the executable.
- In the code editor by adding a breakpoint into the code at the location from which the debugger will be started. For more details on breakpoints, see Managing breakpoints.
- From an expression typed in the "Debugger" pane. For more details, see Expression to evaluate.
Once the debugger is running:
- the WINDEV, WEBDEV or WINDEV Mobile code editor displays the "Debugger" tab. The text of the tab is shown in red.
- the status bar is shown in orange.
Remark: Minimizing (or not) the editor during the test
During a test, the editor is minimized by default. Depending on the hardware configuration (wide screen, 2 screens, etc.), you may not need to minimize the editor.
To keep the editor opened:
- On the "Home" tab, in the "Environment" group, expand "Options" and select "Options of the code editor".
- In the "Debugger" tab, uncheck "Minimize editor in test mode".
Using the debugger in 32 and 64-bit
The debugger is available in 32-bit and 64-bit versions. All the features are available in these two modes.
Tests in WEBDEV
In WEBDEV, if your computer is equipped with a 32-bit system, the debugger will be run in 32-bit mode. On the contrary, if your computer is equipped with a 64-bit system, the debugger can be run either in 32-bit (default), or 64-bit mode.
To run the tests in 64-bit: on the "Project" tab, in the "Test mode" group, expand "Test mode" and select "Debug in 64-bit".
This option is also available in the drop-down menu below the "Go" icon of the project or below the "Go" icon of an element.
If this option is deselected, the test will be run in 32-bit.
Running code in the debugger
Once the debugger is enabled, each operation performed in the application positions the debugger cursor (represented by the arrow) on the code currently run. You can now continue to run the code:
- line by line,
- by block of lines,
- by ignoring the breakpoints,
- by modifying the code to run ("Edit and continue"),
- by indicating the code line to run (Backspace).
The server code and browser code can be run.
1. Running the line of code by line
To run the current line of code, use:
- The F7 key to run the code of the line and the code of the procedures called by this line. The execution of the line and the execution of procedures called by the line will be viewed in the debugger.
- The F8 key to run the code of the line and the code of the procedures called by this line. Only the execution of the line will be viewed in the debugger.
2. Running code by block of lines
By default, the debugger cursor (arrow) is positioned on the current line. The input mouse cursor (caret) can be positioned on any other line of code.
To run the lines of code found between the debugger cursor and the caret, press the F6 key.
3. Running code while ignoring the breakpoints
To run the code while ignoring the breakpoints, click on
: To stop running the code in the debugger, click
. The project test continues without debugger.
4. Modifying the code to run
To modify the code to run, modify the code in the project editor when running the test. A window indicates that a test is currently run and it asks whether the test must be stopped. Do not stop the test, make the desired change and resume the test.
5. Running code while specifying the line of code to run (Backspace)
You can indicate the line that must be run to the debugger. This line of code can be found before or after the line of code currently run. This feature is useful if the code to run was modified.
To do so, select "Define the next statement" in the debugger.
Configuring the stop mode of debugger
The stop mode of test (and the stop mode of debugger) can be configured in the display options of code editor:
- On the "Home" tab, in the "Environment" group, expand "Options" and select "Options of the code editor".
- Display the "Debugger" tab.
Hierarchy of events/processes
The events/processes currently run in the debugger are organized hierarchically. This hierarchy is listed in the call stack in the "Debugger" pane.
For example, the "Initializing" event of the application starts a window that uses a procedure. When the procedure is debugged, you will have the ability to go back to the code editor:
- At the location where the procedure is called.
- At the location where the window is opened.
Remark: This feature does not stop the debugging process.
Viewing the content of variables
The debugger allows you to examine the value of variables used in the current code. The values can be viewed:
- When a variable is hovered by the mouse cursor.
- In the debugger:
- The icon is used to display local variables.
- The icon is used to display global variables.
- The content of variables can be displayed in hexadecimal format.
The content of variables can be displayed in a specific window: the watch window. To display this window, all you have to do is select "Edit value" in the context menu of variable in the "Debugger" pane. This window is used to view the content of simple variables as well as the content of structured variables: array, multiline RTF string, structured type of language, class, ...
This window is a non-modal window: you have the ability to open several watch windows on different variables at the same time. These windows can remain opened when debugging the application. These windows are updated for each statement run.
This window also allows you to:
- View the variable displayed in hexadecimal mode.
- Save the variable content on disk (interesting for an RTF, HTML or Image variable).
- Display an image found in a variable or in a memo.
- Add the content of an RTF or HTML variable in formatted format.
Expression to evaluate
The debugger allows you to insert an expression to evaluate. This expression can be of 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 watch the content of a variable while it is being used in the application.
An expression can be self-stopping: the debugger can start as soon as a condition is checked or when the value of a variable is modified.
For example, in a mailshot sent to 40 000 customers, a problem occurs on number 12345. To start the debugger as soon as the customer number is equal to 12345, simply define the following expression as self-stopping:
To insert an expression:
- Select "Add an expression" from the popup menu of the "Debugger" pane.
- Type the new expression.
- Press the Enter key to validate the creation of expression. The expression value will be automatically displayed in the "Value" column when debugging.
To modify an expression:
- Select the expression to modify.
- Select "Edit the expression" in the context menu of "Debugger" pane.
- Modify expression.
- Validate modifications by pressing the Enter key. The expression value will be automatically displayed in the "Value" column when debugging.
To delete an expression:
- Select the expression to delete.
- Select "Delete the expression" in the context menu of "Debugger" pane. The expression is deleted.
To make an expression self-stopping: simply check the "Stop" column in front of the desired expression.
HFSQL status report and WLanguage status report
The HFSQL status report (
) shows the result of the following HFSQL functions (if they exist) in the "Debugger" pane:
The WLanguage status report (
) shows the following information in the "Debugger" pane:
- timer number (if it exists),
- number and message of non-fatal errors,
- name of the current object (corresponding to the MySelf keyword).
You have the ability to debug a multi-threaded application. When a breakpoint or a STOP statement is reached, you can:
- See the different threads.
- Switch to the information about the different threads (call stack, variables, ...) via the combo box found in the "Debugger" pane.
Ignore certain functions when debugging in "Step by step" mode
During step-by-step debugging, it is sometimes necessary not to debug the content of some functions (e.g. a log function or a conversion function).
To do so, the declaration of function, procedure or method must be followed by the <no step into> extension attribute.
For more details, see:
This page is also available for…