Debugging program

In this section you will learn how to debug a Smallworld 5.1 and later program.

  1. Start swaf session assigned to ws_example_magik project in debug mode.
  2. Add Magik product named ws_example_product to session. Select it in Product Explorer view and click Session > Add Product.
  3. Load Magik module named ws_example_module to session. Select it in Product Explorer view and click Session > Load Module.
  4. Double-click the ws_manager.magik file to open it in the editor.
  5. Place your cursor on the vertical ruler along the left edge of the editor, on the following line in ws_manager.send_data() method:

    write("[MAGIK] send data to WS:", url);

    double-click on the ruler to set a breakpoint.

    Setting breakpoint

  6. Double-click the WsManager.java file from the ws_example_java project to open it in the editor.
  7. Set breakpoint on the following line:

    Setting breakpoint

  8. Run the program in the console with a command: ws_manager.send_data()
  9. The program will execute until the first breakpoint is reached (in Magik code). When the breakpoint is triggered, execution will be suspended and you will be asked, whether to switch to the Debug perspective. Click Yes. Notice that the process is still active (not terminated) in the Debug view. Other threads might still be running.

    Suspended on Magik brekapoint

  10. Press F8 or click   Resume (Resume) button to allow the program to run until the next breakpoint is encountered or until the program is completed.
  11. The program will execute until the next breakpoint is reached (in Java code).

    Suspended on Java brekapoint

  12. You can end the debugging session by allowing the program to run to completion, or by terminating it. You can find more information about debugging Smallworld 5 program here.
  13. Next exporting Java library.

Related concepts

Smallworld 5 Debugger

Related tasks

Smallworld 5 Local Debugging

Related reference

Smallworld 5 Debug Preferences