Changes characteristics of one or more tasks of a tasking program
(also called a multithread program).
NOTE
SET TASK and SET THREAD are synonymous commands. They
perform identically.
Format
SET TASK [task-spec[, . . . ]]
1 – Parameters
task-spec
Specifies a task value. Use any of the following forms:
o When the event facility is THREADS:
- A task (thread) ID number as declared in the program, or a
language expression that yields a task ID number.
- A task ID number (for example, 2), as indicated in a SHOW
TASK display.
o When the event facility is ADA:
- A task (thread) name as declared in the program, or a
language expression that yields a task value. You can use a
path name.
- A task ID (for example, %TASK 2), as indicated in a SHOW
TASK display.
o One of the following task built-in symbols:
%ACTIVE_TASK The task that runs when a GO, STEP, CALL, or
EXIT command executes.
%CALLER_TASK (Applies only to Ada programs.) When an accept
statement executes, the task that called the
entry associated with the accept statement.
%NEXT_TASK The task after the visible task in the
debugger's task list. The ordering of tasks
is arbitrary but consistent within a single
run of a program.
%PREVIOUS_ The task previous to the visible task in the
TASK debugger's task list.
%VISIBLE_TASK The task whose call stack and register set are
the current context for looking up symbols,
register values, routine calls, breakpoints,
and so on.
Do not use the asterisk (*) wildcard character. Instead, use the
/ALL qualifier. Do not specify a task with /ALL or /TIME_SLICE.
If you do not specify a task or /ALL with /ABORT, /[NO]HOLD,
/PRIORITY, or /RESTORE, the visible task is selected.
2 – Qualifiers
2.1 /ABORT
Marks the specified tasks for termination. Termination occurs
at the next allowable point after a specified task resumes
execution.
For HP Ada tasks, the effect is identical to executing an Ada
abort statement for the tasks specified and causes these tasks
to be marked as abnormal. Any dependent tasks are also marked for
termination.
For POSIX threads threads, use the following command:
PTHREAD tset -c thread-number
You can get help on POSIX threads debugger commands by typing
PTHREAD HELP.
See the Guide to the POSIX Threads Library for more information
about using the POSIX threads debugger.
2.2 /ACTIVE
Makes the specified task the active task, which is the task that
runs when a STEP, GO, CALL, or EXIT command executes. This causes
a task switch to the new active task and makes that task the
visible task. The specified task must be in either the RUNNING or
READY state. When using /ACTIVE, you must specify one task.
For POSIX threads programs or Compaq Ada on Alpha programs, use
one of the following alternatives:
o For query-type actions, use the SET TASK/VISIBLE command.
o To gain control of execution, use a strategic placement of
breakpoints.
o Use the PTHREAD tset -a thread-number command.
You can get help on POSIX threads debugger commands by typing
PTHREAD HELP.
See the Guide to the POSIX Threads Library for more information
about using the POSIX threads debugger.
2.3 /ALL
Applies the SET TASK command to all tasks.
2.4 /HOLD
/HOLD
/NOHOLD (default)
When the event facility is THREADS, use the
PTHREAD tset -h thread-number or the PTHREAD tset -n thread-num
command.
Controls whether a specified task is put on hold. The /HOLD
qualifier puts a specified task on hold.
Putting a task on hold prevents a task from entering the RUNNING
state. A task put on hold is allowed to make other state
transitions; in particular, it can change from the SUSPENDED
to the READY state.
Putting a task on hold prevents a task from entering the RUNNING
state. A task put on hold is allowed to make other state
transitions; in particular, it can change from the SUSPENDED
to the READY state.
A task already in the RUNNING state (the active task) can
continue to execute as long as it remains in the RUNNING state,
even though it is put on hold. If the task leaves the RUNNING
state for any reason (including expiration of a time slice, if
time slicing is enabled), it will not return to the RUNNING state
until released from the hold condition.
You can override the hold condition and force a task into the
RUNNING state with the SET TASK/ACTIVE command even if the task
is on hold.
The /NOHOLD qualifier releases a specified task from hold.
You can get help on POSIX threads debugger commands by typing
PTHREAD HELP.
See the Guide to the POSIX Threads Library for more information
about using the POSIX threads debugger.
2.5 /PRIORITY
/PRIORITY=n
When the event facility is THREADS, use the PTHREAD
tset -s thread-number command.
Sets the priority of a specified task to n, where n is a decimal
integer from 0 to 15. This does not prevent the priority from
later changing in the course of execution, for example, while
executing an Ada rendezvous or
Sets the priority of a specified task to n, where n is a decimal
integer from 0 to 15. This does not prevent the priority from
later changing in the course of execution, for example, while
executing an Ada rendezvous or POSIX threads synchronization
event. This qualifier does not affect a task's scheduling policy.
You can get help on POSIX threads debugger commands by typing
PTHREAD HELP.
See the Guide to the POSIX Threads Library for more information
about using the POSIX threads debugger.
2.6 /VISIBLE
Makes the specified task the visible task, which is the task
whose call stack and register set are the current context for
looking up symbols, register values, routine calls, breakpoints,
and so on. Commands such as EXAMINE are directed at the visible
task. The /VISIBLE qualifier does not affect the active task.
When using /VISIBLE, you must specify one task.
3 – Description
The SET TASK command enables you to establish the visible task
and the active task, control the execution of tasks, and cause
task state transitions, directly or indirectly.
To determine the current state of a task, use the SHOW TASK
command. The possible states are RUNNING, READY, SUSPENDED, and
TERMINATED.
Related commands:
DEPOSIT/TASK
EXAMINE/TASK
SET BREAK/EVENT
SET TRACE/EVENT
(SET, SHOW) EVENT_FACILITY
SHOW TASK|THREAD
4 – Examples
1.DBG> SET TASK/ACTIVE %TASK 3
(Event facility = ADA) This command makes task 3 (task ID = 3)
the active task.
2.DBG> PTHREAD tset -a 3
(Event facility = THREADS) This command makes task 3 (task ID =
3) the active task.
3.DBG> SET TASK %NEXT_TASK
This command makes the next task in the debugger's task list
the visible task. (The /VISIBLE qualifier is a default for the
SET TASK command.)
4.DBG> SET TASK/HOLD/ALL
DBG> SET TASK/ACTIVE %TASK 1
DBG> GO
. . .
DBG> SET TASK/ACTIVE %TASK 3
DBG> STEP
. . .
In this example, the SET TASK/HOLD/ALL command freezes
the state of all tasks except the active task. Then, SET
TASK/ACTIVE is used selectively (along with the GO and STEP
commands) to observe the behavior of one or more specified
tasks in isolation.