User`s guide
40
Chapter 5: Examining and Changing Data
Under dbx, however, you need to be able to distinguish between different
variables that may have the same name. To do so, you can qualify a reference
to a variable to specify its scope.
dbx qualifies variables with the file (also called module), the procedure, a
block, or a structure. You can manually specify the full scope of a variable by
separating scopes with periods. For example, in the expression:
mrx.main.i
i is the variable name, main is a procedure in which it appears, and mrx is the
source file (omitting the file extension) in which the procedure is defined.
To illustrate, consider a C program called test that contains a function
compare. In this example, the variable i is declared in both the main
procedure and the compare function:
int compare ( int );
main( argc, argv )
int argc;
char **argv;
{
int i;
...
}
int compare ( arg1, arg2 )
{
int i;
...
}
To trace the value of the i that appears in the function compare, enter:
(dbx) trace test.compare.i
To print the value of the i that appears in the procedure main, enter:
(dbx) print test.main.i
A leading dot (a period at the beginning of the identifier) tells dbx that the
first qualifier is not a module (file).