Analyzing Program Performance With Sun WorkShop

vars

vars has the following syntax:


vars [-aho] var ...
vars [-ahilo]
vars [-ahlo] protected by lock
vars [-ahlo] [directly] read by func ...
vars [-ahlo] [directly] written by func ...
vars [-ahlo] [directly] accessed by func ...

Lists information about the variables of the loaded files. Only those variables that are actually used are shown; variables that are simply declared in the program but never accessed are not shown.

Table A-9 vars Options

Option

Definition 

 

-a

(assert) Shows information about which lock is supposed to protect each variable, as specified by the assert mutex|rwlock protects subcommand. The information is shown as follows assert=lock

If the assertion is violated, then after analysis this will be preceded by an asterisk, such as *assert=<lock>.

-h

(held) Shows information about which locks were consistently held when the variable was accessed. This information is shown after the analyze subcommand has been run. If the variable was never accessed, this information is not shown. When it is shown, it looks like this:

held={ <lock> ... }

If no locks were consistently held and the variable was written, this is preceded by an asterisk, such as *held={ }. Unlike funcs, the vars subcommand lists a lock as protecting a variable even if the lock was not actually held, but was simply covered by another lock. (See assert rwlock covers in the description of "assert".)

-i

(ignored) causes even ignored variables to be listed.

-l

(long) Equivalent to -aho.

-o

(other) Where applicable, shows information about each variable

=cond_var

Indicates that this variable is used as a condition variable. 

=ignored

Indicates that LockLint has been told to ignore the variable explicitly via an ignore subcommand.

=read-only

Means that LockLint has been told (by assert read only) that the variable is read-only, and will complain if it is written. If it is written, then after analysis this will be followed by an asterisk, such as =read-only* for example.

=readable

Indicates that LockLint has been told by a declare readable subcommand that the variable may be safely read without holding a lock.

=unwritten

May appear after analysis, meaning that while the variable was not declared read-only, it was never written. 

vars [-aho] var ...

Lists information about individual variables. By default, this variant of the subcommand gives all the details about the variables, as if -aho had been specified.

vars [-ahilo]

Lists information about all variables that are not ignored. If -i is used, even ignored variables are listed.

vars [-ahlo] protected by lock

Lists only those variables that are protected by the specified lock. This subcommand may be run only after the analyze subcommand has been run.

vars [-ahlo] [directly] read by func ...

Lists only those variables that may be read as a result of calling the specified functions. See notes below on directly.

vars [-ahlo] [directly] written by func ...

Lists only those variables that may be written as a result of calling the specified functions. See notes below on directly.

vars [-ahlo] [directly] accessed by func ...

Lists only those variables that may be accessed (read or written) as a result of calling the specified functions.

About directly

Those variants that list the variables accessed by a list of functions can be told to list only those variables that are directly accessed by the specified functions. Otherwise the variables accessed by those functions, the functions they call, the functions those functions call, and so on, are listed.