Package: ASCL.Debugging_Support

Last update: 12 Nov 99 / 20:50


Overview

This package provides a framework for debugging information. The package can be adopted to different environments by extending the Debugg_Support.Object type and implementing the Output Procedure.


Synopsis

procedure Initialize( this : in out Object'Class ); procedure Finalize( this : in out Object'Class );

type Debug_Level is ( Quiet, Logic, Verbose ); procedure Set( this : in out Object'Class; level : in Debug_Level ); function Get( this : in Object'Class ) return Debug_Level;

procedure Error( this : in Handle; text : in String );

procedure Trace( this : in Handle; text : in String );

procedure Enter( this : in Handle; text : in String ); procedure Leave( this : in Handle; text : in String );

procedure Output( this : in out Object; text : in String ) is abstract;

Description

Initialize

This procedure is called to initialize the debugging object. It should be called alwas before the object is used.

Finalize

This procedure should be called when the object is not used any more.

Debug_Level

The debug level controls the amount of information written into the debugging trace. The following values are possible:

Debug_Level

Meaning

Quiet

No trace output is written

Logic

Trace is written showing the method calls (enter/leave ).

Verbose

All trace information is written. This include the enter/leave and Trace calls.

Set

Set the current debug level

Get

Query the current debug level.

Error

This procedure may be called by the application every time an error has occured. The error text and a call backtrace is written into the debug output.

Trace

This information which is shown in the debug output if the trace level is set to verbose.

Enter/Leave

Enter indicates, that a method is entered and Leave that the method is left. An example of usage is given below.

procedure Open( this : in out Object; .... ) is debug : ... := this.debug; begin Enter( debug, "Open");

...

Leave( debug, ""); end Open;

Output

This procedure has to be supplied by the implementation. In simple cases it will be a simple Put_Line into a stream. In embeded systems this procedure may output a string to a LED display.


Discussion

none

References