breakpoint_manager breakpoint_type_provider
API Reference Manual  /  7 Simulator-to-Simulator Interfaces  / 

breakpoint_type

Description
The breakpoint_type interface is implemented by the breakpoint manager and facilitates registering breakpoint types.

This interface is currently a tech preview and can be changed at any time.

The register_type method registers a breakpoint type and creates CLI commands for this type. The name parameter should be the unique name for the type, which is also used in the names of any commands registered on interfaces or class. The provider parameter should be the provider object, which must implement the breakpoint_type_provider interface.

The registered commands are break, run-until, wait-for, trace and untrace, which are registered on the provider class. If cls or iface are non-NULL, commands are also registered on that class or interface. These commands are bp-break-{name}, bp-run-until-{name}, bp-wait-for-{name}, bp-trace-{name} and bp-untrace-{name}, where {name} is the name parameter.

The cls and iface parameters cannot both be non-NULL.

The args parameter is a list that defines the CLI command arguments. It should be a list of lists where each inner list contains the name of the cli.Arg_type subclass, such as str_t, flag_t etc, and then all parameters to its constructor (including values for parameters that have default values).

The docs parameter should be an 8-element list with short and long command documentation texts for the four commands break, run-until, wait-for and trace.

The object_required parameter indicates if the commands registered on the provider class (as opposed to the commands on the class or interface) should require an object (or if the command can use a default object). Note that there will only be an object parameter if cls or iface are non-NULL.

The temporary_default parameter indicates if the breakpoints of this type should be temporary by default. This also results in the generated break command not having a -once flag.

Setting recursive to true will append a '-recursive' flag to both global and object commands, and for the global command, the 'object' argument will have no specified class or iface.

The trigger method must be called by the provider every time a breakpoint triggers, both breakpoints added with register_bp method and those added with add_bp method of the breakpoint_type_provider interface.

SIM_INTERFACE(breakpoint_type) {
        /* Returns false if type is already registered. */
        bool (*register_type)(conf_object_t *NOTNULL mgr,
                              const char *NOTNULL name,
                              conf_object_t *NOTNULL provider,
                              /* CLI command arguments as a list */
                              attr_value_t args,
                              /* Class and/or iface for command */
                              const char *cls,
                              const char *iface,
                              /* 8-element list with short and long
                                 command help texts */
                              attr_value_t docs,
                              /* Is an object required
                                 (or can it default to something) */
                              bool object_required,
                              /* Should breakpoints be temporary by default? */
                              bool temporary_default,
                              /* Set to true to allow all objects in 'object' argument */
                              bool recursive);
        /* Notify manager that breakpoint has triggered, given ID returned by
           add_bp. Returns true if simulation was stopped or otherwise the
           breakpoint action happened. Optionally provide trigger object and
           message, used if the simulation is stopped. */
        bool (*trigger)(conf_object_t *NOTNULL mgr,
                        conf_object_t *NOTNULL provider, uint64 bp_id,
                        conf_object_t *trigger, const char *msg);
        /* Return provider ID from breakpoint manager ID. */
        uint64 (*get_break_id)(conf_object_t *NOTNULL mgr, uint64 bm_id);
        uint64 (*get_manager_id)(conf_object_t *NOTNULL mgr,
                                 conf_object_t *NOTNULL provider, uint64 bp_id);
};
#define BREAKPOINT_TYPE_INTERFACE "breakpoint_type"

Execution Context
Global Context

breakpoint_manager breakpoint_type_provider