Next: , Previous: , Up: Program Structure   [Contents][Index]


2.2 Paths and Names of the Source Files

Before any other stabs occur, there must be a stab specifying the source file. This information is contained in a symbol of stab type N_SO; the string field contains the name of the file. The value of the symbol is the start address of the portion of the text section corresponding to that file.

Some compilers use the desc field to indicate the language of the source file. Sun’s compilers started this usage, and the first constants are derived from their documentation. Languages added by gcc/gdb start at 0x32 to avoid conflict with languages Sun may add in the future. A desc field with a value 0 indicates that no language has been specified via this mechanism.

N_SO_AS (0x1)

Assembly language

N_SO_C (0x2)

K&R traditional C

N_SO_ANSI_C (0x3)

ANSI C

N_SO_CC (0x4)

C++

N_SO_FORTRAN (0x5)

Fortran

N_SO_PASCAL (0x6)

Pascal

N_SO_FORTRAN90 (0x7)

Fortran90

N_SO_OBJC (0x32)

Objective-C

N_SO_OBJCPLUS (0x33)

Objective-C++

Some compilers (for example, GCC2 and SunOS4 /bin/cc) also include the directory in which the source was compiled, in a second N_SO symbol preceding the one containing the file name. This symbol can be distinguished by the fact that it ends in a slash. Code from the cfront C++ compiler can have additional N_SO symbols for nonexistent source files after the N_SO for the real source file; these are believed to contain no useful information.

For example:

.stabs "/cygint/s1/users/jcm/play/",100,0,0,Ltext0     # 100 is N_SO
.stabs "hello.c",100,0,0,Ltext0
        .text
Ltext0:

Instead of N_SO symbols, XCOFF uses a .file assembler directive which assembles to a C_FILE symbol; explaining this in detail is outside the scope of this document.

If it is useful to indicate the end of a source file, this is done with an N_SO symbol with an empty string for the name. The value is the address of the end of the text section for the file. For some systems, there is no indication of the end of a source file, and you just need to figure it ended when you see an N_SO for a different source file, or a symbol ending in .o (which at least some linkers insert to mark the start of a new .o file).


Next: , Previous: , Up: Program Structure   [Contents][Index]