dev_util_internal probes
API Reference Manual  /  Python API  / 

script_branch

Name

script_branch

Synopsis

Python

import script_branch

script_branch.check_reverse_args

Synopsis

script_branch.check_reverse_args(what, reverse, always)

Description

Warn if reverse or always arg is not None.

script_branch.check_script_branch_command

Synopsis

script_branch.check_script_branch_command(cmd, reverse=None, always=None)

Description

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

Synopsis

script_branch.sb_create(func, desc=None)

Description

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.

EXECUTION CONTEXT

Global Context

RETURN VALUE

script-branch identifier

SEE ALSO

script_branch.sb_wait, script_branch.sb_interrupt_branch, script_branch.sb_run_in_main_branch

script_branch.sb_get_wait_id

Synopsis

script_branch.sb_get_wait_id()

Description

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.

RETURN VALUE

script branch wait-identifier

SEE ALSO

script_branch.sb_wait, script_branch.sb_signal_waiting

script_branch.sb_in_main_branch

Synopsis

script_branch.sb_in_main_branch()

Description

Indicates if the main branch is running.

Return true if the main branch is currently active, and not one of the script branches.

SEE ALSO

script_branch.sb_run_in_main_branch

script_branch.sb_interrupt_branch

Synopsis

script_branch.sb_interrupt_branch(branch_id)

Description

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.

SEE ALSO

script_branch.sb_create, script_branch.sb_wait

script_branch.sb_run_in_main_branch

Synopsis

script_branch.sb_run_in_main_branch(command, func)

Description

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

return value of func

SEE ALSO

script_branch.sb_create, script_branch.sb_in_main_branch

script_branch.sb_signal_waiting

Synopsis

script_branch.sb_signal_waiting(wait_id)

Description

Wakes up a suspended script branch.

Wake up a suspended script-branch, with wait_id as wait identifier, letting it run again.

SEE ALSO

script_branch.sb_wait, script_branch.sb_get_wait_id

script_branch.sb_wait

Synopsis

script_branch.sb_wait(
    command,
    wait_id,
    reverse=None,
    always=None,
    wait_data=None,
    use_obj=None
)

Description

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.

SEE ALSO

script_branch.sb_create, script_branch.sb_get_wait_id, script_branch.sb_signal_waiting

script_branch.sb_wait_for_hap

Synopsis

script_branch.sb_wait_for_hap(
    command,
    hap,
    obj,
    idx,
    reverse=None,
    always=None,
    wait_data=None
)

Description

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

Synopsis

script_branch.sb_wait_for_notifier(
    command,
    notifier,
    what,
    reverse,
    always,
    wait_data=None
)

Description

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’.

dev_util_internal probes