Just-in-time debugging

If you are running your application in regular mode (using the Run button) and you notice that the application is behaving incorrectly, just-in-time debugging lets you switch to debug mode without terminating the application.

When you open the debugger while running an application, the application does not stop executing. The Source, Variables, Call Stack, and Objects in Memory views are all empty because the debugger does not have any context. To suspend execution and examine the context in a problem area, open an appropriate script and set breakpoints, then initiate the action that calls the script.

If just-in-time debugging is enabled and a system error occurs while an application is running in regular mode, the debugger opens automatically, showing the context where the error occurred.

You can also use the DebugBreak function to break into the debugger.

You must enable just-in-time debugging before you run your application to take advantage of this feature.

StepsTo enable just-in-time debugging:

  1. Select Tools>System Options.

  2. Check the Just In Time Debugging check box and click OK.

StepsTo debug an application while running in regular mode:

  1. Enable just-in-time debugging.

  2. Run the application.

  3. Click the PowerBuilder button on the Windows Taskbar.

  4. Click the Debug button in the dialog box that displays.

  5. Open a script in the Source view and set breakpoints.

    The application is suspended when it hits a breakpoint and the Source, Variable, Call Stack, and Objects in Memory views show the current context. You can now debug the application.