Starting an Application in Debug Mode

The JADE development environment includes a debugger that enables you to analyze how your application behaves. Debugger features include the following.

The debugger can be activated when you initiate your JADE application.

To debug all or part of a Workspace, the current method in the JadeScript class, or unit test independently of your application, press Shift+F9. (Running a JadeScript method always starts a new application copy.) Alternatively, select the Jade menu Debug command. (The Unit Test Debug command replaces the Debug command in the Jade menu when the JADE unit test framework is active.)

To debug a non-GUI application (for example, a server application initiated when the application server is started in JADE thin client mode), you must first change the application type to GUI, No Forms, by using the Application Type combo box in the Application sheet of the Define Application dialog.

Transient methods cannot be debugged, as transient objects created by one process cannot be accessed by another process. If a transient method is executed by an application that is being debugged, the debugger will not display any details of this method; that is, it is not displayed in the call stack, breakpoints cannot be set in a transient method, and variables cannot be inspected.

Inspection of properties from within the JADE debugger (either directly or via the bubble help inspector) will invoke user mapping methods, if defined. However, you should be aware that debugging may fail if the mapping method performs actions not suitable for situations where the execution of the user application is suspended. For example, the creation and display of a form, showing a form modally, display of a message box, deletion of an object in use by the current call stack, and so on.

For details about initiating a JADE unit test in debug mode, see "Running Unit Tests", in Chapter 17 of the JADE Developer's Reference.

When debugging a method created from a Workspace, the debug execution initially stops on the first line of execution. Use JADE debugger to set debug breakpoints in the method. You can then step through the logic or debug and run it to meet your requirements.

If you want to add additional debugging code at run time when an application is being debugged, you can call the Application class isBeingDebugged method to determine whether the application is currently being debugged.

To start an application in debug mode, call the debugApplication method, specifying the name of the schema and the application in the respective schemaName and applicationName parameters. An exception is raised if the JADE development environment is not already running in the same session (using the same jade exe environment). Alternatively, to initiate an application in debug mode, passing a specified object to the initialize method defined in the application, call the Application class debugApplicationWithParameter method.

To activate the debugger

  1. Select the Run Application toolbar button. (Alternatively, select the Application menu Run command from the Application Browser for your selected application.)

    The Run Application dialog is then displayed.

  2. Check the Activate Debugger check box in the Run Application dialog.

    Alternatively, you can check the Run in Debug Ready Mode check box in the Run Application dialog if you want to run the application in debug mode but without the debugger being initiated when this is checked. Attaching to that application then allows debugging of any method already on the execution stack. If the application is idle and no modal dialogs are displayed, attaching the debugger is equivalent to running in debug‑ready mode. (For details, see "Attaching the Debugger to a Running Application", in Chapter 1 of the JADE Runtime Application Guide.)

The Debugger window, shown in the following image, is then displayed.

By default, the line of the source code that is currently executing is highlighted in blue and the lines on which breakpoints are set are highlighted in yellow. You can change these display colors in the Editor sheet from the Preferences dialog (accessed from the Options menu Preferences command), by using the Debug Step Line or Debug Line color option, respectively.

The Save settings on exit check box in the Debugger Options dialog (accessed by selecting the Preferences command from the Options menu) enables you to save the size and position of windows that you resize or reposition.

If you have repositioned or resized windows within the main window and you want to return to the default layout, select the Restore Default Layout command in the View menu. This command is disabled if the windows are already in the default layout positions. In the default layout mode, resizing the JADE Debugger window retains the relative default layouts of the three windows. The current left, top, width, and height of the main JADE Debugger window are retained.

The Debugger window contains:

To enable you to debug packages and peer schemas, watches and breakpoints are visible across schemas.