To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Watches Window

Debugging DataFlex Apps

Lesson 4: Locals, Globals, Call Stack windows & useful actions

  • The Locals window lists all local variables in the following context…
    • Where the Debugger is currently paused
    • The method selected in the Call Stack window
    • The method selected in the Message Trace window
    • Note: Values of local variables can also be altered in the Locals window
  • The Globals Window lists…
    • Predefined global variables in packages that are currently compiled the program
    • Global variable in the program code
    • Note: Values of global variables can also be altered in the Globals window
  • The Call Stack Window…
    • Lists all methods called in the program to reach the current execution point
      • With the first method called at the lowest stack level
      • With the last method called at the highest/top stack level             
    • Allows the stepping through of all called methods while examining variables, locals, and so on in that context 
    • Click on the top stack level to return to where the Debugger is currently paused

Useful Actions While Debugging 

  • Step Over: executes the current line of code and pauses on the following line
  • Step Into: steps into the method being called on the current line of code
  • Step Out: steps out of the current method and returns to the method that called it
  • Set Next Instruction: moves the instruction marker to the selected line of code
  • Typically, the instruction marker is only moved within the method currently being worked on because moving outside of the current scope may cause unexpected behavior
  • Run to Cursor: executes the program to the selected line
    • This allows the skipping of several lines of code with having ‘step over’ each one individually, and does stop at enabled breakpoints
  • Pause: manually pauses the running program at the next possible opportunity without requiring a breakpoint
  • Continue: continues the running program until a breakpoint is encountered or is manually paused
  • Restart: stops and restarts the program in debug mode


The current view shows the source code for the ‘Generate’ button that was navigated to in previous lessons, and it is currently paused where a breakpoint has been added – If (bSpeckOk) Begin

  1. Selecting the ‘Step Over’ icon from the top toolbar executes the current line of code, and then pauses again on the following line

  2. Cursor over any item in the Code Editor for the Debugger to evaluate it
    • If it’s a variable the current value will be shown
    • Example: bRemoveExistingData 
      • When initially hovered over, it shows as blank because it has not been initialized
  3. Select the ‘Step Over’ icon again to execute the current line containing bRemoveExistingData
  4. Now when bRemoveExistingData is hovered over its value shows as ‘false’
  5. The value is also displayed in the Locals window, and it is red because the value has changed since the last time the Debugger was paused
  6. The value of variables can be edited within the Locals window – bRemoveExistingData can be changed to ‘true’
  7. Selecting the ‘Step Over’ icon again causes it to step into the ‘If’ (true) block of code
  8. If the value had remained false it would have stepped into the ‘Else’ (false) block of code
  9. To re-execute the if statement using the variable’s original value of ‘false’ …
    • Right-click in the left margin next to the line of code that is to be re-executed, and select ‘Set Next Instruction’ to change the current line in the Debugger to that line
  10. In the Locals window, change the value of bRemoveExistingData back to ‘false’
  11. Now selecting the ‘Step Over’ icon again causes it to step into the ‘Else’ (false) block of code
  12. The next line of code in the program displays a ‘Yes/No’ message box to the user and asks for user input
    • If the ‘Step Over’ icon is selected again the execution does not return to the Debugger because the program has displayed the message box, and is awaiting user input
  13. Selecting ‘Yes’ from the running program results in the Debugger being paused on the next line of code
  14. Hovering over the return value variable, iAnswer, and the constant, MBR_Yes, to see that both values are ‘6’
  15. Stepping over that line to execute the If statement to the next, which calls the DoProcess method of the oOrdersGeneratorBPO object
  16. Clicking the Step Into icon here moves the execution into the DoProcess method

  17. Note that the contents of the Locals window have changed to the new context, which is the DoProcess method
  18. The ‘Call Stack’ panel on the right contains the list of nested methods the program has called
  19. Clicking on any method in the list will cause the context of Debugger and all associated windows will change to that method
  20. If other methods are viewed, the program will remain paused in DoProcess
  21. Clicking on the top item in the ‘Call Stack’ will return the view back to where the program is currently paused