Previous - Up - Next

2.4   Logging

DML has direct support for writing log messages to the Simics logging facility, through the log statement. The most important logging concepts are the type and the verbosity level of the message, where the most common message types are "info" and "error". The verbosity level is a number between 1 and 4, where 1 is used for important messages that should always be displayed, and 4 is used for messages that should only be printed when verbose logging has been requested. For error messages, the level is always 1. By default, Simics only displays messages of level 1 on the console.

In the previous example, no level was provided, which will make it default to 1. To set the level of a message, add it after the type string, but before the colon, as in:

    log "info", 2: "This is a level 2 message.";

To change what messages are displayed, use the log-level command.

  simics> log-level 4
Now make a memory access to the device, as before:
  simics> phys_mem.get 0x1000
This time (apart from the "Hello bus!" message), you should see an info message saying something like "Inquiry read from register b.r0". This is logged by the built-in code that handles register read accesses, and messages like this can be very useful when debugging a device model.

Previous - Up - Next