Smallworld 5 Debugging Tips

Smallworld 5 Debugger

There is a debugger located here. https://github.com/OpenSmallworld/magik-debugger . You will need to get node.js from https://nodejs.org/en/download/

Guide to use

<potentially add step by step instructions… Look at the Github wiki above>

Traceback Information

The Smallworld 5 tracebacks do not provide arguments as in the older versions. They do provide line numbers to the magik or java file that they are called from. This is very helpful only if you have the code, which is less and less under the new product delivery.

Also in Smallworld 5, the actual exemplar/mixin name that the method is written on is reported in the traceback. Prior releases had the subclassed exemplar name if it was inherited. So now it is more difficult to determine from the traceback if you are dealing with a Magik object or a realized database object. It does provide the benefit of knowing exactly where the method is from, where prior releases you had to figure out if the method was written on the exemplar or not.

Reporting All Tracebacks

Attached is a condition.magik file (requires fcsi_core.zip, also attached). This has methodology to display all tracebacks, handled or not. This is useful for debugging application startups. Usages:

  • condition.fcsi_trace_level << [num or _unset] - Num is the traceback depth, 15 is pretty good. Set to _unset to turn off functionality.
  • condition.fcsi_report_count << [num] There is an upper limit to the number of tracebacks that is shown. This is to help reduce excessive reporting that may take forever. if you just see the condition reporting, then reset this to 0. I typically set this to -1000 when I debug application startups.

Reporting Arguments for Methods

I have added code here that easily copies the original method to a new method name. It provides an option to report a replacement method that calls and returns results of the new method name. It will also show the argument list.

To show the arguments being passed into a method you can use the following. This is especially helpful when figuring where unset is being passed to something!

fcsi_method_manip.fcsi_show_args(xml_parse_acp,:|parse_file()|)

You will be able to compile the reported new method and when called, see what the arguments are.

Identifying Message Dialog

There are times when a message pops up, but there are no underlying conditions being thrown to display that message. You can use fcsi_method_manip.fcsi_show_traceback(sw_message_dialog,:activate_in|()|) to show a traceback to where the message dialog is opened. To deactivate the traceback information use fcsi_method_manip.fcsi_restore_method(sw_message_dialog,:activate_in|()|,:db!)

Java/Smallworld Debug Information (Logs)

You can modify the logging properties file located at core\libs\osgi_config\services\org.ops4j.pax.logging.properties to enable debug level logging and send through the complete log.

log4j.appender.ConsoleAppender.threshold=DEBUG

Development Tools

In 4.x GE introduced the Development Tools product & application. It contain a simple 1 method debugger and other tools for coverage & mouse clicks. Out of th box, the development tools were listed as a product in the module manager GUI. In Smallworld 5.1.x (not sure exact release) the product isn't available in the module manager GUI. The product exists under sw_core/modules directory. You can reinitialize the sw_core product or add it using

smallworld_product.add_product(system.pathname_down(
    smallworld_product.product_path, "sw_core", "modules", "sw_dev_tools"))

sw_module_manager.load_module(:dev_tools_application)

Databus Monitoring

The Object Inspector in SW5 (5.1,5.1.2rc1) is flakey. If you just need the databus monitoring piece, you can user the databus_monitor_dialog. For example:

databus_monitor_dialog.open({
    swaf!.plugin(:plotting).dialogs.an_element().plugin(:layout_manager)
})

Attached files:

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License