PC SOFT

WINDEV的在线文档

  • Overview
  • The debugger
  • How do I proceed?
  • Notes
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Overview
Running the project step by step enables you to start the debugger when launching the application. This solution allows you to monitor the progress of the application.

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 the 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. See Debugging a component for more details.

Note: WinDev, WebDev and WinDev Mobile include several trace tools (trace window, information box, ...). See Debugging without debugger for more details.

The 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 the variables can be viewed:

  • individually in the rollover tooltip of each variable.
  • In the "Debugger" pane (to view the local variables andto view the global variables).

How do I proceed?
Starting the debugger

Several methods can be used to start the debugger:

  • At the beginning of the project test by selecting "Project .. Test mode .. Trace the project". The debugger is started when the project is run.
    This method is recommended if you want to check the initialization processes of the project and the initialization processes of first window or page.

  • At the beginning of the project test: on the "项目" pane, in the "测试模式" group, expand "测试模式" and select "Trace the project". The debugger is started when the project is run.
    This method is recommended if you want to check the initialization processes of the project and the initialization processes of first window or page.

  • WinDev When interrupting the test by pressing the [Ctrl] + [Pause] keys. The action performed once the [Ctrl] + [Pause] keys have been pressed (click on a button, ...) will start the debugger.
  • 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/WinDev Mobile icon in the taskbar.
    • Answer "No" to the question "Do you want to stop the test?".
    • In the "Debugger" pane, click the icon shaped like a hand ().
  • By programming by adding the Stop keyword into the code at the location from which the debugger must be started.
    This method is recommended when the processes from which the debugger must be started is identified.
    Note: The 停止 keyword is taken into account during the tests of the application in the editor of WinDev, WinDev Mobile or WebDev. The 停止 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 must be started. See Managing the breakpoints for more details.
  • From an expression entered in the "Debugger" pane. See Expression to evaluate for more details.
18版本和更高版本
Minimizing (or not) the editor during the test

During a test, the editor is minimized by default. Depending on the hardware configuration (large screen, 2 screens, ....), this minimize operation is not required.

To keep the editor opened:

1. On the "首页" pane, in the "环境" group, expand "选项" and select "Options of the code editor".

2. In the "Debugger" tab, uncheck "Minimize the editor in test mode".

3. Validate.

18新版本
Minimizing (or not) the editor during the test

During a test, the editor is minimized by default. Depending on the hardware configuration (large screen, 2 screens, ....), this minimize operation is not required.

To keep the editor opened:

1. On the "首页" pane, in the "环境" group, expand "选项" and select "Options of the code editor".

2. In the "Debugger" tab, uncheck "Minimize the editor in test mode".

3. Validate.

Minimizing (or not) the editor during the test

During a test, the editor is minimized by default. Depending on the hardware configuration (large screen, 2 screens, ....), this minimize operation is not required.

To keep the editor opened:

1. On the "首页" pane, in the "环境" group, expand "选项" and select "Options of the code editor".

2. In the "Debugger" tab, uncheck "Minimize the editor in test mode".

3. Validate.

16版本和更高版本
Using the debugger in 32 bits and 64 bits

The debugger is available in 32 bits and in 64 bits. All the features are available in these two modes.

WinDev Tests in WinDev:

In a WinDev application, you have the ability to create some project configurations for the 32-bit and 64-bit executables. If your computer is equipped with a 32-bit system, the debugger will be run in 32 bits ; if your computer is equipped with a 64-bit system, the debugger will be run in 64 bits.

32-bit system64-bit system
Configuration 32-bit executable32-bit GO32-bit GO
Configuration 64-bit executableGO! (32 bits)64-bit GO
Component32-bit GO32-bit or 64-bit GO

Notes:

  • When running a 64-bit project configuration on a 32-bit system, an exclamation mark appears on the GO icon to indicate that the execution will be performed in 32 bits.
  • When running a component, the debugging mode of the element must be specified. This option can be specified via menu of the GO icon of the project ("Debug the element in 64 bits").

16新版本
Using the debugger in 32 bits and 64 bits

The debugger is available in 32 bits and in 64 bits. All the features are available in these two modes.

WinDev Tests in WinDev:

In a WinDev application, you have the ability to create some project configurations for the 32-bit and 64-bit executables. If your computer is equipped with a 32-bit system, the debugger will be run in 32 bits ; if your computer is equipped with a 64-bit system, the debugger will be run in 64 bits.

32-bit system64-bit system
Configuration 32-bit executable32-bit GO32-bit GO
Configuration 64-bit executableGO! (32 bits)64-bit GO
Component32-bit GO32-bit or 64-bit GO

Notes:

  • When running a 64-bit project configuration on a 32-bit system, an exclamation mark appears on the GO icon to indicate that the execution will be performed in 32 bits.
  • When running a component, the debugging mode of the element must be specified. This option can be specified via menu of the GO icon of the project ("Debug the element in 64 bits").

Using the debugger in 32 bits and 64 bits

The debugger is available in 32 bits and in 64 bits. All the features are available in these two modes.

WinDev Tests in WinDev:

In a WinDev application, you have the ability to create some project configurations for the 32-bit and 64-bit executables. If your computer is equipped with a 32-bit system, the debugger will be run in 32 bits ; if your computer is equipped with a 64-bit system, the debugger will be run in 64 bits.

32-bit system64-bit system
Configuration 32-bit executable32-bit GO32-bit GO
Configuration 64-bit executableGO! (32 bits)64-bit GO
Component32-bit GO32-bit or 64-bit GO

Notes:

  • When running a 64-bit project configuration on a 32-bit system, an exclamation mark appears on the GO icon to indicate that the execution will be performed in 32 bits.
  • When running a component, the debugging mode of the element must be specified. This option can be specified via menu of the GO icon of the project ("Debug the element in 64 bits").

Running the code in the debugger

Once the debugger is enabled, each operation performed in the application positions the cursor of the debugger (represented by the arrow) on the code currently run. You can now continue the execution of 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).

1. Running the code line by line

To run the current code line, 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 the 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 cursor of the debugger (arrow) is positioned on the current line. The input cursor of the mouse (caret) can be positioned on any other code line.

To run the code lines found between the cursor of the debugger and the caret, press the [F6] key.

3. Running code while ignoring the breakpoints

To run the code while ignoring the breakpoints, click .

Note: To stop the execution of the code in the debugger, click . The test of the project continues without the debugger.

4. Modifying the code to run

To modify the code to run, modify the code in the project editor during the execution of the test. A window indicates that a test is currently run and asks whether the test must be stopped. Do not stop the test, perform the requested modification and resume the test.

5. Running code while specifying the code line to run (Backspace)

You can indicate the line that must be run to the debugger. This code line can be found before or after the code line 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 the debugger

The stop mode of the test (and the stop mode of the debugger) can be configured in the display options of the code editor ("Tools .. Options .. Options of code editor", "Debugger" tab).

The stop mode of the test (and the stop mode of the debugger) can be configured in the display options of the code editor:
1. On the "首页" pane, in the "环境" group, expand "选项" and select "Options of the code editor".
2. Display the "Debugger" tab.

Notes
Hierarchy of processes

The processes currently run in the debugger are organized hierarchically. This hierarchy is listed in the call stack in the "Debugger" pane.

For example, the initialization process 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.
Note: This feature does not stop the debug operation in the debugger.

Viewing the content of the variables

The debugger enables you to examine the value of the variables used in the current code. The values can be viewed:
  • When a variable is hovered by the mouse cursor.
  • In the debugger:
    • The iconis used to view the local variables.
    • The iconis used to view the global variables.
    • You can view the content of the variables in hexadecimal format.
The debugger also proposes an extended view mode. This mode enables you to view the Table, Structure or Object data as an array of results. For example, a class can contain a member being an object itself. In this case, a double-click performed on an object (like when editing a simple variable) opens a window containing all the members of this object. You have the ability to click an element again to view its content and/or modify it.

16版本和更高版本
Watch window

The content of the variables can be visualized in a special window: the watch window. To display this window, all you have to do is select "Edit value" from the popup menu of the variable in the "Debugger" pane. This window is used to visualize the content of simple variables as well as the content of structured variables: array, multiline RTF string, language structured type, class, ...

This window is a non-modal window: you can open several watch windows on different variables at the same time. You can also keep these windows opened during the debugging of the application. These windows are updated for each statement run.

This window also allows you to:

  • Visualize the variable displayed in hexadecimal mode.
  • Save the content of the variable on disk (interesting for a RTF, HTML or Image variable).
  • Display an image found in a variable or in a memo.
  • Add the content of a RTF or HTML variable in formatted format.
16新版本
Watch window

The content of the variables can be visualized in a special window: the watch window. To display this window, all you have to do is select "Edit value" from the popup menu of the variable in the "Debugger" pane. This window is used to visualize the content of simple variables as well as the content of structured variables: array, multiline RTF string, language structured type, class, ...

This window is a non-modal window: you can open several watch windows on different variables at the same time. You can also keep these windows opened during the debugging of the application. These windows are updated for each statement run.

This window also allows you to:

  • Visualize the variable displayed in hexadecimal mode.
  • Save the content of the variable on disk (interesting for a RTF, HTML or Image variable).
  • Display an image found in a variable or in a memo.
  • Add the content of a RTF or HTML variable in formatted format.
Watch window

The content of the variables can be visualized in a special window: the watch window. To display this window, all you have to do is select "Edit value" from the popup menu of the variable in the "Debugger" pane. This window is used to visualize the content of simple variables as well as the content of structured variables: array, multiline RTF string, language structured type, class, ...

This window is a non-modal window: you can open several watch windows on different variables at the same time. You can also keep these windows opened during the debugging of the application. These windows are updated for each statement run.

This window also allows you to:

  • Visualize the variable displayed in hexadecimal mode.
  • Save the content of the variable on disk (interesting for a RTF, HTML or Image variable).
  • Display an image found in a variable or in a memo.
  • Add the content of a RTF or HTML variable in formatted format.

Expression to evaluate

The debugger enables you to insert an expression to evaluate. This expression can have any type: variable, function, operation on variables, ... The result of the expression is calculated and displayed.

This expression is used to perform a custom debugging. For example, you have the ability to find out the content of a variable as it is used in the application.

An expression can be self-stopping: the debugger can, for example, be started as soon as a condition is checked or as soon as 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, all you have to do is define the following expression as being auto-stop:

Customer.CustNum12345

To insert an expression:

1. Select "Add an expression" from the popup menu of the "Debugger" pane.

2. Enter the new expression.

3. Press the [Enter] key to validate the creation of the expression. The value of the expression will be automatically displayed in the "Value" column during the debug operation.

To modify an expression:

1. Select the expression to modify.

2. Select "Edit the expression" from the popup menu of the "Debugger" pane.

3. Modify the expression.

4. Press the [Enter] key to validate the modification. The value of the expression will be automatically displayed in the "Value" column during the debug operation.

To delete an expression:

1. Select the expression to delete.

2. Select "Delete the expression" from the popup menu of the "Debugger" pane. The expression is deleted.

To make an expression self-stopping: all you have to do is check the "Stop" column in front of the requested expression.

HyperFileSQL status report

The HyperFileSQL status report () is used to display in the "Debugger" pane the result of the following HyperFileSQL functions (if they exist):Status report of WLanguage

The status report of WLanguage ( ) is used to display the following information in the "Debugger" pane:

  • the timer number (if it exists),
  • the number and the message of the non-fatal errors,
  • the name of the current object (corresponding to the 我自己 keyword).

Managing the threads

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.