Next: Overview of Stab Format, Up: Overview of Stabs [Contents][Index]

### 1.1 Overview of Debugging Information Flow

The GNU C compiler compiles C source in a `.c` file into assembly language in a `.s` file, which the assembler translates into a `.o` file, which the linker combines with other `.o` files and libraries to produce an executable file.

With the ‘`-g`’ option, GCC puts in the `.s` file additional debugging information, which is slightly transformed by the assembler and linker, and carried through into the final executable. This debugging information describes features of the source file like line numbers, the types and scopes of variables, and function names, parameters, and scopes.

For some object file formats, the debugging information is encapsulated in assembler directives known collectively as stab (symbol table) directives, which are interspersed with the generated code. Stabs are the native format for debugging information in the a.out and XCOFF object file formats. The GNU tools can also emit stabs in the COFF and ECOFF object file formats.

The assembler adds the information from stabs to the symbol information it places by default in the symbol table and the string table of the `.o` file it is building. The linker consolidates the `.o` files into one executable file, with one symbol table and one string table. Debuggers use the symbol and string tables in the executable as a source of debugging information about the program.