op_prg_odb_bkpt()
Abstract
Defines a labeled breakpoint which will occur if the simulation is running under ODB control, and if the labeled breakpoint is enabled.
Syntax
op_prg_odb_bkpt (label)
| Argument | Type | Description |
|---|---|---|
label |
const char* |
label string that identifies the breakpoint. This string is compared with the labels of enabled labeled breakpoints. These types of breakpoints are enabled via the ODB commands lstop or mlstop. Labels can include any ASCII characters, including whitespace characters. |
Return Type
void
No return value.
Example
/* perform different actions depending on the type of interrupt */
switch (op_intrpt_type ())
{
case OPC_INTRPT_REMOTE:
gate_status = op_intrpt_code ();
op_prg_odb_bkpt ("gate.remote");
break;
case OPC_INTRPT_STRM:
if (gate_status == GATE_OPEN)
op_pk_send (op_pk_get (0), 0);
else{
op_prg_odb_bkpt ("gate.closed");
op_pk_destroy (op_pk_get (0));
}
break;
case OPC_INTRPT_STAT:
remote_status = (int) op_stat_local_read (REMOTE_STAT);
break;
}
Details
Breakpoints are halts during a simulation’s execution which provide the user with the ability to assess the status of the simulation, and determine the scope of event processing before another breakpoint occurs. Simulation breakpoints are supported within the ODB simulation debugger (see “Simulation Debugger (ODB)“ on page 39 for information on using ODB). Various types of breakpoints can be defined and/or enabled within ODB, including time-oriented, event-oriented, and labeled breakpoints. Labeled breakpoints are defined from within process models, using this KP, and can be enabled within ODB via the commands lstop and mlstop.
This KP detects labeled traces activated via either lstop or mlstop, provided that the label string passed to the KP exactly matches the label string passed to the ODB command. Labeled traces that are restricted to a specific module will only be detected if this KP is being invoked by a process executing in that module.
This KP does nothing when used with an optimized simulation kernel.
Purpose
Provides a mechanism for a process to define a breakpoint which occurs under certain conditions. For instance, this KP can be embedded in if statements, switch statements, or in special process transitions or states; whenever the associated code is executed and this KP is invoked, an opportunity for a breakpoint occurs. Breakpoint “opportunities” are realized if the breakpoint has been enabled by the ODB commands lstop or mlstop. The ability to selectively enable KP-defined breakpoints permits their retention in process models after the initial debugging phase of the associated model portion is complete. Labeling of breakpoints permits many separate groups of process-defined breakpoints to coexist in a simulation, remaining dormant until they are specifically enabled.
Errors
- Program Abort: Segmentation violation. (due to an invalid label pointer, or a malformed label string)
Reference
- Use the KP op_prg_odb_print_major() and op_prg_odb_print_minor() KPs to print debugging messages prior to a conditional labeled breakpoint (i.e., a breakpoint that only occurs under special circumstances)
- Use the ODB command
lstopto globally enable a labeled breakpoint defined by this KP - Use the ODB command
mlstopto enable on a per-module basis a labeled breakpoint defined by this KP