Symbols
This section discusses how the CLI handles symbols and other names corresponding to various entities within your program or within TotalView.
Namespaces
CLI interactive commands exist within the primary Tcl namespace (::). Many TotalView state variables also reside in this namespace. However, the CLI and TotalView place functions and variables that are not ordinarily accessed in interactive sessions in other namespaces. These namespaces are:
TV::
Contains commands and variables that are most often used in scripts; that is, they are seldom used in an interactive debugging session.
TV::GUI::
Contains state variables that define and describe properties of the user interface such as window placement, color, and the like.
If you discover other namespaces beginning with TV, you have found a place containing internal functions and variables. These objects can (and will) change and disappear. So, don't use them. Also, do not create namespaces that begin with TV as you could cause problems by interfering with built-in functions and variables.
The CLI's dset command lets you set the value of these variables. You can ask the CLI to display a list of these variables by specifying the namespace. For example:
dset TV::
Symbol Names and Scope
Many commands refer to one or more program objects by using symbol names as arguments. In addition, some commands take expressions as arguments, where the expression can contain symbol names representing program variables.
Note: Because the CLI is built on top of TotalView, the way in which the CLI interprets symbols is the way that TotalView interprets them.
TotalView learns about a program's symbols and their relationships by reading the debugging information that was generated when the program was compiled. This information includes a mapping from symbol names to descriptions of objects, providing information about a symbol's use (for example, a function), where it is located in memory after the executable is loaded, and associated features (for example, number and data types of a function's arguments). While TotalView smooths over many differences, the information provided by compiler manufacturers is not uniform, and differences exist between the kinds of information provided by Fortran, C, and C++ compilers.
In all cases, scope is central to the way TotalView interprets and accesses symbols. (A scope defines what part or how much of a program knows about about a symbol. For example, a variable that is defined with a subroutine is scoped to all statements within the subroutine. It is not scoped outside of the subroutine.) A program consists of one or more scopes that are established by the program's structure. Typically, some scopes are nested within others. Every statement in a program is associated with a particular scope, and indirectly with the other scopes containing that scope.
Whenever a CLI command contains a symbol name, TotalView consults the program's symbol table to discover what object it refers to--this process is known as symbol lookup. As programming languages do not require that a symbol names be unique, determining which symbol it should use can be complicated. A symbol lookup is performed with respect to a particular context, expressed in terms of a single thread of execution. Each context uniquely identifies the scope to which a symbol name refers.