breakpoint_type_provider interface should be implemented
by objects that wish to act as breakpoint type providers towards the
breakpoint manager. An object that is passed to the breakpoint manager via
the register_type method in the breakpoint_type
interface must implement breakpoint_type_provider.
This interface is currently a tech preview and can be changed at any time.
The register_bp and add_bp methods receives the
command arguments, corresponding to what the breakpoint manager received in
the register_type. The register_bp method should set
up a breakpoint, register it with the breakpoint manager via the
breakpoint_registration interface, and return the breakpoint
manager ID for that breakpoint. The add_bp method should set up
an internal breakpoint, which is not registered with the breakpoint manager,
and return a provider-specific ID for this breakpoint. The breakpoint
manager will use this ID to remove the breakpoint via the
remove_bp method, and this ID should also be used when calling
the trigger method in the breakpoint_type
interface.
The register_bp and add_bp methods should return 0 to indicate an error in setting up the breakpoint.
The break_msg method should return the message that should be printed by the bp.break command after the breakpoint is set up. It receives the breakpoint manager ID for the breakpoint.
The trace_msg method should return the message that should be printed when an (internal) trace breakpoint has hit. It receives the provider specific ID for the breakpoint.
The wait_msg method should return the message that is attached to the script branch while waiting for a breakpoint to hit (displayed by e.g. list-script-branches). It receives the provider specific ID for the breakpoint.
The optional method break_data can be implemented to make the wait-for and run-until commands return something. It receives the provider specific ID for the breakpoint.
The method values must be implemented if the provider has specified that CLI command expanders should be used, when registering the breakpoint type. Otherwise the method is not called by the breakpoint manager. It should return the possible values for the command argument arg, which will be one of the argument names used when registering the type. The parameter prev_args will be the list of preceding argument values.
The deleted method is typically optional. If implemented, it is
called by the deleted function of
the breakpoint_registration interface. Normally,
breakpoint manager
registered breakpoints are deleted using the function that was given
to the register_breakpoint method of the
breakpoint_registration interface, which is used by the
bp.delete, but if the breakpoint can be removed by other means,
then this method can be implemented.
SIM_INTERFACE(breakpoint_type_provider) {
/* Register breakpoint in manager.
Return breakpoint manager ID, or 0 on error. */
uint64 (*register_bp)(conf_object_t *NOTNULL obj, uint64 bp_id);
/* Add breakpoint and return provider specific ID, or 0 on error. */
uint64 (*add_bp)(conf_object_t *NOTNULL obj,
int flags, attr_value_t data);
/* Remove breakpoint, given ID returned by add_bp. */
void (*remove_bp)(conf_object_t *NOTNULL obj, uint64 bp_id);
/* Return trace message, given ID returned by add_bp. */
const char *(*trace_msg)(conf_object_t *NOTNULL obj, uint64 bp_id);
/* Message returned by break command, given ID returned by add_bp. */
const char *(*break_msg)(conf_object_t *NOTNULL obj, uint64 bp_id);
/* Script branch wait message, given ID returned by add_bp. */
const char *(*wait_msg)(conf_object_t *NOTNULL obj, uint64 bp_id);
/* Optional return value from wait-for and run-until commands,
given ID returned by add_bp. */
attr_value_t (*break_data)(conf_object_t *NOTNULL obj, uint64 bp_id);
/* Return possible values for command argument.
Optional unless expanders used. */
attr_value_t (*values)(conf_object_t *NOTNULL obj,
const char *arg, attr_value_t prev_args);
/* Optional trace output function. The default is to log on the
provider with level 1 and group 0. */
void (*trace)(conf_object_t *NOTNULL obj, const char *msg);
};
#define BREAKPOINT_TYPE_PROVIDER_INTERFACE "breakpoint_type_provider"