Contents|Index|Previous|Next
Examining the symbol table

The commands described in this section allow you to inquire about the symbols (names of variables, functions and types) defined in your program. This information is inherent in the text of your program and does not change as your program executes. GDB finds it in your program’s symbol table, in the file indicated when you started GDB (see Choosing files), or by one of the file-management commands (see Commands to specify files).

Occasionally, you may need to refer to symbols that contain unusual characters, which GDB ordinarily treats as word delimiters. The most frequent case is in referring to static variables in other source files (see Program variables). File names are recorded in object files as debugging symbols, but GDB would ordinarily parse a typical file name, like ‘foo.c’, as three words, ‘foo’ and ‘.’ and ‘c’. To allow GDB to recognize ‘foo.c’ as a single symbol, enclose it in single quotes; for example, p foo.c::x looks up the value of x in the scope of the foo.c file.
 


Top|Contents|Index|Previous|Next