script_branch
import script_branch
script_branch.check_reverse_args(what, reverse, always)
Warn if reverse or always arg is not None.
script_branch.check_script_branch_command(cmd, reverse=None, always=None)
Common script-branch checks, raising CliError if the command is incorrectly used. Returns True if the script-branch command should run and False if it should silently return immediately
script_branch.sb_create(func, desc=None)
Creates a script branch.
Create a script branch that will start executing func (which should not take any arguments). The sb_create function returns a unique script-branch identifier, that can be used with `script_branch.sb_interrupt_branch. It may be called from a script branch to create a new parallel branch. The current branch will resume execution when the new script branch is suspended.
The optional desc argument will be displayed by list-script-branches as a description of the script branch.
Global Context
script-branch identifier
script_branch.sb_wait, script_branch.sb_interrupt_branch, script_branch.sb_run_in_main_branch
script_branch.sb_get_wait_id()
Obtains script branch wait ID.
Return a new unique script-branch wait-identifier that can be used when suspending a script-branch using sb_wait.
script branch wait-identifier
script_branch.sb_in_main_branch()
Indicates if the main branch is running.
Return true if the main branch is currently active, and not one of the script branches.
script_branch.sb_interrupt_branch(branch_id)
Interrupts suspended script branch.
Interrupt a script branch that is currently suspended. The branch_id should be the script-branch identifier (returned by script_branch.sb_create) of a suspended script branch, otherwise an exception is raised.
As a side effect, the sb_wait function called in the script branch will raise a CliQuietError exception.
script_branch.sb_run_in_main_branch(command, func)
Runs function in the main thread.
Schedule func (which should not take any arguments) to run in the main thread and block the calling script-branch thread until the function has run. A CliError exception will be raised if an error occurs while running func, otherwise its return value is returned.
return value of func
script_branch.sb_signal_waiting(wait_id)
Wakes up a suspended script branch.
Wake up a suspended script-branch, with wait_id as wait identifier, letting it run again.
script_branch.sb_wait(
command,
wait_id,
reverse=None,
always=None,
wait_data=None,
use_obj=None
)
Suspends a script branch.
Suspend a script branch in the command command (a descriptive string) until sb_signal_waiting is called with wait_id as argument. The reverse and always should not be used. The wait_data argument is a string describing the data being waited for, or None. The use_obj argument is deprecated and should never be specified.
script_branch.sb_create, script_branch.sb_get_wait_id, script_branch.sb_signal_waiting
script_branch.sb_wait_for_hap(
command,
hap,
obj,
idx,
reverse=None,
always=None,
wait_data=None
)
Help function for script-branch commands that should suspend until a certain hap occurs. ‘hap’ is the name of the hap. ‘obj’ is object or None that the hap is associated with. ‘idx’ is the hap index or -1 when the index should be ignored. reverse and always correspond to the script-branch arguments with the same names. The wait_data argument is a string describing the data being waited for, or None.
script_branch.sb_wait_for_notifier(
command,
notifier,
what,
reverse,
always,
wait_data=None
)
Suspends script branch execution until the specified notifier occurs.
The arguments ‘notifier’ and ‘what’ correspond to the arguments with the same names to SIM_add_notifier. ‘reverse’ and ‘always’ correspond to the script-branch arguments with the same names (see the help on e.g. the bp.wait-for-breakpoint command). The optional wait_data argument is a string describing the data being waited for (will be visible in the list-script-branches command).
Raises CLiError if ‘what’ is not an integer (a notifier_type_t), if ‘notifier’ is not a Simics object, or if ‘what’ is not registered on ‘notifier’.