WINDEV Concepts
154 Part 4: Advanced concepts 5 Tracing a project 5.1 Debugging principles Debugging an application consists in: • checking the operating mode of a process, • understanding the operating mode of an existing program, • checking the values of variables, • checking the operating mode of special cases in an application. The debugger is used to perform these operations. Remark : WINDEV also includes multiple trace tools (trace window, dialog box, etc.). For more details, see Debugging without debugger. 5.2 Debugger overview The debugger monitors WLanguage programs so they can be improved. The executed source code appears on the screen. The processes run are sorted in hierarchical order in the "Debugger" pane. The value of the variables is displayed: • individually in the on-hover tooltip of each variable. • in the "Debugger" pane. 5.3 Debugger features The debugger is used to: • view the call stack, • view the content of variables or expressions, • execute the code step by step with the possibility to skip code blocks, • use conditional breakpoints, • modify the code while continuing the execution, • etc. 5.4 Debugging without debugger In some cases, running a program with or without debugger may be different. The debugger sets pauses in the execution of the processes, during which Windows performs multiple tasks. For example, the debugger cannot be used in a procedure called by a timer, nor in the code of a Scrollbar control. Remark : For more details on the limitation of the debugger, see the online help. To debug this type of applications, you may want to monitor the changes of a value, how different procedures are called, etc. This information can be: • displayed on the screen. • stored in a trace file. Caution : If the information is displayed on the screen, it must be displayed during the application tests only. Displaying information Two tools can be used to display information: • the dialog boxes : WLanguage Info function. Caution: When displayed, dialog boxes block the application. • the trace window : WLanguage Trace function. The trace window appears in the upper-left corner of the screen, without interrupting the program. Displaying the debug information Displaying the debug information on the screen is useful in test mode only. Any unsuitable display must be removed before distributing an application. To avoid any oversight, it is recommended to manage how the debug information is displayed via a global procedure. For example: PROCEDURE MyTrace(StringToTrace) IF InTestMode() = True THEN Trace(StringToTrace) END In this code, depending on the result of InTestMode , the trace window appears during the application test only. This procedure prevents trace windows from being displayed on end-user computers, even if they are called in the code of the application. The call to this trace procedure is identical to the use of Trace : MyTrace("Customer: "+ ... Customer.CustomerNum)
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==