Let’s have a look at some helpful tools that are provided to simplify the debugging process in HDevelop. Beside some well-known tools, such as “line-based breakpoints” and “stepping through the HDevelop program”, several other tools exist that are perhaps less known, but very powerful for the debugging process.
Let us start with a short description of the basic debugging tools. The well-known line-based breakpoint is used in the program window on the left side of each line to stop the program before the operator is executed. In combination with breakpoints, the functionalities of step over (F6), step into (F7), and step out (F8) are very handy to continue the program line by line, step into procedures, or, while in a procedure, return to the calling program/procedure. However, in more complex applications with many procedures, the existence of many breakpoints could be confusing. In this case an overview of all the breakpoints is helpful, which can be found in the menu “Execute -> Manage Breakpoints”.
In addition, breakpoints can also be set on variables. Simply right-click on a variable name in the variable window or directly in the source code and select “Set Breakpoint on Variable”. Once a breakpoint has been set on a variable, the program execution stops whenever its value changes. The breakpoint on variables is helpful, e.g., to debug loops like while-loops or for-loops. If a breakpoint stops the program execution, the values of the variables can be inspected.
In complex programs the list in the variable window can get quite long, which makes watching variables cumbersome. Therefore, you are able to customise the selection of displayed variables. At the bottom of the variable window, several tabs are available, which simplify the access to these variables. The most helpful tabs for debugging are the ‘Auto’ tab and the ‘User’ tab. If the ‘Auto’ tab is selected, the variables of the current and the previous operator call are displayed. This is useful when single-stepping through the program, because only the variables relevant to the current context are displayed. In case the ‘User’ tab is selected, a user-defined selection of variables is displayed. Variables may be added and removed using the context menu of the variable or program window by right-clicking the respective variable and selecting “Add to User Tab”, or “Add Watch on …” respectively.