VxWorks Reference Manual : Libraries

taskShow

NAME

taskShow - task show routines

ROUTINES

taskShowInit( ) - initialize the task show routine facility
taskInfoGet( ) - get information about a task
taskShow( ) - display task information from TCBs
taskRegsShow( ) - display the contents of a task's registers
taskStatusString( ) - get a task's status as a string

DESCRIPTION

This library provides routines to show task-related information, such as register values, task status, etc.

The taskShowInit( ) routine links the task show facility into the VxWorks system. It is called automatically when this show facility is configured into VxWorks using either of the following methods:

Task information is crucial as a debugging aid and user-interface convenience during the development cycle of an application. The routines taskInfoGet( ), taskShow( ), taskRegsShow( ), and taskStatusString( ) are used to display task information.

The chief drawback of using task information is that tasks may change their state between the time the information is gathered and the time it is utilized. Information provided by these routines should therefore be viewed as a snapshot of the system, and not relied upon unless the task is consigned to a known state, such as suspended.

Task management and control routines are provided by taskLib. Programmatic access to task information and debugging features is provided by taskInfo.

INCLUDE FILES

taskLib.h

SEE ALSO

taskShow, taskLib, taskInfo, taskHookLib, taskVarLib, semLib, kernelLib, VxWorks Programmer's Guide: Basic OS, Target Shell, Tornado User's Guide: Shell


Libraries : Routines

taskShowInit( )

NAME

taskShowInit( ) - initialize the task show routine facility

SYNOPSIS


void taskShowInit (void)

DESCRIPTION

This routine links the task show routines into the VxWorks system. It is called automatically when the task show facility is configured into VxWorks using either of the following methods:

RETURNS

 N/A

SEE ALSO

taskShow


Libraries : Routines

taskInfoGet( )

NAME

taskInfoGet( ) - get information about a task

SYNOPSIS

STATUS taskInfoGet
    (
    int         tid,      /* ID of task for which to get info */
    TASK_DESC * pTaskDesc /* task descriptor to be filled in */
    )

DESCRIPTION

This routine fills in a specified task descriptor (TASK_DESC) for a specified task. The information in the task descriptor is, for the most part, a copy of information kept in the task control block (WIND_TCB). The TASK_DESC structure is useful for common information and avoids dealing directly with the unwieldy WIND_TCB.

NOTE

Examination of WIND_TCBs should be restricted to debugging aids.

RETURNS

OK, or ERROR if the task ID is invalid.

SEE ALSO

taskShow


Libraries : Routines

taskShow( )

NAME

taskShow( ) - display task information from TCBs

SYNOPSIS

STATUS taskShow
    (
    int tid,  /* task ID */
    int level /* 0 = summary, 1 = details, 2 = all tasks */
    )

DESCRIPTION

This routine displays the contents of a task control block (TCB) for a specified task. If level is 1, it also displays task options and registers. If level is 2, it displays all tasks.

The TCB display contains the following fields:

Field Meaning

NAME Task name
ENTRY Symbol name or address where task began execution
TID Task ID
PRI Priority
STATUS Task status, as formatted by taskStatusString( )
PC Program counter
SP Stack pointer
ERRNO Most recent error code for this task
DELAY If task is delayed, number of clock ticks remaining in delay (0 otherwise)

EXAMPLE

The following example shows the TCB contents for the shell task:

  -> taskShow tShell, 1

    NAME        ENTRY    TID    PRI  STATUS      PC       SP    ERRNO  DELAY
  ---------- --------- -------- --- --------- -------- -------- ------ -----
  tShell     _shell     20efcac   1 READY      201dc90  20ef980      0     0

  stack: base 0x20efcac  end 0x20ed59c  size 9532   high 1452   margin 8080

  options: 0x1e
  VX_UNBREAKABLE      VX_DEALLOC_STACK    VX_FP_TASK         VX_STDIO


  D0 =       0   D4 =       0   A0 =       0   A4 =        0
  D1 =       0   D5 =       0   A1 =       0   A5 =  203a084   SR =     3000
  D2 =       0   D6 =       0   A2 =       0   A6 =  20ef9a0   PC =  2038614
  D3 =       0   D7 =       0   A3 =       0   A7 =  20ef980
  value = 34536868 = 0x20efda4

RETURNS

N/A

SEE ALSO

taskShow, taskStatusString( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

taskRegsShow( )

NAME

taskRegsShow( ) - display the contents of a task's registers

SYNOPSIS

void taskRegsShow
    (
    int tid /* task ID */
    )

DESCRIPTION

This routine displays the register contents of a specified task on standard output.

EXAMPLE

The following example displays the register of the shell task (68000 family):

-> taskRegsShow (taskNameToId ("tShell"))

d0     =        0   d1     =        0    d2    =    578fe    d3     =        1
d4     =   3e84e1   d5     =   3e8568    d6    =        0    d7     = ffffffff
a0     =        0   a1     =        0    a2    =    4f06c    a3     =    578d0
a4     =   3fffc4   a5     =        0    fp    =   3e844c    sp     =   3e842c
sr     =     3000   pc     =    4f0f2
value = 0 = 0x0

RETURNS

N/A

SEE ALSO

taskShow


Libraries : Routines

taskStatusString( )

NAME

taskStatusString( ) - get a task's status as a string

SYNOPSIS

STATUS taskStatusString
    (
    int    tid,    /* task to get string for */
    char * pString /* where to return string */
    )

DESCRIPTION

This routine deciphers the WIND task status word in the TCB for a specified task, and copies the appropriate string to pString.

The formatted string is one of the following:

String Meaning

READY Task is not waiting for any resource other than the CPU.
PEND Task is blocked due to the unavailability of some resource.
DELAY Task is asleep for some duration.
SUSPEND Task is unavailable for execution (but not suspended, delayed, or pended).
DELAY+S Task is both delayed and suspended.
PEND+S Task is both pended and suspended.
PEND+T Task is pended with a timeout.
PEND+S+T Task is pended with a timeout, and also suspended.
...+I Task has inherited priority (+I may be appended to any string above).
DEAD Task no longer exists.

EXAMPLE

    -> taskStatusString (taskNameToId ("tShell"), xx=malloc (10))
    new symbol "xx" added to symbol table.
    value = 0 = 0x0
    -> printf ("shell status = <%s>\n", xx)
    shell status = <READY>
    value = 2 = 0x2

RETURNS

OK, or ERROR if the task ID is invalid.

SEE ALSO

taskShow