| |||
| Home > Working with the CLI > Constructing expressions > Program symbols | |||
Program symbols are identifiers associated with a source program. They include variables, function names, and, depending on the compiler, macro names. Symbols defined in the source of the application can normally be passed to the debugger. When a program is loaded for debugging, program symbols are normally loaded into a symbol table associated with the target connection.
Some compilers insert a leading underscore _ to all program source symbols so that program symbol names are distinguished from other names. The debugger strips the first leading underscore from such program symbols when an application file is read so references to program symbols are as originally written.
Some compilers pass C and C++ preprocessor macros to the debugger. These are also usable in expressions. The debugger shows the expansion in the output.
You can list all symbols currently defined in RealView Debugger. To do this, enter:
printsymbols /w *
For more details on using this command, see PRINTSYMBOLS on PRINTSYMBOLS.
References to symbols or source-level line numbers can be unqualified or qualified. An unqualified reference includes only the symbol or line number itself. A qualified reference includes the symbol or line number preceded by a root (defined in the following section), module and/or function name. Root, module, and function names are separated from the symbol or line number by a backslash \. Module names must be in uppercase. Table 1.2 summarizes examples of qualified symbols.
Table 1.2. Qualified symbol references
| Form | Example | Comment |
|---|---|---|
| @tst\\TS1ROOT | References module TS1ROOT in
root @tst. (Usually from file loaded as tst.x or tst.out.) |
\ ::global | \x ::x | References global variable x in
current root. |
| main\x | References local variable x in
function main. |
| SIEVE\main | References function main in
module sieve. |
| SIEVE\y | References static variable y in
module sieve. |
| ENTRY\#18 | References line number 18 in module entry. |
| ENTRY\main\x | References local variable x in function main in module entry. |
| #20\x | References local variable x in an unnamed block at line 20. |