MDL V8 - Automatic Fault Reporting


Automatic Fault Reporting

When MicroStation encounters a fault in an MDL program it examines the environment variables MS_DEBUGFAULT and MS_MDLTRACE to determine how to report the fault.

Regardless of whether these environment variables are defined, MicroStation writes messages to the command window providing information on the type of error and where the error occurred.

If MS_DEBUGFAULT is defined, MicroStation tries to invoke the MDL debugger for the application that caused the fault. MicroStation tries to do this even if the application was not being debugged. MDL developers should always have MS_DEBUGFAULT enabled so they do not need to try to reproduce unexpected faults. MicroStation ignores MS_DEBUGFAULT if the fault occurs in an application that does not have any debugging information. An application has some debugging information unless it was linked with the -go modifier.

If MS_MDLTRACE is defined, MicroStation prints debugging information to stdout. MicroStation prints the cause of the fault and the location where the fault occurred. It also displays the name of each MDL application it encounters while unwinding the stack. For example, if an error occurs in an MDL application's dialog hook function that was called by MicroStation's Dialog Manager (the DITEMS MDL task), then MicroStation would first print a description of the error, then information on the application containing the hook function, and then information on DITEMS.

Debugger Initialization File

The first time it is invoked in a MicroStation session, the MDL debugger checks for the environment variable MS_DBGINIT. If it is defined, then the debugger interprets the definition as a file name. The debugger opens the file and reads the file, interpreting the contents as debugger commands.