2.1.2. Using the message() function for debugging

Printing output to a window or to the console is often useful for debugging components. The LISA+ language features the built-in message() function that prints messages to the output window of the environment in which the simulation is executing.

Messages are forwarded through CADISimulationCallback::simMessage().


Message handling does not work in the terminate() simulation phase because the callback has already been disconnected, see Displaying messages if no CADISimulationCallback is available.

Messages are system wide and are forwarded without instance names. To indicate the originator of the message, prefix the message with the string returned by:

The message() function has C++ and C style prototypes.

C++ prototype

message(const std::string &msg, MessageType type);

is the C++ style prototype where:


is the message to display.


characterizes the purpose or nature of the message.

The following symbols have been introduced to the LISA+ language and one of them can be passed as the type parameter:


signals a fatal error. The error message is printed in the output window preceded with the text FATAL ERROR.

If the simulation is running, it is stopped.

If the simulation is in the init() or reset() phase, the simulation is prevented from running.


indicates an error in the simulation. The message is displayed in the output window preceded by the text ERROR.


indicates that the message is a warning. The message string is printed in the output window preceded by the text WARNING.


indicates that the message string is simply printed in the output window.


If a message is classified as being a debug message, it is only printed if the debug version of build is used. The message is preceded with the text DEBUG.

C prototype

message(MessageType type, const char *fmt, ...);

is the C-style prototype with a variable parameter list where:


indicates the error type and has the same options as for the C++ prototype.


is a format specification string. The options are the same as those used with the printf() family of functions.

An example of displaying an information message is:

message(MSG_INFO, "%s - caused this message \n", getInstanceName().c_str());

Displaying messages if no CADISimulationCallback is available

If a CADISimulationCallback is not available, use the doString() function.

If a CADISimulationCallback is available, but it does not accept messages, use printf().

You can also use printf() to display messages that occur during terminate().

Copyright © 2007-2009 ARM Limited. All rights reserved.ARM DUI 0372H