op_sim_debug()
Abstract
Determines if the simulation is currently in debug mode.
Syntax
op_sim_debug ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
Boolean
Boolean value indicating if the simulation is currently running under the OPNET debugger. This value is OPC_TRUE if in debug mode, OPC_FALSE if not in debug mode.
Example
/* obtain the arriving packet */
pkptr = op_pk_get (INSTRM_MAC);
/* if in debug mode, print out the arriving packet */
if (op_sim_debug () == OPC_TRUE)
{
printf ("-----------------------------------------------\n");
printf ("Time (%g): Module (LLC): Packet Arriving\n", op_sim_time ());
printf ("-----------------------------------------------\n");
op_pk_print (pkptr);
}
Details
A simulation is in debug mode when it is executed with the debug environment attribute enabled, as shown in the example command line below:
%example.sim -debug
Purpose
Provides a mechanism to determine if the simulation has been executed with the debug flag enabled. This KP is usually invoked in the conditional clause of an if statement, to bracket a group of statements which should only be executed if the simulation is in debug mode. Typically the bracketed statements will print out optional debugging and tracing information to the standard output device, which is useful whenever the simulation is being analyzed for bugs or possible low-level behavioral enhancements.
Errors
- No errors are trapped.
Reference
- Use the KP op_ima_sim_attr_get() to access the value of a simulation attribute, which can be used as a user-defined, special debug flag
- Use the KP op_sim_message() to print messages onto the standard output device
- Use the KPs op_prg_odb_print_minor() and op_prg_odb_print_major() to print information to the standard output in the same format as statements issued by ODB, the OPNET debugger