Purpose

The module RuntimeDump installs a function in the ML error handler which can dump ML modules and other runtime typed objects of the ML if the ML considers them as the probably reason for an error or crash.

This module can be added for diagnostic purposes to a module network to get a string dump of error causing ML modules.

Usage

Simply add this module to your module network.

The RuntimeDump will try to install its dump function in the ML error handler. Normally that will work, however, if another application or RuntimeDump has already installed that function, the module will notify that in its State Info field.

If installing the function works fine, all possible states of error causing ML modules will be dumped to the “Handling” section of generated error messages.

Note that mostly fatal errors will cause such dumping and in debug mode the ML is configured to terminate after handling the error; you need to reconfigure the ML error handler to catch fatal errors and to continue after them to see dumped results.

Currently the installed dump function dumps objects of the following (runtime) class types if they are passed to any of the macros _ML_PRINT_FATAL_ERROR, _DUMP _ML_PRINT_ERROR_DUMP or _ML_PRINT_WARNING_DUMP:

  • Field
  • FieldContainer
  • SubImage
  • MemoryImage
  • PagedImage
  • MedicalImageProperties
  • ImageProperties
  • Module

Tips

You can use the RuntimeDump module also in applications which run in release mode to have additional error information in the case of fatal errors caught by the ML. That information in the error outputs will make debugging easier, especially in release mode where detailed debug information is normally not available.

Note that objects which cause exceptions tend to be in a state which might make it impossible to dump them correctly. Although the dump functionality is implemented quite safely within exception handlers it may happen that dumping does not work or even fails if such an objects is completely destroyed. So crashes within the RuntimeDump module may happen in bad contexts.

Example network

The example network is comprised of the following modules:

  • A CoreControl to configure the ML core for correct error and exception handling.
  • An ErrorTest modue can be used to create an exception to force the ML error handling system to create a fatal error and to call the dump function.
  • A RuntimeDump module installs the dump function to dump the error causing module (ErrorTest).
  • A Console module in which the error information can be viewed.

If you work in debug mode be aware that the ML will handle exceptions by executing an abort() statement to start the debugger; you need to enable exception handling in the CoreControl module in the panel ErrorHandling and also you need to set On Fatals error to Continue to make the ML continue after exceptions. Then you can force an exception in the ErrorTest module by pressing Access NULL Address. The console module will show a fatal error message and a dump of the ErrorTest module which caused the error.

Windows

Default Panel

../../../Modules/ML/MLDiagnosis/mhelp/Images/Screenshots/RuntimeDump._default.png

Parameter Fields

Visible Fields

State Info

name: stateInfo, type: String, persistent: no

Shows whether the dump functionality is installed or not or why it could be (un)installed.

Install Dump Function

name: installDumpFunction, type: Bool, default: TRUE

If enabled, the module will try install the Dump functionality in the ML error handler, otherwise it will try to uninstall it. The success will be reported in State Info as well as failures.