Running in debug mode

After you have set some breakpoints, you can run the application in debug mode. The application executes normally until it reaches a statement containing a breakpoint. At this point it stops so that you can examine the application. After you do so, you can single-step through the application, continue execution until execution reaches another breakpoint, or stop the debugging run so that you can close the debugger and change the code.

StepsTo run an application in debug mode:

  1. If necessary, open the debugger by clicking the Debug or Select and Debug button.

    The Debug button opens the debugger for the target you last ran or debugged. Use the Select and Debug button if you want to debug a different target in the workspace.

  2. Click the Start button in the PainterBar or select Debug>Start from the menu bar.

    The application starts and runs until it reaches a breakpoint. PowerBuilder displays the debugger, with the line containing the breakpoint displayed in the Source view. The yellow arrow cursor indicates that this line contains the next statement to be executed. You can now examine the application using debugger views and tools.

    For more information, see “Examining an application at a breakpoint” and “Stepping through an application”.

StepsTo continue execution from a breakpoint:

  1. Click the Continue button in the PainterBar or select Debug>Continue from the menu bar

    Execution begins at the statement indicated by the yellow arrow cursor and continues until the next breakpoint is hit or until the application terminates normally.

StepsTo terminate a debugging run at a breakpoint:

  1. Click the Stop Debugging button in the PainterBar or select Debug>Stop from the menu bar

    PowerBuilder resets the state of the application and all the debugger views to their state at the beginning of the debugging run. You can now begin another run in debug mode, or close the debugger.

NoteCleaning up When you terminate a debugging run or close the debugger without terminating the run, PowerBuilder executes the application’s close event and destroys any objects, such as autoinstantiated local variables, that it would have destroyed if the application had continued to run and exited normally.