Next: , Previous: , Up: Transformations On Symbol Tables   [Contents][Index]


7.2.2 Transformations on Global Variables

Stabs for global variables do not contain location information. In this case, the debugger finds location information in the assembler or linker symbol table entry describing the variable. The source line:

char g_foo = 'c';

generates the stab:

.stabs "g_foo:G2",32,0,0,0

The variable is represented by two symbol table entries in the object file (see below). The first one originated as a stab. The second one is an external symbol. The upper case ‘D’ signifies that the n_type field of the symbol table contains 7, N_DATA with local linkage. The stab’s value is zero since the value is not used for N_GSYM stabs. The value of the linker symbol is the relocatable address corresponding to the variable.

00000000 - 00 0000  GSYM g_foo:G2
00000080 D _g_foo

These entries as transformed by the linker. The linker symbol table entry now holds an absolute address:

00000000 - 00 0000  GSYM g_foo:G2
…
0000e008 D _g_foo