1 This is stabs.info, produced by makeinfo version 4.8 from
2 ../.././gdb/doc/stabs.texinfo.
4 INFO-DIR-SECTION Software development
6 * Stabs: (stabs). The "stabs" debugging information format.
9 This document describes the stabs debugging symbol tables.
11 Copyright (C) 1992,1993,1994,1995,1997,1998,2000,2001 Free
12 Software Foundation, Inc. Contributed by Cygnus Support. Written by
13 Julia Menapace, Jim Kingdon, and David MacKenzie.
15 Permission is granted to copy, distribute and/or modify this document
16 under the terms of the GNU Free Documentation License, Version 1.1 or
17 any later version published by the Free Software Foundation; with no
18 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
19 Texts. A copy of the license is included in the section entitled "GNU
20 Free Documentation License".
23 File: stabs.info, Node: Top, Next: Overview, Up: (dir)
25 The "stabs" representation of debugging information
26 ***************************************************
28 This document describes the stabs debugging format.
32 * Overview:: Overview of stabs
33 * Program Structure:: Encoding of the structure of the program
34 * Constants:: Constants
36 * Types:: Type definitions
37 * Symbol Tables:: Symbol information in symbol tables
38 * Cplusplus:: Stabs specific to C++
39 * Stab Types:: Symbol types in a.out files
40 * Symbol Descriptors:: Table of symbol descriptors
41 * Type Descriptors:: Table of type descriptors
42 * Expanded Reference:: Reference information by stab type
43 * Questions:: Questions and anomalies
44 * Stab Sections:: In some object file formats, stabs are
46 * Symbol Types Index:: Index of symbolic stab symbol type names.
47 * GNU Free Documentation License:: The license for this documentation
50 File: stabs.info, Node: Overview, Next: Program Structure, Prev: Top, Up: Top
55 "Stabs" refers to a format for information that describes a program to
56 a debugger. This format was apparently invented by Peter Kessler at
57 the University of California at Berkeley, for the `pdx' Pascal
58 debugger; the format has spread widely since then.
60 This document is one of the few published sources of documentation on
61 stabs. It is believed to be comprehensive for stabs used by C. The
62 lists of symbol descriptors (*note Symbol Descriptors::) and type
63 descriptors (*note Type Descriptors::) are believed to be completely
64 comprehensive. Stabs for COBOL-specific features and for variant
65 records (used by Pascal and Modula-2) are poorly documented here.
67 Other sources of information on stabs are `Dbx and Dbxtool
68 Interfaces', 2nd edition, by Sun, 1988, and `AIX Version 3.2 Files
69 Reference', Fourth Edition, September 1992, "dbx Stabstring Grammar" in
70 the a.out section, page 2-31. This document is believed to incorporate
71 the information from those two sources except where it explicitly
72 directs you to them for more information.
76 * Flow:: Overview of debugging information flow
77 * Stabs Format:: Overview of stab format
78 * String Field:: The string field
79 * C Example:: A simple example in C source
80 * Assembly Code:: The simple example at the assembly level
83 File: stabs.info, Node: Flow, Next: Stabs Format, Up: Overview
85 1.1 Overview of Debugging Information Flow
86 ==========================================
88 The GNU C compiler compiles C source in a `.c' file into assembly
89 language in a `.s' file, which the assembler translates into a `.o'
90 file, which the linker combines with other `.o' files and libraries to
91 produce an executable file.
93 With the `-g' option, GCC puts in the `.s' file additional debugging
94 information, which is slightly transformed by the assembler and linker,
95 and carried through into the final executable. This debugging
96 information describes features of the source file like line numbers,
97 the types and scopes of variables, and function names, parameters, and
100 For some object file formats, the debugging information is
101 encapsulated in assembler directives known collectively as "stab"
102 (symbol table) directives, which are interspersed with the generated
103 code. Stabs are the native format for debugging information in the
104 a.out and XCOFF object file formats. The GNU tools can also emit stabs
105 in the COFF and ECOFF object file formats.
107 The assembler adds the information from stabs to the symbol
108 information it places by default in the symbol table and the string
109 table of the `.o' file it is building. The linker consolidates the `.o'
110 files into one executable file, with one symbol table and one string
111 table. Debuggers use the symbol and string tables in the executable as
112 a source of debugging information about the program.
115 File: stabs.info, Node: Stabs Format, Next: String Field, Prev: Flow, Up: Overview
117 1.2 Overview of Stab Format
118 ===========================
120 There are three overall formats for stab assembler directives,
121 differentiated by the first word of the stab. The name of the directive
122 describes which combination of four possible data fields follows. It is
123 either `.stabs' (string), `.stabn' (number), or `.stabd' (dot). IBM's
124 XCOFF assembler uses `.stabx' (and some other directives such as
125 `.file' and `.bi') instead of `.stabs', `.stabn' or `.stabd'.
127 The overall format of each class of stab is:
129 .stabs "STRING",TYPE,OTHER,DESC,VALUE
130 .stabn TYPE,OTHER,DESC,VALUE
131 .stabd TYPE,OTHER,DESC
132 .stabx "STRING",VALUE,TYPE,SDB-TYPE
134 For `.stabn' and `.stabd', there is no STRING (the `n_strx' field is
135 zero; see *Note Symbol Tables::). For `.stabd', the VALUE field is
136 implicit and has the value of the current file location. For `.stabx',
137 the SDB-TYPE field is unused for stabs and can always be set to zero.
138 The OTHER field is almost always unused and can be set to zero.
140 The number in the TYPE field gives some basic information about
141 which type of stab this is (or whether it _is_ a stab, as opposed to an
142 ordinary symbol). Each valid type number defines a different stab
143 type; further, the stab type defines the exact interpretation of, and
144 possible values for, any remaining STRING, DESC, or VALUE fields
145 present in the stab. *Note Stab Types::, for a list in numeric order
146 of the valid TYPE field values for stab directives.
149 File: stabs.info, Node: String Field, Next: C Example, Prev: Stabs Format, Up: Overview
154 For most stabs the string field holds the meat of the debugging
155 information. The flexible nature of this field is what makes stabs
156 extensible. For some stab types the string field contains only a name.
157 For other stab types the contents can be a great deal more complex.
159 The overall format of the string field for most stab types is:
161 "NAME:SYMBOL-DESCRIPTOR TYPE-INFORMATION"
163 NAME is the name of the symbol represented by the stab; it can
164 contain a pair of colons (*note Nested Symbols::). NAME can be
165 omitted, which means the stab represents an unnamed object. For
166 example, `:t10=*2' defines type 10 as a pointer to type 2, but does not
167 give the type a name. Omitting the NAME field is supported by AIX dbx
168 and GDB after about version 4.8, but not other debuggers. GCC
169 sometimes uses a single space as the name instead of omitting the name
170 altogether; apparently that is supported by most debuggers.
172 The SYMBOL-DESCRIPTOR following the `:' is an alphabetic character
173 that tells more specifically what kind of symbol the stab represents.
174 If the SYMBOL-DESCRIPTOR is omitted, but type information follows, then
175 the stab represents a local variable. For a list of symbol
176 descriptors, see *Note Symbol Descriptors::. The `c' symbol descriptor
177 is an exception in that it is not followed by type information. *Note
180 TYPE-INFORMATION is either a TYPE-NUMBER, or `TYPE-NUMBER='. A
181 TYPE-NUMBER alone is a type reference, referring directly to a type
182 that has already been defined.
184 The `TYPE-NUMBER=' form is a type definition, where the number
185 represents a new type which is about to be defined. The type
186 definition may refer to other types by number, and those type numbers
187 may be followed by `=' and nested definitions. Also, the Lucid
188 compiler will repeat `TYPE-NUMBER=' more than once if it wants to
189 define several type numbers at once.
191 In a type definition, if the character that follows the equals sign
192 is non-numeric then it is a TYPE-DESCRIPTOR, and tells what kind of
193 type is about to be defined. Any other values following the
194 TYPE-DESCRIPTOR vary, depending on the TYPE-DESCRIPTOR. *Note Type
195 Descriptors::, for a list of TYPE-DESCRIPTOR values. If a number
196 follows the `=' then the number is a TYPE-REFERENCE. For a full
197 description of types, *Note Types::.
199 A TYPE-NUMBER is often a single number. The GNU and Sun tools
200 additionally permit a TYPE-NUMBER to be a pair
201 (FILE-NUMBER,FILETYPE-NUMBER) (the parentheses appear in the string,
202 and serve to distinguish the two cases). The FILE-NUMBER is 0 for the
203 base source file, 1 for the first included file, 2 for the next, and so
204 on. The FILETYPE-NUMBER is a number starting with 1 which is
205 incremented for each new type defined in the file. (Separating the
206 file number and the type number permits the `N_BINCL' optimization to
207 succeed more often; see *Note Include Files::).
209 There is an AIX extension for type attributes. Following the `='
210 are any number of type attributes. Each one starts with `@' and ends
211 with `;'. Debuggers, including AIX's dbx and GDB 4.10, skip any type
212 attributes they do not recognize. GDB 4.9 and other versions of dbx
213 may not do this. Because of a conflict with C++ (*note Cplusplus::),
214 new attributes should not be defined which begin with a digit, `(', or
215 `-'; GDB may be unable to distinguish those from the C++ type
216 descriptor `@'. The attributes are:
219 BOUNDARY is an integer specifying the alignment. I assume it
220 applies to all variables of this type.
223 Pointer class (for checking). Not sure what this means, or how
224 INTEGER is interpreted.
227 Indicate this is a packed type, meaning that structure fields or
228 array elements are placed more closely in memory, to save memory
229 at the expense of speed.
232 Size in bits of a variable of this type. This is fully supported
233 by GDB 4.11 and later.
236 Indicate that this type is a string instead of an array of
237 characters, or a bitstring instead of a set. It doesn't change
238 the layout of the data being represented, but does enable the
239 debugger to know which type it is.
242 Indicate that this type is a vector instead of an array. The only
243 major difference between vectors and arrays is that vectors are
244 passed by value instead of by reference (vector coprocessor
248 All of this can make the string field quite long. All versions of
249 GDB, and some versions of dbx, can handle arbitrarily long strings.
250 But many versions of dbx (or assemblers or linkers, I'm not sure which)
251 cretinously limit the strings to about 80 characters, so compilers which
252 must work with such systems need to split the `.stabs' directive into
253 several `.stabs' directives. Each stab duplicates every field except
254 the string field. The string field of every stab except the last is
255 marked as continued with a backslash at the end (in the assembly code
256 this may be written as a double backslash, depending on the assembler).
257 Removing the backslashes and concatenating the string fields of each
258 stab produces the original, long string. Just to be incompatible (or so
259 they don't have to worry about what the assembler does with
260 backslashes), AIX can use `?' instead of backslash.
263 File: stabs.info, Node: C Example, Next: Assembly Code, Prev: String Field, Up: Overview
265 1.4 A Simple Example in C Source
266 ================================
268 To get the flavor of how stabs describe source information for a C
269 program, let's look at the simple program:
273 printf("Hello world");
276 When compiled with `-g', the program above yields the following `.s'
277 file. Line numbers have been added to make it easier to refer to parts
278 of the `.s' file in the description of the stabs that follows.
281 File: stabs.info, Node: Assembly Code, Prev: C Example, Up: Overview
283 1.5 The Simple Example at the Assembly Level
284 ============================================
286 This simple "hello world" example demonstrates several of the stab
287 types used to describe C language source files.
290 2 .stabs "/cygint/s1/users/jcm/play/",100,0,0,Ltext0
291 3 .stabs "hello.c",100,0,0,Ltext0
294 6 .stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0
295 7 .stabs "char:t2=r2;0;127;",128,0,0,0
296 8 .stabs "long int:t3=r1;-2147483648;2147483647;",128,0,0,0
297 9 .stabs "unsigned int:t4=r1;0;-1;",128,0,0,0
298 10 .stabs "long unsigned int:t5=r1;0;-1;",128,0,0,0
299 11 .stabs "short int:t6=r1;-32768;32767;",128,0,0,0
300 12 .stabs "long long int:t7=r1;0;-1;",128,0,0,0
301 13 .stabs "short unsigned int:t8=r1;0;65535;",128,0,0,0
302 14 .stabs "long long unsigned int:t9=r1;0;-1;",128,0,0,0
303 15 .stabs "signed char:t10=r1;-128;127;",128,0,0,0
304 16 .stabs "unsigned char:t11=r1;0;255;",128,0,0,0
305 17 .stabs "float:t12=r1;4;0;",128,0,0,0
306 18 .stabs "double:t13=r1;8;0;",128,0,0,0
307 19 .stabs "long double:t14=r1;8;0;",128,0,0,0
308 20 .stabs "void:t15=15",128,0,0,0
311 23 .ascii "Hello, world!\12\0"
326 38 sethi %hi(LC0),%o1
327 39 or %o1,%lo(LC0),%o0
338 50 .stabs "main:F1",36,0,0,_main
339 51 .stabn 192,0,0,LBB2
340 52 .stabn 224,0,0,LBE2
343 File: stabs.info, Node: Program Structure, Next: Constants, Prev: Overview, Up: Top
345 2 Encoding the Structure of the Program
346 ***************************************
348 The elements of the program structure that stabs encode include the name
349 of the main function, the names of the source and include files, the
350 line numbers, procedure names and types, and the beginnings and ends of
355 * Main Program:: Indicate what the main program is
356 * Source Files:: The path and name of the source file
357 * Include Files:: Names of include files
360 * Nested Procedures::
362 * Alternate Entry Points:: Entering procedures except at the beginning.
365 File: stabs.info, Node: Main Program, Next: Source Files, Up: Program Structure
370 Most languages allow the main program to have any name. The `N_MAIN'
371 stab type tells the debugger the name that is used in this program.
372 Only the string field is significant; it is the name of a function
373 which is the main program. Most C compilers do not use this stab (they
374 expect the debugger to assume that the name is `main'), but some C
375 compilers emit an `N_MAIN' stab for the `main' function. I'm not sure
376 how XCOFF handles this.
379 File: stabs.info, Node: Source Files, Next: Include Files, Prev: Main Program, Up: Program Structure
381 2.2 Paths and Names of the Source Files
382 =======================================
384 Before any other stabs occur, there must be a stab specifying the source
385 file. This information is contained in a symbol of stab type `N_SO';
386 the string field contains the name of the file. The value of the
387 symbol is the start address of the portion of the text section
388 corresponding to that file.
390 Some compilers use the desc field to indicate the language of the
391 source file. Sun's compilers started this usage, and the first
392 constants are derived from their documentation. Languages added by
393 gcc/gdb start at 0x32 to avoid conflict with languages Sun may add in
394 the future. A desc field with a value 0 indicates that no language has
395 been specified via this mechanism.
415 `N_SO_FORTRAN90' (0x7)
421 `N_SO_OBJCPLUS' (0x33)
424 Some compilers (for example, GCC2 and SunOS4 `/bin/cc') also include
425 the directory in which the source was compiled, in a second `N_SO'
426 symbol preceding the one containing the file name. This symbol can be
427 distinguished by the fact that it ends in a slash. Code from the
428 `cfront' C++ compiler can have additional `N_SO' symbols for
429 nonexistent source files after the `N_SO' for the real source file;
430 these are believed to contain no useful information.
434 .stabs "/cygint/s1/users/jcm/play/",100,0,0,Ltext0 # 100 is N_SO
435 .stabs "hello.c",100,0,0,Ltext0
439 Instead of `N_SO' symbols, XCOFF uses a `.file' assembler directive
440 which assembles to a `C_FILE' symbol; explaining this in detail is
441 outside the scope of this document.
443 If it is useful to indicate the end of a source file, this is done
444 with an `N_SO' symbol with an empty string for the name. The value is
445 the address of the end of the text section for the file. For some
446 systems, there is no indication of the end of a source file, and you
447 just need to figure it ended when you see an `N_SO' for a different
448 source file, or a symbol ending in `.o' (which at least some linkers
449 insert to mark the start of a new `.o' file).
452 File: stabs.info, Node: Include Files, Next: Line Numbers, Prev: Source Files, Up: Program Structure
454 2.3 Names of Include Files
455 ==========================
457 There are several schemes for dealing with include files: the
458 traditional `N_SOL' approach, Sun's `N_BINCL' approach, and the XCOFF
459 `C_BINCL' approach (which despite the similar name has little in common
462 An `N_SOL' symbol specifies which include file subsequent symbols
463 refer to. The string field is the name of the file and the value is the
464 text address corresponding to the end of the previous include file and
465 the start of this one. To specify the main source file again, use an
466 `N_SOL' symbol with the name of the main source file.
468 The `N_BINCL' approach works as follows. An `N_BINCL' symbol
469 specifies the start of an include file. In an object file, only the
470 string is significant; the linker puts data into some of the other
471 fields. The end of the include file is marked by an `N_EINCL' symbol
472 (which has no string field). In an object file, there is no
473 significant data in the `N_EINCL' symbol. `N_BINCL' and `N_EINCL' can
476 If the linker detects that two source files have identical stabs
477 between an `N_BINCL' and `N_EINCL' pair (as will generally be the case
478 for a header file), then it only puts out the stabs once. Each
479 additional occurrence is replaced by an `N_EXCL' symbol. I believe the
480 GNU linker and the Sun (both SunOS4 and Solaris) linker are the only
481 ones which supports this feature.
483 A linker which supports this feature will set the value of a
484 `N_BINCL' symbol to the total of all the characters in the stabs
485 strings included in the header file, omitting any file numbers. The
486 value of an `N_EXCL' symbol is the same as the value of the `N_BINCL'
487 symbol it replaces. This information can be used to match up `N_EXCL'
488 and `N_BINCL' symbols which have the same filename. The `N_EINCL'
489 value, and the values of the other and description fields for all
490 three, appear to always be zero.
492 For the start of an include file in XCOFF, use the `.bi' assembler
493 directive, which generates a `C_BINCL' symbol. A `.ei' directive,
494 which generates a `C_EINCL' symbol, denotes the end of the include
495 file. Both directives are followed by the name of the source file in
496 quotes, which becomes the string for the symbol. The value of each
497 symbol, produced automatically by the assembler and linker, is the
498 offset into the executable of the beginning (inclusive, as you'd
499 expect) or end (inclusive, as you would not expect) of the portion of
500 the COFF line table that corresponds to this include file. `C_BINCL'
501 and `C_EINCL' do not nest.
504 File: stabs.info, Node: Line Numbers, Next: Procedures, Prev: Include Files, Up: Program Structure
509 An `N_SLINE' symbol represents the start of a source line. The desc
510 field contains the line number and the value contains the code address
511 for the start of that source line. On most machines the address is
512 absolute; for stabs in sections (*note Stab Sections::), it is relative
513 to the function in which the `N_SLINE' symbol occurs.
515 GNU documents `N_DSLINE' and `N_BSLINE' symbols for line numbers in
516 the data or bss segments, respectively. They are identical to
517 `N_SLINE' but are relocated differently by the linker. They were
518 intended to be used to describe the source location of a variable
519 declaration, but I believe that GCC2 actually puts the line number in
520 the desc field of the stab for the variable itself. GDB has been
521 ignoring these symbols (unless they contain a string field) since at
524 For single source lines that generate discontiguous code, such as
525 flow of control statements, there may be more than one line number
526 entry for the same source line. In this case there is a line number
527 entry at the start of each code range, each with the same line number.
529 XCOFF does not use stabs for line numbers. Instead, it uses COFF
530 line numbers (which are outside the scope of this document). Standard
531 COFF line numbers cannot deal with include files, but in XCOFF this is
532 fixed with the `C_BINCL' method of marking include files (*note Include
536 File: stabs.info, Node: Procedures, Next: Nested Procedures, Prev: Line Numbers, Up: Program Structure
541 All of the following stabs normally use the `N_FUN' symbol type.
542 However, Sun's `acc' compiler on SunOS4 uses `N_GSYM' and `N_STSYM',
543 which means that the value of the stab for the function is useless and
544 the debugger must get the address of the function from the non-stab
545 symbols instead. On systems where non-stab symbols have leading
546 underscores, the stabs will lack underscores and the debugger needs to
547 know about the leading underscore to match up the stab and the non-stab
548 symbol. BSD Fortran is said to use `N_FNAME' with the same
549 restriction; the value of the symbol is not useful (I'm not sure it
550 really does use this, because GDB doesn't handle this and no one has
553 A function is represented by an `F' symbol descriptor for a global
554 (extern) function, and `f' for a static (local) function. For a.out,
555 the value of the symbol is the address of the start of the function; it
556 is already relocated. For stabs in ELF, the SunPRO compiler version
557 2.0.1 and GCC put out an address which gets relocated by the linker.
558 In a future release SunPRO is planning to put out zero, in which case
559 the address can be found from the ELF (non-stab) symbol. Because
560 looking things up in the ELF symbols would probably be slow, I'm not
561 sure how to find which symbol of that name is the right one, and this
562 doesn't provide any way to deal with nested functions, it would
563 probably be better to make the value of the stab an address relative to
564 the start of the file, or just absolute. See *Note ELF Linker
565 Relocation:: for more information on linker relocation of stabs in ELF
566 files. For XCOFF, the stab uses the `C_FUN' storage class and the
567 value of the stab is meaningless; the address of the function can be
568 found from the csect symbol (XTY_LD/XMC_PR).
570 The type information of the stab represents the return type of the
571 function; thus `foo:f5' means that foo is a function returning type 5.
572 There is no need to try to get the line number of the start of the
573 function from the stab for the function; it is in the next `N_SLINE'
576 Some compilers (such as Sun's Solaris compiler) support an extension
577 for specifying the types of the arguments. I suspect this extension is
578 not used for old (non-prototyped) function definitions in C. If the
579 extension is in use, the type information of the stab for the function
580 is followed by type information for each argument, with each argument
581 preceded by `;'. An argument type of 0 means that additional arguments
582 are being passed, whose types and number may vary (`...' in ANSI C).
583 GDB has tolerated this extension (parsed the syntax, if not necessarily
584 used the information) since at least version 4.8; I don't know whether
585 all versions of dbx tolerate it. The argument types given here are not
586 redundant with the symbols for the formal parameters (*note
587 Parameters::); they are the types of the arguments as they are passed,
588 before any conversions might take place. For example, if a C function
589 which is declared without a prototype takes a `float' argument, the
590 value is passed as a `double' but then converted to a `float'.
591 Debuggers need to use the types given in the arguments when printing
592 values, but when calling the function they need to use the types given
593 in the symbol defining the function.
595 If the return type and types of arguments of a function which is
596 defined in another source file are specified (i.e., a function
597 prototype in ANSI C), traditionally compilers emit no stab; the only
598 way for the debugger to find the information is if the source file
599 where the function is defined was also compiled with debugging symbols.
600 As an extension the Solaris compiler uses symbol descriptor `P'
601 followed by the return type of the function, followed by the arguments,
602 each preceded by `;', as in a stab with symbol descriptor `f' or `F'.
603 This use of symbol descriptor `P' can be distinguished from its use for
604 register parameters (*note Register Parameters::) by the fact that it
605 has symbol type `N_FUN'.
607 The AIX documentation also defines symbol descriptor `J' as an
608 internal function. I assume this means a function nested within another
609 function. It also says symbol descriptor `m' is a module in Modula-2
612 Procedures (functions which do not return values) are represented as
613 functions returning the `void' type in C. I don't see why this couldn't
614 be used for all languages (inventing a `void' type for this purpose if
615 necessary), but the AIX documentation defines `I', `P', and `Q' for
616 internal, global, and static procedures, respectively. These symbol
617 descriptors are unusual in that they are not followed by type
620 The following example shows a stab for a function `main' which
621 returns type number `1'. The `_main' specified for the value is a
622 reference to an assembler label which is used to fill in the start
623 address of the function.
625 .stabs "main:F1",36,0,0,_main # 36 is N_FUN
627 The stab representing a procedure is located immediately following
628 the code of the procedure. This stab is in turn directly followed by a
629 group of other stabs describing elements of the procedure. These other
630 stabs describe the procedure's parameters, its block local variables,
631 and its block structure.
633 If functions can appear in different sections, then the debugger may
634 not be able to find the end of a function. Recent versions of GCC will
635 mark the end of a function with an `N_FUN' symbol with an empty string
636 for the name. The value is the address of the end of the current
637 function. Without such a symbol, there is no indication of the address
638 of the end of a function, and you must assume that it ended at the
639 starting address of the next function or at the end of the text section
643 File: stabs.info, Node: Nested Procedures, Next: Block Structure, Prev: Procedures, Up: Program Structure
645 2.6 Nested Procedures
646 =====================
648 For any of the symbol descriptors representing procedures, after the
649 symbol descriptor and the type information is optionally a scope
650 specifier. This consists of a comma, the name of the procedure, another
651 comma, and the name of the enclosing procedure. The first name is local
652 to the scope specified, and seems to be redundant with the name of the
653 symbol (before the `:'). This feature is used by GCC, and presumably
654 Pascal, Modula-2, etc., compilers, for nested functions.
656 If procedures are nested more than one level deep, only the
657 immediately containing scope is specified. For example, this code:
668 return baz (x + 2 * y);
670 return x + bar (3 * x);
675 .stabs "baz:f1,baz,bar",36,0,0,_baz.15 # 36 is N_FUN
676 .stabs "bar:f1,bar,foo",36,0,0,_bar.12
677 .stabs "foo:F1",36,0,0,_foo
680 File: stabs.info, Node: Block Structure, Next: Alternate Entry Points, Prev: Nested Procedures, Up: Program Structure
685 The program's block structure is represented by the `N_LBRAC' (left
686 brace) and the `N_RBRAC' (right brace) stab types. The variables
687 defined inside a block precede the `N_LBRAC' symbol for most compilers,
688 including GCC. Other compilers, such as the Convex, Acorn RISC
689 machine, and Sun `acc' compilers, put the variables after the `N_LBRAC'
690 symbol. The values of the `N_LBRAC' and `N_RBRAC' symbols are the
691 start and end addresses of the code of the block, respectively. For
692 most machines, they are relative to the starting address of this source
693 file. For the Gould NP1, they are absolute. For stabs in sections
694 (*note Stab Sections::), they are relative to the function in which
697 The `N_LBRAC' and `N_RBRAC' stabs that describe the block scope of a
698 procedure are located after the `N_FUN' stab that represents the
701 Sun documents the desc field of `N_LBRAC' and `N_RBRAC' symbols as
702 containing the nesting level of the block. However, dbx seems to not
703 care, and GCC always sets desc to zero.
705 For XCOFF, block scope is indicated with `C_BLOCK' symbols. If the
706 name of the symbol is `.bb', then it is the beginning of the block; if
707 the name of the symbol is `.be'; it is the end of the block.
710 File: stabs.info, Node: Alternate Entry Points, Prev: Block Structure, Up: Program Structure
712 2.8 Alternate Entry Points
713 ==========================
715 Some languages, like Fortran, have the ability to enter procedures at
716 some place other than the beginning. One can declare an alternate entry
717 point. The `N_ENTRY' stab is for this; however, the Sun FORTRAN
718 compiler doesn't use it. According to AIX documentation, only the name
719 of a `C_ENTRY' stab is significant; the address of the alternate entry
720 point comes from the corresponding external symbol. A previous
721 revision of this document said that the value of an `N_ENTRY' stab was
722 the address of the alternate entry point, but I don't know the source
723 for that information.
726 File: stabs.info, Node: Constants, Next: Variables, Prev: Program Structure, Up: Top
731 The `c' symbol descriptor indicates that this stab represents a
732 constant. This symbol descriptor is an exception to the general rule
733 that symbol descriptors are followed by type information. Instead, it
734 is followed by `=' and one of the following:
737 Boolean constant. VALUE is a numeric value; I assume it is 0 for
741 Character constant. VALUE is the numeric value of the constant.
743 `e TYPE-INFORMATION , VALUE'
744 Constant whose value can be represented as integral.
745 TYPE-INFORMATION is the type of the constant, as it would appear
746 after a symbol descriptor (*note String Field::). VALUE is the
747 numeric value of the constant. GDB 4.9 does not actually get the
748 right value if VALUE does not fit in a host `int', but it does not
749 do anything violent, and future debuggers could be extended to
750 accept integers of any size (whether unsigned or not). This
751 constant type is usually documented as being only for enumeration
752 constants, but GDB has never imposed that restriction; I don't
753 know about other debuggers.
756 Integer constant. VALUE is the numeric value. The type is some
757 sort of generic integer type (for GDB, a host `int'); to specify
758 the type explicitly, use `e' instead.
761 Real constant. VALUE is the real value, which can be `INF'
762 (optionally preceded by a sign) for infinity, `QNAN' for a quiet
763 NaN (not-a-number), or `SNAN' for a signalling NaN. If it is a
764 normal number the format is that accepted by the C library function
768 String constant. STRING is a string enclosed in either `'' (in
769 which case `'' characters within the string are represented as
770 `\'' or `"' (in which case `"' characters within the string are
771 represented as `\"').
773 `S TYPE-INFORMATION , ELEMENTS , BITS , PATTERN'
774 Set constant. TYPE-INFORMATION is the type of the constant, as it
775 would appear after a symbol descriptor (*note String Field::).
776 ELEMENTS is the number of elements in the set (does this means how
777 many bits of PATTERN are actually used, which would be redundant
778 with the type, or perhaps the number of bits set in PATTERN? I
779 don't get it), BITS is the number of bits in the constant (meaning
780 it specifies the length of PATTERN, I think), and PATTERN is a
781 hexadecimal representation of the set. AIX documentation refers
782 to a limit of 32 bytes, but I see no reason why this limit should
783 exist. This form could probably be used for arbitrary constants,
784 not just sets; the only catch is that PATTERN should be understood
785 to be target, not host, byte order and format.
787 The boolean, character, string, and set constants are not supported
788 by GDB 4.9, but it ignores them. GDB 4.8 and earlier gave an error
789 message and refused to read symbols from the file containing the
792 The above information is followed by `;'.
795 File: stabs.info, Node: Variables, Next: Types, Prev: Constants, Up: Top
800 Different types of stabs describe the various ways that variables can be
801 allocated: on the stack, globally, in registers, in common blocks,
802 statically, or as arguments to a function.
806 * Stack Variables:: Variables allocated on the stack.
807 * Global Variables:: Variables used by more than one source file.
808 * Register Variables:: Variables in registers.
809 * Common Blocks:: Variables statically allocated together.
810 * Statics:: Variables local to one source file.
811 * Based Variables:: Fortran pointer based variables.
812 * Parameters:: Variables for arguments to functions.
815 File: stabs.info, Node: Stack Variables, Next: Global Variables, Up: Variables
817 4.1 Automatic Variables Allocated on the Stack
818 ==============================================
820 If a variable's scope is local to a function and its lifetime is only as
821 long as that function executes (C calls such variables "automatic"), it
822 can be allocated in a register (*note Register Variables::) or on the
825 Each variable allocated on the stack has a stab with the symbol
826 descriptor omitted. Since type information should begin with a digit,
827 `-', or `(', only those characters precluded from being used for symbol
828 descriptors. However, the Acorn RISC machine (ARM) is said to get this
829 wrong: it puts out a mere type definition here, without the preceding
830 `TYPE-NUMBER='. This is a bad idea; there is no guarantee that type
831 descriptors are distinct from symbol descriptors. Stabs for stack
832 variables use the `N_LSYM' stab type, or `C_LSYM' for XCOFF.
834 The value of the stab is the offset of the variable within the local
835 variables. On most machines this is an offset from the frame pointer
836 and is negative. The location of the stab specifies which block it is
837 defined in; see *Note Block Structure::.
839 For example, the following C code:
847 produces the following stabs:
849 .stabs "main:F1",36,0,0,_main # 36 is N_FUN
850 .stabs "x:1",128,0,0,-12 # 128 is N_LSYM
851 .stabn 192,0,0,LBB2 # 192 is N_LBRAC
852 .stabn 224,0,0,LBE2 # 224 is N_RBRAC
854 See *Note Procedures:: for more information on the `N_FUN' stab, and
855 *Note Block Structure:: for more information on the `N_LBRAC' and
859 File: stabs.info, Node: Global Variables, Next: Register Variables, Prev: Stack Variables, Up: Variables
864 A variable whose scope is not specific to just one source file is
865 represented by the `G' symbol descriptor. These stabs use the `N_GSYM'
866 stab type (C_GSYM for XCOFF). The type information for the stab (*note
867 String Field::) gives the type of the variable.
869 For example, the following source code:
873 yields the following assembly code:
875 .stabs "g_foo:G2",32,0,0,0 # 32 is N_GSYM
881 The address of the variable represented by the `N_GSYM' is not
882 contained in the `N_GSYM' stab. The debugger gets this information
883 from the external symbol for the global variable. In the example above,
884 the `.global _g_foo' and `_g_foo:' lines tell the assembler to produce
887 Some compilers, like GCC, output `N_GSYM' stabs only once, where the
888 variable is defined. Other compilers, like SunOS4 /bin/cc, output a
889 `N_GSYM' stab for each compilation unit which references the variable.
892 File: stabs.info, Node: Register Variables, Next: Common Blocks, Prev: Global Variables, Up: Variables
894 4.3 Register Variables
895 ======================
897 Register variables have their own stab type, `N_RSYM' (`C_RSYM' for
898 XCOFF), and their own symbol descriptor, `r'. The stab's value is the
899 number of the register where the variable data will be stored.
901 AIX defines a separate symbol descriptor `d' for floating point
902 registers. This seems unnecessary; why not just just give floating
903 point registers different register numbers? I have not verified whether
904 the compiler actually uses `d'.
906 If the register is explicitly allocated to a global variable, but not
909 register int g_bar asm ("%g5");
911 then the stab may be emitted at the end of the object file, with the
915 File: stabs.info, Node: Common Blocks, Next: Statics, Prev: Register Variables, Up: Variables
920 A common block is a statically allocated section of memory which can be
921 referred to by several source files. It may contain several variables.
922 I believe Fortran is the only language with this feature.
924 A `N_BCOMM' stab begins a common block and an `N_ECOMM' stab ends
925 it. The only field that is significant in these two stabs is the
926 string, which names a normal (non-debugging) symbol that gives the
927 address of the common block. According to IBM documentation, only the
928 `N_BCOMM' has the name of the common block (even though their compiler
929 actually puts it both places).
931 The stabs for the members of the common block are between the
932 `N_BCOMM' and the `N_ECOMM'; the value of each stab is the offset
933 within the common block of that variable. IBM uses the `C_ECOML' stab
934 type, and there is a corresponding `N_ECOML' stab type, but Sun's
935 Fortran compiler uses `N_GSYM' instead. The variables within a common
936 block use the `V' symbol descriptor (I believe this is true of all
937 Fortran variables). Other stabs (at least type declarations using
938 `C_DECL') can also be between the `N_BCOMM' and the `N_ECOMM'.
941 File: stabs.info, Node: Statics, Next: Based Variables, Prev: Common Blocks, Up: Variables
946 Initialized static variables are represented by the `S' and `V' symbol
947 descriptors. `S' means file scope static, and `V' means procedure
948 scope static. One exception: in XCOFF, IBM's xlc compiler always uses
949 `V', and whether it is file scope or not is distinguished by whether
950 the stab is located within a function.
952 In a.out files, `N_STSYM' means the data section, `N_FUN' means the
953 text section, and `N_LCSYM' means the bss section. For those systems
954 with a read-only data section separate from the text section (Solaris),
955 `N_ROSYM' means the read-only data section.
957 For example, the source lines:
959 static const int var_const = 5;
960 static int var_init = 2;
961 static int var_noinit;
963 yield the following stabs:
965 .stabs "var_const:S1",36,0,0,_var_const # 36 is N_FUN
967 .stabs "var_init:S1",38,0,0,_var_init # 38 is N_STSYM
969 .stabs "var_noinit:S1",40,0,0,_var_noinit # 40 is N_LCSYM
971 In XCOFF files, the stab type need not indicate the section;
972 `C_STSYM' can be used for all statics. Also, each static variable is
973 enclosed in a static block. A `C_BSTAT' (emitted with a `.bs'
974 assembler directive) symbol begins the static block; its value is the
975 symbol number of the csect symbol whose value is the address of the
976 static block, its section is the section of the variables in that
977 static block, and its name is `.bs'. A `C_ESTAT' (emitted with a `.es'
978 assembler directive) symbol ends the static block; its name is `.es'
979 and its value and section are ignored.
981 In ECOFF files, the storage class is used to specify the section, so
982 the stab type need not indicate the section.
984 In ELF files, for the SunPRO compiler version 2.0.1, symbol
985 descriptor `S' means that the address is absolute (the linker relocates
986 it) and symbol descriptor `V' means that the address is relative to the
987 start of the relevant section for that compilation unit. SunPRO has
988 plans to have the linker stop relocating stabs; I suspect that their the
989 debugger gets the address from the corresponding ELF (not stab) symbol.
990 I'm not sure how to find which symbol of that name is the right one.
991 The clean way to do all this would be to have a the value of a symbol
992 descriptor `S' symbol be an offset relative to the start of the file,
993 just like everything else, but that introduces obvious compatibility
994 problems. For more information on linker stab relocation, *Note ELF
998 File: stabs.info, Node: Based Variables, Next: Parameters, Prev: Statics, Up: Variables
1000 4.6 Fortran Based Variables
1001 ===========================
1003 Fortran (at least, the Sun and SGI dialects of FORTRAN-77) has a feature
1004 which allows allocating arrays with `malloc', but which avoids blurring
1005 the line between arrays and pointers the way that C does. In stabs
1006 such a variable uses the `b' symbol descriptor.
1008 For example, the Fortran declarations
1010 real foo, foo10(10), foo10_5(10,5)
1012 pointer (foo10p, foo10)
1013 pointer (foo105p, foo10_5)
1019 foo10_5:bar3;1;5;ar3;1;10;6
1021 In this example, `real' is type 6 and type 3 is an integral type
1022 which is the type of the subscripts of the array (probably `integer').
1024 The `b' symbol descriptor is like `V' in that it denotes a
1025 statically allocated symbol whose scope is local to a function; see
1026 *Note Statics::. The value of the symbol, instead of being the address
1027 of the variable itself, is the address of a pointer to that variable.
1028 So in the above example, the value of the `foo' stab is the address of
1029 a pointer to a real, the value of the `foo10' stab is the address of a
1030 pointer to a 10-element array of reals, and the value of the `foo10_5'
1031 stab is the address of a pointer to a 5-element array of 10-element
1035 File: stabs.info, Node: Parameters, Prev: Based Variables, Up: Variables
1040 Formal parameters to a function are represented by a stab (or sometimes
1041 two; see below) for each parameter. The stabs are in the order in which
1042 the debugger should print the parameters (i.e., the order in which the
1043 parameters are declared in the source file). The exact form of the stab
1044 depends on how the parameter is being passed.
1046 Parameters passed on the stack use the symbol descriptor `p' and the
1047 `N_PSYM' symbol type (or `C_PSYM' for XCOFF). The value of the symbol
1048 is an offset used to locate the parameter on the stack; its exact
1049 meaning is machine-dependent, but on most machines it is an offset from
1052 As a simple example, the code:
1060 .stabs "main:F1",36,0,0,_main # 36 is N_FUN
1061 .stabs "argc:p1",160,0,0,68 # 160 is N_PSYM
1062 .stabs "argv:p20=*21=*2",160,0,0,72
1064 The type definition of `argv' is interesting because it contains
1065 several type definitions. Type 21 is pointer to type 2 (char) and
1066 `argv' (type 20) is pointer to type 21.
1068 The following symbol descriptors are also said to go with `N_PSYM'.
1069 The value of the symbol is said to be an offset from the argument
1070 pointer (I'm not sure whether this is true or not).
1073 pF Fortran function parameter
1074 X (function result variable)
1078 * Register Parameters::
1079 * Local Variable Parameters::
1080 * Reference Parameters::
1081 * Conformant Arrays::
1084 File: stabs.info, Node: Register Parameters, Next: Local Variable Parameters, Up: Parameters
1086 4.7.1 Passing Parameters in Registers
1087 -------------------------------------
1089 If the parameter is passed in a register, then traditionally there are
1090 two symbols for each argument:
1092 .stabs "arg:p1" . . . ; N_PSYM
1093 .stabs "arg:r1" . . . ; N_RSYM
1095 Debuggers use the second one to find the value, and the first one to
1096 know that it is an argument.
1098 Because that approach is kind of ugly, some compilers use symbol
1099 descriptor `P' or `R' to indicate an argument which is in a register.
1100 Symbol type `C_RPSYM' is used in XCOFF and `N_RSYM' is used otherwise.
1101 The symbol's value is the register number. `P' and `R' mean the same
1102 thing; the difference is that `P' is a GNU invention and `R' is an IBM
1103 (XCOFF) invention. As of version 4.9, GDB should handle either one.
1105 There is at least one case where GCC uses a `p' and `r' pair rather
1106 than `P'; this is where the argument is passed in the argument list and
1107 then loaded into a register.
1109 According to the AIX documentation, symbol descriptor `D' is for a
1110 parameter passed in a floating point register. This seems
1111 unnecessary--why not just use `R' with a register number which
1112 indicates that it's a floating point register? I haven't verified
1113 whether the system actually does what the documentation indicates.
1115 On the sparc and hppa, for a `P' symbol whose type is a structure or
1116 union, the register contains the address of the structure. On the
1117 sparc, this is also true of a `p' and `r' pair (using Sun `cc') or a
1118 `p' symbol. However, if a (small) structure is really in a register,
1119 `r' is used. And, to top it all off, on the hppa it might be a
1120 structure which was passed on the stack and loaded into a register and
1121 for which there is a `p' and `r' pair! I believe that symbol
1122 descriptor `i' is supposed to deal with this case (it is said to mean
1123 "value parameter by reference, indirect access"; I don't know the
1124 source for this information), but I don't know details or what
1125 compilers or debuggers use it, if any (not GDB or GCC). It is not
1126 clear to me whether this case needs to be dealt with differently than
1127 parameters passed by reference (*note Reference Parameters::).
1130 File: stabs.info, Node: Local Variable Parameters, Next: Reference Parameters, Prev: Register Parameters, Up: Parameters
1132 4.7.2 Storing Parameters as Local Variables
1133 -------------------------------------------
1135 There is a case similar to an argument in a register, which is an
1136 argument that is actually stored as a local variable. Sometimes this
1137 happens when the argument was passed in a register and then the compiler
1138 stores it as a local variable. If possible, the compiler should claim
1139 that it's in a register, but this isn't always done.
1141 If a parameter is passed as one type and converted to a smaller type
1142 by the prologue (for example, the parameter is declared as a `float',
1143 but the calling conventions specify that it is passed as a `double'),
1144 then GCC2 (sometimes) uses a pair of symbols. The first symbol uses
1145 symbol descriptor `p' and the type which is passed. The second symbol
1146 has the type and location which the parameter actually has after the
1147 prologue. For example, suppose the following C code appears with no
1148 prototypes involved:
1155 if `f' is passed as a double at stack offset 8, and the prologue
1156 converts it to a float in register number 0, then the stabs look like:
1158 .stabs "f:p13",160,0,3,8 # 160 is `N_PSYM', here 13 is `double'
1159 .stabs "f:r12",64,0,3,0 # 64 is `N_RSYM', here 12 is `float'
1161 In both stabs 3 is the line number where `f' is declared (*note Line
1164 GCC, at least on the 960, has another solution to the same problem.
1165 It uses a single `p' symbol descriptor for an argument which is stored
1166 as a local variable but uses `N_LSYM' instead of `N_PSYM'. In this
1167 case, the value of the symbol is an offset relative to the local
1168 variables for that function, not relative to the arguments; on some
1169 machines those are the same thing, but not on all.
1171 On the VAX or on other machines in which the calling convention
1172 includes the number of words of arguments actually passed, the debugger
1173 (GDB at least) uses the parameter symbols to keep track of whether it
1174 needs to print nameless arguments in addition to the formal parameters
1175 which it has printed because each one has a stab. For example, in
1177 extern int fprintf (FILE *stream, char *format, ...);
1179 fprintf (stdout, "%d\n", x);
1181 there are stabs for `stream' and `format'. On most machines, the
1182 debugger can only print those two arguments (because it has no way of
1183 knowing that additional arguments were passed), but on the VAX or other
1184 machines with a calling convention which indicates the number of words
1185 of arguments, the debugger can print all three arguments. To do so,
1186 the parameter symbol (symbol descriptor `p') (not necessarily `r' or
1187 symbol descriptor omitted symbols) needs to contain the actual type as
1188 passed (for example, `double' not `float' if it is passed as a double
1189 and converted to a float).
1192 File: stabs.info, Node: Reference Parameters, Next: Conformant Arrays, Prev: Local Variable Parameters, Up: Parameters
1194 4.7.3 Passing Parameters by Reference
1195 -------------------------------------
1197 If the parameter is passed by reference (e.g., Pascal `VAR'
1198 parameters), then the symbol descriptor is `v' if it is in the argument
1199 list, or `a' if it in a register. Other than the fact that these
1200 contain the address of the parameter rather than the parameter itself,
1201 they are identical to `p' and `R', respectively. I believe `a' is an
1202 AIX invention; `v' is supported by all stabs-using systems as far as I
1206 File: stabs.info, Node: Conformant Arrays, Prev: Reference Parameters, Up: Parameters
1208 4.7.4 Passing Conformant Array Parameters
1209 -----------------------------------------
1211 Conformant arrays are a feature of Modula-2, and perhaps other
1212 languages, in which the size of an array parameter is not known to the
1213 called function until run-time. Such parameters have two stabs: a `x'
1214 for the array itself, and a `C', which represents the size of the
1215 array. The value of the `x' stab is the offset in the argument list
1216 where the address of the array is stored (it this right? it is a
1217 guess); the value of the `C' stab is the offset in the argument list
1218 where the size of the array (in elements? in bytes?) is stored.
1221 File: stabs.info, Node: Types, Next: Symbol Tables, Prev: Variables, Up: Top
1226 The examples so far have described types as references to previously
1227 defined types, or defined in terms of subranges of or pointers to
1228 previously defined types. This chapter describes the other type
1229 descriptors that may follow the `=' in a type definition.
1233 * Builtin Types:: Integers, floating point, void, etc.
1234 * Miscellaneous Types:: Pointers, sets, files, etc.
1235 * Cross-References:: Referring to a type not yet defined.
1236 * Subranges:: A type with a specific range.
1237 * Arrays:: An aggregate type of same-typed elements.
1238 * Strings:: Like an array but also has a length.
1239 * Enumerations:: Like an integer but the values have names.
1240 * Structures:: An aggregate type of different-typed elements.
1241 * Typedefs:: Giving a type a name.
1242 * Unions:: Different types sharing storage.
1246 File: stabs.info, Node: Builtin Types, Next: Miscellaneous Types, Up: Types
1251 Certain types are built in (`int', `short', `void', `float', etc.); the
1252 debugger recognizes these types and knows how to handle them. Thus,
1253 don't be surprised if some of the following ways of specifying builtin
1254 types do not specify everything that a debugger would need to know
1255 about the type--in some cases they merely specify enough information to
1256 distinguish the type from other types.
1258 The traditional way to define builtin types is convoluted, so new
1259 ways have been invented to describe them. Sun's `acc' uses special
1260 builtin type descriptors (`b' and `R'), and IBM uses negative type
1261 numbers. GDB accepts all three ways, as of version 4.8; dbx just
1262 accepts the traditional builtin types and perhaps one of the other two
1263 formats. The following sections describe each of these formats.
1267 * Traditional Builtin Types:: Put on your seat belts and prepare for kludgery
1268 * Builtin Type Descriptors:: Builtin types with special type descriptors
1269 * Negative Type Numbers:: Builtin types using negative type numbers
1272 File: stabs.info, Node: Traditional Builtin Types, Next: Builtin Type Descriptors, Up: Builtin Types
1274 5.1.1 Traditional Builtin Types
1275 -------------------------------
1277 This is the traditional, convoluted method for defining builtin types.
1278 There are several classes of such type definitions: integer, floating
1283 * Traditional Integer Types::
1284 * Traditional Other Types::
1287 File: stabs.info, Node: Traditional Integer Types, Next: Traditional Other Types, Up: Traditional Builtin Types
1289 5.1.1.1 Traditional Integer Types
1290 .................................
1292 Often types are defined as subranges of themselves. If the bounding
1293 values fit within an `int', then they are given normally. For example:
1295 .stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0 # 128 is N_LSYM
1296 .stabs "char:t2=r2;0;127;",128,0,0,0
1298 Builtin types can also be described as subranges of `int':
1300 .stabs "unsigned short:t6=r1;0;65535;",128,0,0,0
1302 If the lower bound of a subrange is 0 and the upper bound is -1, the
1303 type is an unsigned integral type whose bounds are too big to describe
1304 in an `int'. Traditionally this is only used for `unsigned int' and
1307 .stabs "unsigned int:t4=r1;0;-1;",128,0,0,0
1309 For larger types, GCC 2.4.5 puts out bounds in octal, with one or
1310 more leading zeroes. In this case a negative bound consists of a number
1311 which is a 1 bit (for the sign bit) followed by a 0 bit for each bit in
1312 the number (except the sign bit), and a positive bound is one which is a
1313 1 bit for each bit in the number (except possibly the sign bit). All
1314 known versions of dbx and GDB version 4 accept this (at least in the
1315 sense of not refusing to process the file), but GDB 3.5 refuses to read
1316 the whole file containing such symbols. So GCC 2.3.3 did not output the
1317 proper size for these types. As an example of octal bounds, the string
1318 fields of the stabs for 64 bit integer types look like:
1320 long int:t3=r1;001000000000000000000000;000777777777777777777777;
1321 long unsigned int:t5=r1;000000000000000000000000;001777777777777777777777;
1323 If the lower bound of a subrange is 0 and the upper bound is
1324 negative, the type is an unsigned integral type whose size in bytes is
1325 the absolute value of the upper bound. I believe this is a Convex
1326 convention for `unsigned long long'.
1328 If the lower bound of a subrange is negative and the upper bound is
1329 0, the type is a signed integral type whose size in bytes is the
1330 absolute value of the lower bound. I believe this is a Convex
1331 convention for `long long'. To distinguish this from a legitimate
1332 subrange, the type should be a subrange of itself. I'm not sure whether
1333 this is the case for Convex.
1336 File: stabs.info, Node: Traditional Other Types, Prev: Traditional Integer Types, Up: Traditional Builtin Types
1338 5.1.1.2 Traditional Other Types
1339 ...............................
1341 If the upper bound of a subrange is 0 and the lower bound is positive,
1342 the type is a floating point type, and the lower bound of the subrange
1343 indicates the number of bytes in the type:
1345 .stabs "float:t12=r1;4;0;",128,0,0,0
1346 .stabs "double:t13=r1;8;0;",128,0,0,0
1348 However, GCC writes `long double' the same way it writes `double',
1349 so there is no way to distinguish.
1351 .stabs "long double:t14=r1;8;0;",128,0,0,0
1353 Complex types are defined the same way as floating-point types;
1354 there is no way to distinguish a single-precision complex from a
1355 double-precision floating-point type.
1357 The C `void' type is defined as itself:
1359 .stabs "void:t15=15",128,0,0,0
1361 I'm not sure how a boolean type is represented.
1364 File: stabs.info, Node: Builtin Type Descriptors, Next: Negative Type Numbers, Prev: Traditional Builtin Types, Up: Builtin Types
1366 5.1.2 Defining Builtin Types Using Builtin Type Descriptors
1367 -----------------------------------------------------------
1369 This is the method used by Sun's `acc' for defining builtin types.
1370 These are the type descriptors to define builtin types:
1372 `b SIGNED CHAR-FLAG WIDTH ; OFFSET ; NBITS ;'
1373 Define an integral type. SIGNED is `u' for unsigned or `s' for
1374 signed. CHAR-FLAG is `c' which indicates this is a character
1375 type, or is omitted. I assume this is to distinguish an integral
1376 type from a character type of the same size, for example it might
1377 make sense to set it for the C type `wchar_t' so the debugger can
1378 print such variables differently (Solaris does not do this). Sun
1379 sets it on the C types `signed char' and `unsigned char' which
1380 arguably is wrong. WIDTH and OFFSET appear to be for small
1381 objects stored in larger ones, for example a `short' in an `int'
1382 register. WIDTH is normally the number of bytes in the type.
1383 OFFSET seems to always be zero. NBITS is the number of bits in
1386 Note that type descriptor `b' used for builtin types conflicts with
1387 its use for Pascal space types (*note Miscellaneous Types::); they
1388 can be distinguished because the character following the type
1389 descriptor will be a digit, `(', or `-' for a Pascal space type, or
1390 `u' or `s' for a builtin type.
1393 Documented by AIX to define a wide character type, but their
1394 compiler actually uses negative type numbers (*note Negative Type
1397 `R FP-TYPE ; BYTES ;'
1398 Define a floating point type. FP-TYPE has one of the following
1402 IEEE 32-bit (single precision) floating point format.
1405 IEEE 64-bit (double precision) floating point format.
1412 These are for complex numbers. A comment in the GDB source
1413 describes them as Fortran `complex', `double complex', and
1414 `complex*16', respectively, but what does that mean? (i.e.,
1415 Single precision? Double precision?).
1418 Long double. This should probably only be used for Sun format
1419 `long double', and new codes should be used for other floating
1420 point formats (`NF_DOUBLE' can be used if a `long double' is
1421 really just an IEEE double, of course).
1423 BYTES is the number of bytes occupied by the type. This allows a
1424 debugger to perform some operations with the type even if it
1425 doesn't understand FP-TYPE.
1427 `g TYPE-INFORMATION ; NBITS'
1428 Documented by AIX to define a floating type, but their compiler
1429 actually uses negative type numbers (*note Negative Type
1432 `c TYPE-INFORMATION ; NBITS'
1433 Documented by AIX to define a complex type, but their compiler
1434 actually uses negative type numbers (*note Negative Type
1437 The C `void' type is defined as a signed integral type 0 bits long:
1438 .stabs "void:t19=bs0;0;0",128,0,0,0
1439 The Solaris compiler seems to omit the trailing semicolon in this
1440 case. Getting sloppy in this way is not a swift move because if a type
1441 is embedded in a more complex expression it is necessary to be able to
1444 I'm not sure how a boolean type is represented.
1447 File: stabs.info, Node: Negative Type Numbers, Prev: Builtin Type Descriptors, Up: Builtin Types
1449 5.1.3 Negative Type Numbers
1450 ---------------------------
1452 This is the method used in XCOFF for defining builtin types. Since the
1453 debugger knows about the builtin types anyway, the idea of negative
1454 type numbers is simply to give a special type number which indicates
1455 the builtin type. There is no stab defining these types.
1457 There are several subtle issues with negative type numbers.
1459 One is the size of the type. A builtin type (for example the C types
1460 `int' or `long') might have different sizes depending on compiler
1461 options, the target architecture, the ABI, etc. This issue doesn't
1462 come up for IBM tools since (so far) they just target the RS/6000; the
1463 sizes indicated below for each size are what the IBM RS/6000 tools use.
1464 To deal with differing sizes, either define separate negative type
1465 numbers for each size (which works but requires changing the debugger,
1466 and, unless you get both AIX dbx and GDB to accept the change,
1467 introduces an incompatibility), or use a type attribute (*note String
1468 Field::) to define a new type with the appropriate size (which merely
1469 requires a debugger which understands type attributes, like AIX dbx or
1472 .stabs "boolean:t10=@s8;-16",128,0,0,0
1474 defines an 8-bit boolean type, and
1476 .stabs "boolean:t10=@s64;-16",128,0,0,0
1478 defines a 64-bit boolean type.
1480 A similar issue is the format of the type. This comes up most often
1481 for floating-point types, which could have various formats (particularly
1482 extended doubles, which vary quite a bit even among IEEE systems).
1483 Again, it is best to define a new negative type number for each
1484 different format; changing the format based on the target system has
1485 various problems. One such problem is that the Alpha has both VAX and
1486 IEEE floating types. One can easily imagine one library using the VAX
1487 types and another library in the same executable using the IEEE types.
1488 Another example is that the interpretation of whether a boolean is true
1489 or false can be based on the least significant bit, most significant
1490 bit, whether it is zero, etc., and different compilers (or different
1491 options to the same compiler) might provide different kinds of boolean.
1493 The last major issue is the names of the types. The name of a given
1494 type depends _only_ on the negative type number given; these do not
1495 vary depending on the language, the target system, or anything else.
1496 One can always define separate type numbers--in the following list you
1497 will see for example separate `int' and `integer*4' types which are
1498 identical except for the name. But compatibility can be maintained by
1499 not inventing new negative type numbers and instead just defining a new
1500 type with a new name. For example:
1502 .stabs "CARDINAL:t10=-8",128,0,0,0
1504 Here is the list of negative type numbers. The phrase "integral
1505 type" is used to mean twos-complement (I strongly suspect that all
1506 machines which use stabs use twos-complement; most machines use
1507 twos-complement these days).
1510 `int', 32 bit signed integral type.
1513 `char', 8 bit type holding a character. Both GDB and dbx on AIX
1514 treat this as signed. GCC uses this type whether `char' is signed
1515 or not, which seems like a bad idea. The AIX compiler (`xlc')
1516 seems to avoid this type; it uses -5 instead for `char'.
1519 `short', 16 bit signed integral type.
1522 `long', 32 bit signed integral type.
1525 `unsigned char', 8 bit unsigned integral type.
1528 `signed char', 8 bit signed integral type.
1531 `unsigned short', 16 bit unsigned integral type.
1534 `unsigned int', 32 bit unsigned integral type.
1537 `unsigned', 32 bit unsigned integral type.
1540 `unsigned long', 32 bit unsigned integral type.
1543 `void', type indicating the lack of a value.
1546 `float', IEEE single precision.
1549 `double', IEEE double precision.
1552 `long double', IEEE double precision. The compiler claims the size
1553 will increase in a future release, and for binary compatibility
1554 you have to avoid using `long double'. I hope when they increase
1555 it they use a new negative type number.
1558 `integer'. 32 bit signed integral type.
1561 `boolean'. 32 bit type. GDB and GCC assume that zero is false,
1562 one is true, and other values have unspecified meaning. I hope
1563 this agrees with how the IBM tools use the type.
1566 `short real'. IEEE single precision.
1569 `real'. IEEE double precision.
1572 `stringptr'. *Note Strings::.
1575 `character', 8 bit unsigned character type.
1578 `logical*1', 8 bit type. This Fortran type has a split
1579 personality in that it is used for boolean variables, but can also
1580 be used for unsigned integers. 0 is false, 1 is true, and other
1581 values are non-boolean.
1584 `logical*2', 16 bit type. This Fortran type has a split
1585 personality in that it is used for boolean variables, but can also
1586 be used for unsigned integers. 0 is false, 1 is true, and other
1587 values are non-boolean.
1590 `logical*4', 32 bit type. This Fortran type has a split
1591 personality in that it is used for boolean variables, but can also
1592 be used for unsigned integers. 0 is false, 1 is true, and other
1593 values are non-boolean.
1596 `logical', 32 bit type. This Fortran type has a split personality
1597 in that it is used for boolean variables, but can also be used for
1598 unsigned integers. 0 is false, 1 is true, and other values are
1602 `complex'. A complex type consisting of two IEEE single-precision
1603 floating point values.
1606 `complex'. A complex type consisting of two IEEE double-precision
1607 floating point values.
1610 `integer*1', 8 bit signed integral type.
1613 `integer*2', 16 bit signed integral type.
1616 `integer*4', 32 bit signed integral type.
1619 `wchar'. Wide character, 16 bits wide, unsigned (what format?
1623 `long long', 64 bit signed integral type.
1626 `unsigned long long', 64 bit unsigned integral type.
1629 `logical*8', 64 bit unsigned integral type.
1632 `integer*8', 64 bit signed integral type.
1635 File: stabs.info, Node: Miscellaneous Types, Next: Cross-References, Prev: Builtin Types, Up: Types
1637 5.2 Miscellaneous Types
1638 =======================
1640 `b TYPE-INFORMATION ; BYTES'
1641 Pascal space type. This is documented by IBM; what does it mean?
1643 This use of the `b' type descriptor can be distinguished from its
1644 use for builtin integral types (*note Builtin Type Descriptors::)
1645 because the character following the type descriptor is always a
1648 `B TYPE-INFORMATION'
1649 A volatile-qualified version of TYPE-INFORMATION. This is a Sun
1650 extension. References and stores to a variable with a
1651 volatile-qualified type must not be optimized or cached; they must
1652 occur as the user specifies them.
1654 `d TYPE-INFORMATION'
1655 File of type TYPE-INFORMATION. As far as I know this is only used
1658 `k TYPE-INFORMATION'
1659 A const-qualified version of TYPE-INFORMATION. This is a Sun
1660 extension. A variable with a const-qualified type cannot be
1663 `M TYPE-INFORMATION ; LENGTH'
1664 Multiple instance type. The type seems to composed of LENGTH
1665 repetitions of TYPE-INFORMATION, for example `character*3' is
1666 represented by `M-2;3', where `-2' is a reference to a character
1667 type (*note Negative Type Numbers::). I'm not sure how this
1668 differs from an array. This appears to be a Fortran feature.
1669 LENGTH is a bound, like those in range types; see *Note
1672 `S TYPE-INFORMATION'
1673 Pascal set type. TYPE-INFORMATION must be a small type such as an
1674 enumeration or a subrange, and the type is a bitmask whose length
1675 is specified by the number of elements in TYPE-INFORMATION.
1677 In CHILL, if it is a bitstring instead of a set, also use the `S'
1678 type attribute (*note String Field::).
1680 `* TYPE-INFORMATION'
1681 Pointer to TYPE-INFORMATION.
1684 File: stabs.info, Node: Cross-References, Next: Subranges, Prev: Miscellaneous Types, Up: Types
1686 5.3 Cross-References to Other Types
1687 ===================================
1689 A type can be used before it is defined; one common way to deal with
1690 that situation is just to use a type reference to a type which has not
1693 Another way is with the `x' type descriptor, which is followed by
1694 `s' for a structure tag, `u' for a union tag, or `e' for a enumerator
1695 tag, followed by the name of the tag, followed by `:'. If the name
1696 contains `::' between a `<' and `>' pair (for C++ templates), such a
1697 `::' does not end the name--only a single `:' ends the name; see *Note
1700 For example, the following C declarations:
1707 .stabs "bar:G16=*17=xsfoo:",32,0,0,0
1709 Not all debuggers support the `x' type descriptor, so on some
1710 machines GCC does not use it. I believe that for the above example it
1711 would just emit a reference to type 17 and never define it, but I
1712 haven't verified that.
1714 Modula-2 imported types, at least on AIX, use the `i' type
1715 descriptor, which is followed by the name of the module from which the
1716 type is imported, followed by `:', followed by the name of the type.
1717 There is then optionally a comma followed by type information for the
1718 type. This differs from merely naming the type (*note Typedefs::) in
1719 that it identifies the module; I don't understand whether the name of
1720 the type given here is always just the same as the name we are giving
1721 it, or whether this type descriptor is used with a nameless stab (*note
1722 String Field::), or what. The symbol ends with `;'.
1725 File: stabs.info, Node: Subranges, Next: Arrays, Prev: Cross-References, Up: Types
1730 The `r' type descriptor defines a type as a subrange of another type.
1731 It is followed by type information for the type of which it is a
1732 subrange, a semicolon, an integral lower bound, a semicolon, an
1733 integral upper bound, and a semicolon. The AIX documentation does not
1734 specify the trailing semicolon, in an effort to specify array indexes
1735 more cleanly, but a subrange which is not an array index has always
1736 included a trailing semicolon (*note Arrays::).
1738 Instead of an integer, either bound can be one of the following:
1741 The bound is passed by reference on the stack at offset OFFSET
1742 from the argument list. *Note Parameters::, for more information
1746 The bound is passed by value on the stack at offset OFFSET from
1750 The bound is passed by reference in register number
1754 The bound is passed by value in register number REGISTER-NUMBER.
1759 Subranges are also used for builtin types; see *Note Traditional
1763 File: stabs.info, Node: Arrays, Next: Strings, Prev: Subranges, Up: Types
1768 Arrays use the `a' type descriptor. Following the type descriptor is
1769 the type of the index and the type of the array elements. If the index
1770 type is a range type, it ends in a semicolon; otherwise (for example,
1771 if it is a type reference), there does not appear to be any way to tell
1772 where the types are separated. In an effort to clean up this mess, IBM
1773 documents the two types as being separated by a semicolon, and a range
1774 type as not ending in a semicolon (but this is not right for range
1775 types which are not array indexes, *note Subranges::). I think
1776 probably the best solution is to specify that a semicolon ends a range
1777 type, and that the index type and element type of an array are
1778 separated by a semicolon, but that if the index type is a range type,
1779 the extra semicolon can be omitted. GDB (at least through version 4.9)
1780 doesn't support any kind of index type other than a range anyway; I'm
1783 It is well established, and widely used, that the type of the index,
1784 unlike most types found in the stabs, is merely a type definition, not
1785 type information (*note String Field::) (that is, it need not start with
1786 `TYPE-NUMBER=' if it is defining a new type). According to a comment
1787 in GDB, this is also true of the type of the array elements; it gives
1788 `ar1;1;10;ar1;1;10;4' as a legitimate way to express a two dimensional
1789 array. According to AIX documentation, the element type must be type
1790 information. GDB accepts either.
1792 The type of the index is often a range type, expressed as the type
1793 descriptor `r' and some parameters. It defines the size of the array.
1794 In the example below, the range `r1;0;2;' defines an index type which
1795 is a subrange of type 1 (integer), with a lower bound of 0 and an upper
1796 bound of 2. This defines the valid range of subscripts of a
1797 three-element C array.
1799 For example, the definition:
1801 char char_vec[3] = {'a','b','c'};
1803 produces the output:
1805 .stabs "char_vec:G19=ar1;0;2;2",32,0,0,0
1813 If an array is "packed", the elements are spaced more closely than
1814 normal, saving memory at the expense of speed. For example, an array
1815 of 3-byte objects might, if unpacked, have each element aligned on a
1816 4-byte boundary, but if packed, have no padding. One way to specify
1817 that something is packed is with type attributes (*note String
1818 Field::). In the case of arrays, another is to use the `P' type
1819 descriptor instead of `a'. Other than specifying a packed array, `P'
1820 is identical to `a'.
1822 An open array is represented by the `A' type descriptor followed by
1823 type information specifying the type of the array elements.
1825 An N-dimensional dynamic array is represented by
1827 D DIMENSIONS ; TYPE-INFORMATION
1829 DIMENSIONS is the number of dimensions; TYPE-INFORMATION specifies
1830 the type of the array elements.
1832 A subarray of an N-dimensional array is represented by
1834 E DIMENSIONS ; TYPE-INFORMATION
1836 DIMENSIONS is the number of dimensions; TYPE-INFORMATION specifies
1837 the type of the array elements.
1840 File: stabs.info, Node: Strings, Next: Enumerations, Prev: Arrays, Up: Types
1845 Some languages, like C or the original Pascal, do not have string types,
1846 they just have related things like arrays of characters. But most
1847 Pascals and various other languages have string types, which are
1848 indicated as follows:
1850 `n TYPE-INFORMATION ; BYTES'
1851 BYTES is the maximum length. I'm not sure what TYPE-INFORMATION
1852 is; I suspect that it means that this is a string of
1853 TYPE-INFORMATION (thus allowing a string of integers, a string of
1854 wide characters, etc., as well as a string of characters). Not
1855 sure what the format of this type is. This is an AIX feature.
1857 `z TYPE-INFORMATION ; BYTES'
1858 Just like `n' except that this is a gstring, not an ordinary
1859 string. I don't know the difference.
1862 Pascal Stringptr. What is this? This is an AIX feature.
1864 Languages, such as CHILL which have a string type which is basically
1865 just an array of characters use the `S' type attribute (*note String
1869 File: stabs.info, Node: Enumerations, Next: Structures, Prev: Strings, Up: Types
1874 Enumerations are defined with the `e' type descriptor.
1876 The source line below declares an enumeration type at file scope.
1877 The type definition is located after the `N_RBRAC' that marks the end of
1878 the previous procedure's block scope, and before the `N_FUN' that marks
1879 the beginning of the next procedure's block scope. Therefore it does
1880 not describe a block local symbol, but a file local one.
1884 enum e_places {first,second=3,last};
1886 generates the following stab:
1888 .stabs "e_places:T22=efirst:0,second:3,last:4,;",128,0,0,0
1890 The symbol descriptor (`T') says that the stab describes a
1891 structure, enumeration, or union tag. The type descriptor `e',
1892 following the `22=' of the type definition narrows it down to an
1893 enumeration type. Following the `e' is a list of the elements of the
1894 enumeration. The format is `NAME:VALUE,'. The list of elements ends
1895 with `;'. The fact that VALUE is specified as an integer can cause
1896 problems if the value is large. GCC 2.5.2 tries to output it in octal
1897 in that case with a leading zero, which is probably a good thing,
1898 although GDB 4.11 supports octal only in cases where decimal is
1899 perfectly good. Negative decimal values are supported by both GDB and
1902 There is no standard way to specify the size of an enumeration type;
1903 it is determined by the architecture (normally all enumerations types
1904 are 32 bits). Type attributes can be used to specify an enumeration
1905 type of another size for debuggers which support them; see *Note String
1908 Enumeration types are unusual in that they define symbols for the
1909 enumeration values (`first', `second', and `third' in the above
1910 example), and even though these symbols are visible in the file as a
1911 whole (rather than being in a more local namespace like structure
1912 member names), they are defined in the type definition for the
1913 enumeration type rather than each having their own symbol. In order to
1914 be fast, GDB will only get symbols from such types (in its initial scan
1915 of the stabs) if the type is the first thing defined after a `T' or `t'
1916 symbol descriptor (the above example fulfills this requirement). If
1917 the type does not have a name, the compiler should emit it in a
1918 nameless stab (*note String Field::); GCC does this.
1921 File: stabs.info, Node: Structures, Next: Typedefs, Prev: Enumerations, Up: Types
1926 The encoding of structures in stabs can be shown with an example.
1928 The following source code declares a structure tag and defines an
1929 instance of the structure in global scope. Then a `typedef' equates the
1930 structure tag with a new type. Separate stabs are generated for the
1931 structure tag, the structure `typedef', and the structure instance. The
1932 stabs for the tag and the `typedef' are emitted when the definitions are
1933 encountered. Since the structure elements are not initialized, the
1934 stab and code for the structure variable itself is located at the end
1935 of the program in the bss section.
1941 struct s_tag* s_next;
1944 typedef struct s_tag s_typedef;
1946 The structure tag has an `N_LSYM' stab type because, like the
1947 enumeration, the symbol has file scope. Like the enumeration, the
1948 symbol descriptor is `T', for enumeration, structure, or tag type. The
1949 type descriptor `s' following the `16=' of the type definition narrows
1950 the symbol type to structure.
1952 Following the `s' type descriptor is the number of bytes the
1953 structure occupies, followed by a description of each structure element.
1954 The structure element descriptions are of the form `NAME:TYPE, BIT
1955 OFFSET FROM THE START OF THE STRUCT, NUMBER OF BITS IN THE ELEMENT'.
1958 .stabs "s_tag:T16=s20s_int:1,0,32;s_float:12,32,32;
1959 s_char_vec:17=ar1;0;7;2,64,64;s_next:18=*16,128,32;;",128,0,0,0
1961 In this example, the first two structure elements are previously
1962 defined types. For these, the type following the `NAME:' part of the
1963 element description is a simple type reference. The other two structure
1964 elements are new types. In this case there is a type definition
1965 embedded after the `NAME:'. The type definition for the array element
1966 looks just like a type definition for a stand-alone array. The
1967 `s_next' field is a pointer to the same kind of structure that the
1968 field is an element of. So the definition of structure type 16
1969 contains a type definition for an element which is a pointer to type 16.
1971 If a field is a static member (this is a C++ feature in which a
1972 single variable appears to be a field of every structure of a given
1973 type) it still starts out with the field name, a colon, and the type,
1974 but then instead of a comma, bit position, comma, and bit size, there
1975 is a colon followed by the name of the variable which each such field
1978 If the structure has methods (a C++ feature), they follow the
1979 non-method fields; see *Note Cplusplus::.
1982 File: stabs.info, Node: Typedefs, Next: Unions, Prev: Structures, Up: Types
1984 5.9 Giving a Type a Name
1985 ========================
1987 To give a type a name, use the `t' symbol descriptor. The type is
1988 specified by the type information (*note String Field::) for the stab.
1991 .stabs "s_typedef:t16",128,0,0,0 # 128 is N_LSYM
1993 specifies that `s_typedef' refers to type number 16. Such stabs
1994 have symbol type `N_LSYM' (or `C_DECL' for XCOFF). (The Sun
1995 documentation mentions using `N_GSYM' in some cases).
1997 If you are specifying the tag name for a structure, union, or
1998 enumeration, use the `T' symbol descriptor instead. I believe C is the
1999 only language with this feature.
2001 If the type is an opaque type (I believe this is a Modula-2 feature),
2002 AIX provides a type descriptor to specify it. The type descriptor is
2003 `o' and is followed by a name. I don't know what the name means--is it
2004 always the same as the name of the type, or is this type descriptor
2005 used with a nameless stab (*note String Field::)? There optionally
2006 follows a comma followed by type information which defines the type of
2007 this type. If omitted, a semicolon is used in place of the comma and
2008 the type information, and the type is much like a generic pointer
2009 type--it has a known size but little else about it is specified.
2012 File: stabs.info, Node: Unions, Next: Function Types, Prev: Typedefs, Up: Types
2023 This code generates a stab for a union tag and a stab for a union
2024 variable. Both use the `N_LSYM' stab type. If a union variable is
2025 scoped locally to the procedure in which it is defined, its stab is
2026 located immediately preceding the `N_LBRAC' for the procedure's block
2029 The stab for the union tag, however, is located preceding the code
2030 for the procedure in which it is defined. The stab type is `N_LSYM'.
2031 This would seem to imply that the union type is file scope, like the
2032 struct type `s_tag'. This is not true. The contents and position of
2033 the stab for `u_type' do not convey any information about its procedure
2037 .stabs "u_tag:T23=u4u_int:1,0,32;u_float:12,0,32;u_char:21,0,32;;",
2040 The symbol descriptor `T', following the `name:' means that the stab
2041 describes an enumeration, structure, or union tag. The type descriptor
2042 `u', following the `23=' of the type definition, narrows it down to a
2043 union type definition. Following the `u' is the number of bytes in the
2044 union. After that is a list of union element descriptions. Their
2045 format is `NAME:TYPE, BIT OFFSET INTO THE UNION, NUMBER OF BYTES FOR
2048 The stab for the union variable is:
2050 .stabs "an_u:23",128,0,0,-20 # 128 is N_LSYM
2052 `-20' specifies where the variable is stored (*note Stack
2056 File: stabs.info, Node: Function Types, Prev: Unions, Up: Types
2061 Various types can be defined for function variables. These types are
2062 not used in defining functions (*note Procedures::); they are used for
2063 things like pointers to functions.
2065 The simple, traditional, type is type descriptor `f' is followed by
2066 type information for the return type of the function, followed by a
2069 This does not deal with functions for which the number and types of
2070 the parameters are part of the type, as in Modula-2 or ANSI C. AIX
2071 provides extensions to specify these, using the `f', `F', `p', and `R'
2074 First comes the type descriptor. If it is `f' or `F', this type
2075 involves a function rather than a procedure, and the type information
2076 for the return type of the function follows, followed by a comma. Then
2077 comes the number of parameters to the function and a semicolon. Then,
2078 for each parameter, there is the name of the parameter followed by a
2079 colon (this is only present for type descriptors `R' and `F' which
2080 represent Pascal function or procedure parameters), type information
2081 for the parameter, a comma, 0 if passed by reference or 1 if passed by
2082 value, and a semicolon. The type definition ends with a semicolon.
2084 For example, this variable definition:
2088 generates the following code:
2090 .stabs "g_pf:G24=*25=f1",32,0,0,0
2091 .common _g_pf,4,"bss"
2093 The variable defines a new type, 24, which is a pointer to another
2094 new type, 25, which is a function returning `int'.
2097 File: stabs.info, Node: Symbol Tables, Next: Cplusplus, Prev: Types, Up: Top
2099 6 Symbol Information in Symbol Tables
2100 *************************************
2102 This chapter describes the format of symbol table entries and how stab
2103 assembler directives map to them. It also describes the
2104 transformations that the assembler and linker make on data from stabs.
2108 * Symbol Table Format::
2109 * Transformations On Symbol Tables::
2112 File: stabs.info, Node: Symbol Table Format, Next: Transformations On Symbol Tables, Up: Symbol Tables
2114 6.1 Symbol Table Format
2115 =======================
2117 Each time the assembler encounters a stab directive, it puts each field
2118 of the stab into a corresponding field in a symbol table entry of its
2119 output file. If the stab contains a string field, the symbol table
2120 entry for that stab points to a string table entry containing the
2121 string data from the stab. Assembler labels become relocatable
2122 addresses. Symbol table entries in a.out have the format:
2124 struct internal_nlist {
2125 unsigned long n_strx; /* index into string table of name */
2126 unsigned char n_type; /* type of symbol */
2127 unsigned char n_other; /* misc info (usually empty) */
2128 unsigned short n_desc; /* description field */
2129 bfd_vma n_value; /* value of symbol */
2132 If the stab has a string, the `n_strx' field holds the offset in
2133 bytes of the string within the string table. The string is terminated
2134 by a NUL character. If the stab lacks a string (for example, it was
2135 produced by a `.stabn' or `.stabd' directive), the `n_strx' field is
2138 Symbol table entries with `n_type' field values greater than 0x1f
2139 originated as stabs generated by the compiler (with one random
2140 exception). The other entries were placed in the symbol table of the
2141 executable by the assembler or the linker.
2144 File: stabs.info, Node: Transformations On Symbol Tables, Prev: Symbol Table Format, Up: Symbol Tables
2146 6.2 Transformations on Symbol Tables
2147 ====================================
2149 The linker concatenates object files and does fixups of externally
2152 You can see the transformations made on stab data by the assembler
2153 and linker by examining the symbol table after each pass of the build.
2154 To do this, use `nm -ap', which dumps the symbol table, including
2155 debugging information, unsorted. For stab entries the columns are:
2156 VALUE, OTHER, DESC, TYPE, STRING. For assembler and linker symbols,
2157 the columns are: VALUE, TYPE, STRING.
2159 The low 5 bits of the stab type tell the linker how to relocate the
2160 value of the stab. Thus for stab types like `N_RSYM' and `N_LSYM',
2161 where the value is an offset or a register number, the low 5 bits are
2162 `N_ABS', which tells the linker not to relocate the value.
2164 Where the value of a stab contains an assembly language label, it is
2165 transformed by each build step. The assembler turns it into a
2166 relocatable address and the linker turns it into an absolute address.
2170 * Transformations On Static Variables::
2171 * Transformations On Global Variables::
2172 * Stab Section Transformations:: For some object file formats,
2173 things are a bit different.
2176 File: stabs.info, Node: Transformations On Static Variables, Next: Transformations On Global Variables, Up: Transformations On Symbol Tables
2178 6.2.1 Transformations on Static Variables
2179 -----------------------------------------
2181 This source line defines a static variable at file scope:
2183 static int s_g_repeat
2185 The following stab describes the symbol:
2187 .stabs "s_g_repeat:S1",38,0,0,_s_g_repeat
2189 The assembler transforms the stab into this symbol table entry in the
2190 `.o' file. The location is expressed as a data segment offset.
2192 00000084 - 00 0000 STSYM s_g_repeat:S1
2194 In the symbol table entry from the executable, the linker has made the
2195 relocatable address absolute.
2197 0000e00c - 00 0000 STSYM s_g_repeat:S1
2200 File: stabs.info, Node: Transformations On Global Variables, Next: Stab Section Transformations, Prev: Transformations On Static Variables, Up: Transformations On Symbol Tables
2202 6.2.2 Transformations on Global Variables
2203 -----------------------------------------
2205 Stabs for global variables do not contain location information. In this
2206 case, the debugger finds location information in the assembler or
2207 linker symbol table entry describing the variable. The source line:
2213 .stabs "g_foo:G2",32,0,0,0
2215 The variable is represented by two symbol table entries in the object
2216 file (see below). The first one originated as a stab. The second one
2217 is an external symbol. The upper case `D' signifies that the `n_type'
2218 field of the symbol table contains 7, `N_DATA' with local linkage. The
2219 stab's value is zero since the value is not used for `N_GSYM' stabs.
2220 The value of the linker symbol is the relocatable address corresponding
2223 00000000 - 00 0000 GSYM g_foo:G2
2226 These entries as transformed by the linker. The linker symbol table
2227 entry now holds an absolute address:
2229 00000000 - 00 0000 GSYM g_foo:G2
2234 File: stabs.info, Node: Stab Section Transformations, Prev: Transformations On Global Variables, Up: Transformations On Symbol Tables
2236 6.2.3 Transformations of Stabs in separate sections
2237 ---------------------------------------------------
2239 For object file formats using stabs in separate sections (*note Stab
2240 Sections::), use `objdump --stabs' instead of `nm' to show the stabs in
2241 an object or executable file. `objdump' is a GNU utility; Sun does not
2242 provide any equivalent.
2244 The following example is for a stab whose value is an address is
2245 relative to the compilation unit (*note ELF Linker Relocation::). For
2246 example, if the source line
2250 appears within a function, then the assembly language output from the
2255 .stabs "ld:V(0,3)",0x26,0,4,.L18-Ddata.data # 0x26 is N_STSYM
2261 Because the value is formed by subtracting one symbol from another,
2262 the value is absolute, not relocatable, and so the object file contains
2264 Symnum n_type n_othr n_desc n_value n_strx String
2265 31 STSYM 0 4 00000004 680 ld:V(0,3)
2267 without any relocations, and the executable file also contains
2269 Symnum n_type n_othr n_desc n_value n_strx String
2270 31 STSYM 0 4 00000004 680 ld:V(0,3)
2273 File: stabs.info, Node: Cplusplus, Next: Stab Types, Prev: Symbol Tables, Up: Top
2280 * Class Names:: C++ class names are both tags and typedefs.
2281 * Nested Symbols:: C++ symbol names can be within other types.
2282 * Basic Cplusplus Types::
2285 * Methods:: Method definition
2286 * Method Type Descriptor:: The `#' type descriptor
2287 * Member Type Descriptor:: The `@' type descriptor
2289 * Method Modifiers::
2292 * Virtual Base Classes::
2296 File: stabs.info, Node: Class Names, Next: Nested Symbols, Up: Cplusplus
2301 In C++, a class name which is declared with `class', `struct', or
2302 `union', is not only a tag, as in C, but also a type name. Thus there
2303 should be stabs with both `t' and `T' symbol descriptors (*note
2306 To save space, there is a special abbreviation for this case. If the
2307 `T' symbol descriptor is followed by `t', then the stab defines both a
2308 type name and a tag.
2310 For example, the C++ code
2312 struct foo {int x;};
2314 can be represented as either
2316 .stabs "foo:T19=s4x:1,0,32;;",128,0,0,0 # 128 is N_LSYM
2317 .stabs "foo:t19",128,0,0,0
2321 .stabs "foo:Tt19=s4x:1,0,32;;",128,0,0,0
2324 File: stabs.info, Node: Nested Symbols, Next: Basic Cplusplus Types, Prev: Class Names, Up: Cplusplus
2326 7.2 Defining a Symbol Within Another Type
2327 =========================================
2329 In C++, a symbol (such as a type name) can be defined within another
2332 In stabs, this is sometimes represented by making the name of a
2333 symbol which contains `::'. Such a pair of colons does not end the name
2334 of the symbol, the way a single colon would (*note String Field::). I'm
2335 not sure how consistently used or well thought out this mechanism is.
2336 So that a pair of colons in this position always has this meaning, `:'
2337 cannot be used as a symbol descriptor.
2339 For example, if the string for a stab is `foo::bar::baz:t5=*6', then
2340 `foo::bar::baz' is the name of the symbol, `t' is the symbol
2341 descriptor, and `5=*6' is the type information.
2344 File: stabs.info, Node: Basic Cplusplus Types, Next: Simple Classes, Prev: Nested Symbols, Up: Cplusplus
2346 7.3 Basic Types For C++
2347 =======================
2349 << the examples that follow are based on a01.C >>
2351 C++ adds two more builtin types to the set defined for C. These are
2352 the unknown type and the vtable record type. The unknown type, type
2353 16, is defined in terms of itself like the void type.
2355 The vtable record type, type 17, is defined as a structure type and
2356 then as a structure tag. The structure has four fields: delta, index,
2357 pfn, and delta2. pfn is the function pointer.
2359 << In boilerplate $vtbl_ptr_type, what are the fields delta, index,
2360 and delta2 used for? >>
2362 This basic type is present in all C++ programs even if there are no
2363 virtual methods defined.
2365 .stabs "struct_name:sym_desc(type)type_def(17)=type_desc(struct)struct_bytes(8)
2366 elem_name(delta):type_ref(short int),bit_offset(0),field_bits(16);
2367 elem_name(index):type_ref(short int),bit_offset(16),field_bits(16);
2368 elem_name(pfn):type_def(18)=type_desc(ptr to)type_ref(void),
2369 bit_offset(32),field_bits(32);
2370 elem_name(delta2):type_def(short int);bit_offset(32),field_bits(16);;"
2373 .stabs "$vtbl_ptr_type:t17=s8
2374 delta:6,0,16;index:6,16,16;pfn:18=*15,32,32;delta2:6,32,16;;"
2377 .stabs "name:sym_dec(struct tag)type_ref($vtbl_ptr_type)",N_LSYM,NIL,NIL,NIL
2379 .stabs "$vtbl_ptr_type:T17",128,0,0,0
2382 File: stabs.info, Node: Simple Classes, Next: Class Instance, Prev: Basic Cplusplus Types, Up: Cplusplus
2384 7.4 Simple Class Definition
2385 ===========================
2387 The stabs describing C++ language features are an extension of the
2388 stabs describing C. Stabs representing C++ class types elaborate
2389 extensively on the stab format used to describe structure types in C.
2390 Stabs representing class type variables look just like stabs
2391 representing C language variables.
2393 Consider the following very simple class definition.
2398 int Ameth(int in, char other);
2401 The class `baseA' is represented by two stabs. The first stab
2402 describes the class as a structure type. The second stab describes a
2403 structure tag of the class type. Both stabs are of stab type `N_LSYM'.
2404 Since the stab is not located between an `N_FUN' and an `N_LBRAC' stab
2405 this indicates that the class is defined at file scope. If it were,
2406 then the `N_LSYM' would signify a local variable.
2408 A stab describing a C++ class type is similar in format to a stab
2409 describing a C struct, with each class member shown as a field in the
2410 structure. The part of the struct format describing fields is expanded
2411 to include extra information relevant to C++ class members. In
2412 addition, if the class has multiple base classes or virtual functions
2413 the struct format outside of the field parts is also augmented.
2415 In this simple example the field part of the C++ class stab
2416 representing member data looks just like the field part of a C struct
2417 stab. The section on protections describes how its format is sometimes
2418 extended for member data.
2420 The field part of a C++ class stab representing a member function
2421 differs substantially from the field part of a C struct stab. It still
2422 begins with `name:' but then goes on to define a new type number for
2423 the member function, describe its return type, its argument types, its
2424 protection level, any qualifiers applied to the method definition, and
2425 whether the method is virtual or not. If the method is virtual then
2426 the method description goes on to give the vtable index of the method,
2427 and the type number of the first base class defining the method.
2429 When the field name is a method name it is followed by two colons
2430 rather than one. This is followed by a new type definition for the
2431 method. This is a number followed by an equal sign and the type of the
2432 method. Normally this will be a type declared using the `#' type
2433 descriptor; see *Note Method Type Descriptor::; static member functions
2434 are declared using the `f' type descriptor instead; see *Note Function
2437 The format of an overloaded operator method name differs from that of
2438 other methods. It is `op$::OPERATOR-NAME.' where OPERATOR-NAME is the
2439 operator name such as `+' or `+='. The name ends with a period, and
2440 any characters except the period can occur in the OPERATOR-NAME string.
2442 The next part of the method description represents the arguments to
2443 the method, preceded by a colon and ending with a semi-colon. The
2444 types of the arguments are expressed in the same way argument types are
2445 expressed in C++ name mangling. In this example an `int' and a `char'
2448 This is followed by a number, a letter, and an asterisk or period,
2449 followed by another semicolon. The number indicates the protections
2450 that apply to the member function. Here the 2 means public. The
2451 letter encodes any qualifier applied to the method definition. In this
2452 case, `A' means that it is a normal function definition. The dot shows
2453 that the method is not virtual. The sections that follow elaborate
2454 further on these fields and describe the additional information present
2455 for virtual methods.
2457 .stabs "class_name:sym_desc(type)type_def(20)=type_desc(struct)struct_bytes(4)
2458 field_name(Adat):type(int),bit_offset(0),field_bits(32);
2460 method_name(Ameth)::type_def(21)=type_desc(method)return_type(int);
2461 :arg_types(int char);
2462 protection(public)qualifier(normal)virtual(no);;"
2465 .stabs "baseA:t20=s4Adat:1,0,32;Ameth::21=##1;:ic;2A.;;",128,0,0,0
2467 .stabs "class_name:sym_desc(struct tag)",N_LSYM,NIL,NIL,NIL
2469 .stabs "baseA:T20",128,0,0,0
2472 File: stabs.info, Node: Class Instance, Next: Methods, Prev: Simple Classes, Up: Cplusplus
2477 As shown above, describing even a simple C++ class definition is
2478 accomplished by massively extending the stab format used in C to
2479 describe structure types. However, once the class is defined, C stabs
2480 with no modifications can be used to describe class instances. The
2487 yields the following stab describing the class instance. It looks no
2488 different from a standard C stab describing a local variable.
2490 .stabs "name:type_ref(baseA)", N_LSYM, NIL, NIL, frame_ptr_offset
2492 .stabs "AbaseA:20",128,0,0,-20
2495 File: stabs.info, Node: Methods, Next: Method Type Descriptor, Prev: Class Instance, Up: Cplusplus
2497 7.6 Method Definition
2498 =====================
2500 The class definition shown above declares Ameth. The C++ source below
2504 baseA::Ameth(int in, char other)
2509 This method definition yields three stabs following the code of the
2510 method. One stab describes the method itself and following two describe
2511 its parameters. Although there is only one formal argument all methods
2512 have an implicit argument which is the `this' pointer. The `this'
2513 pointer is a pointer to the object on which the method was called. Note
2514 that the method name is mangled to encode the class name and argument
2515 types. Name mangling is described in the ARM (`The Annotated C++
2516 Reference Manual', by Ellis and Stroustrup, ISBN 0-201-51459-1);
2517 `gpcompare.texi' in Cygnus GCC distributions describes the differences
2518 between GNU mangling and ARM mangling.
2520 .stabs "name:symbol_descriptor(global function)return_type(int)",
2521 N_FUN, NIL, NIL, code_addr_of_method_start
2523 .stabs "Ameth__5baseAic:F1",36,0,0,_Ameth__5baseAic
2525 Here is the stab for the `this' pointer implicit argument. The name
2526 of the `this' pointer is always `this'. Type 19, the `this' pointer is
2527 defined as a pointer to type 20, `baseA', but a stab defining `baseA'
2528 has not yet been emitted. Since the compiler knows it will be emitted
2529 shortly, here it just outputs a cross reference to the undefined
2530 symbol, by prefixing the symbol name with `xs'.
2532 .stabs "name:sym_desc(register param)type_def(19)=
2533 type_desc(ptr to)type_ref(baseA)=
2534 type_desc(cross-reference to)baseA:",N_RSYM,NIL,NIL,register_number
2536 .stabs "this:P19=*20=xsbaseA:",64,0,0,8
2538 The stab for the explicit integer argument looks just like a
2539 parameter to a C function. The last field of the stab is the offset
2540 from the argument pointer, which in most systems is the same as the
2543 .stabs "name:sym_desc(value parameter)type_ref(int)",
2544 N_PSYM,NIL,NIL,offset_from_arg_ptr
2546 .stabs "in:p1",160,0,0,72
2548 << The examples that follow are based on A1.C >>
2551 File: stabs.info, Node: Method Type Descriptor, Next: Member Type Descriptor, Prev: Methods, Up: Cplusplus
2553 7.7 The `#' Type Descriptor
2554 ===========================
2556 This is used to describe a class method. This is a function which takes
2557 an extra argument as its first argument, for the `this' pointer.
2559 If the `#' is immediately followed by another `#', the second one
2560 will be followed by the return type and a semicolon. The class and
2561 argument types are not specified, and must be determined by demangling
2562 the name of the method if it is available.
2564 Otherwise, the single `#' is followed by the class type, a comma,
2565 the return type, a comma, and zero or more parameter types separated by
2566 commas. The list of arguments is terminated by a semicolon. In the
2567 debugging output generated by gcc, a final argument type of `void'
2568 indicates a method which does not take a variable number of arguments.
2569 If the final argument type of `void' does not appear, the method was
2570 declared with an ellipsis.
2572 Note that although such a type will normally be used to describe
2573 fields in structures, unions, or classes, for at least some versions of
2574 the compiler it can also be used in other contexts.
2577 File: stabs.info, Node: Member Type Descriptor, Next: Protections, Prev: Method Type Descriptor, Up: Cplusplus
2579 7.8 The `@' Type Descriptor
2580 ===========================
2582 The `@' type descriptor is used together with the `*' type descriptor
2583 for a pointer-to-non-static-member-data type. It is followed by type
2584 information for the class (or union), a comma, and type information for
2587 The following C++ source:
2589 typedef int A::*int_in_a;
2591 generates the following stab:
2593 .stabs "int_in_a:t20=*21=@19,1",128,0,0,0
2595 Note that there is a conflict between this and type attributes
2596 (*note String Field::); both use type descriptor `@'. Fortunately, the
2597 `@' type descriptor used in this C++ sense always will be followed by a
2598 digit, `(', or `-', and type attributes never start with those things.
2601 File: stabs.info, Node: Protections, Next: Method Modifiers, Prev: Member Type Descriptor, Up: Cplusplus
2606 In the simple class definition shown above all member data and
2607 functions were publicly accessible. The example that follows contrasts
2608 public, protected and privately accessible fields and shows how these
2609 protections are encoded in C++ stabs.
2611 If the character following the `FIELD-NAME:' part of the string is
2612 `/', then the next character is the visibility. `0' means private, `1'
2613 means protected, and `2' means public. Debuggers should ignore
2614 visibility characters they do not recognize, and assume a reasonable
2615 default (such as public) (GDB 4.11 does not, but this should be fixed
2616 in the next GDB release). If no visibility is specified the field is
2617 public. The visibility `9' means that the field has been optimized out
2618 and is public (there is no way to specify an optimized out field with a
2619 private or protected visibility). Visibility `9' is not supported by
2620 GDB 4.11; this should be fixed in the next GDB release.
2622 The following C++ source:
2633 generates the following stab:
2636 .stabs "vis:T19=s12priv:/01,0,32;prot:/12,32,8;pub:12,64,32;;",128,0,0,0
2638 `vis:T19=s12' indicates that type number 19 is a 12 byte structure
2639 named `vis' The `priv' field has public visibility (`/0'), type int
2640 (`1'), and offset and size `,0,32;'. The `prot' field has protected
2641 visibility (`/1'), type char (`2') and offset and size `,32,8;'. The
2642 `pub' field has type float (`12'), and offset and size `,64,32;'.
2644 Protections for member functions are signified by one digit embedded
2645 in the field part of the stab describing the method. The digit is 0 if
2646 private, 1 if protected and 2 if public. Consider the C++ class
2651 int priv_meth(int in){return in;};
2653 char protMeth(char in){return in;};
2655 float pubMeth(float in){return in;};
2658 It generates the following stab. The digit in question is to the
2659 left of an `A' in each case. Notice also that in this case two symbol
2660 descriptors apply to the class name struct tag and struct type.
2662 .stabs "class_name:sym_desc(struct tag&type)type_def(21)=
2663 sym_desc(struct)struct_bytes(1)
2664 meth_name::type_def(22)=sym_desc(method)returning(int);
2665 :args(int);protection(private)modifier(normal)virtual(no);
2666 meth_name::type_def(23)=sym_desc(method)returning(char);
2667 :args(char);protection(protected)modifier(normal)virtual(no);
2668 meth_name::type_def(24)=sym_desc(method)returning(float);
2669 :args(float);protection(public)modifier(normal)virtual(no);;",
2672 .stabs "all_methods:Tt21=s1priv_meth::22=##1;:i;0A.;protMeth::23=##2;:c;1A.;
2673 pubMeth::24=##12;:f;2A.;;",128,0,0,0
2676 File: stabs.info, Node: Method Modifiers, Next: Virtual Methods, Prev: Protections, Up: Cplusplus
2678 7.10 Method Modifiers (`const', `volatile', `const volatile')
2679 =============================================================
2683 In the class example described above all the methods have the normal
2684 modifier. This method modifier information is located just after the
2685 protection information for the method. This field has four possible
2686 character values. Normal methods use `A', const methods use `B',
2687 volatile methods use `C', and const volatile methods use `D'. Consider
2688 the class definition below:
2692 int ConstMeth (int arg) const { return arg; };
2693 char VolatileMeth (char arg) volatile { return arg; };
2694 float ConstVolMeth (float arg) const volatile {return arg; };
2697 This class is described by the following stab:
2699 .stabs "class(A):sym_desc(struct)type_def(20)=type_desc(struct)struct_bytes(1)
2700 meth_name(ConstMeth)::type_def(21)sym_desc(method)
2701 returning(int);:arg(int);protection(public)modifier(const)virtual(no);
2702 meth_name(VolatileMeth)::type_def(22)=sym_desc(method)
2703 returning(char);:arg(char);protection(public)modifier(volatile)virt(no)
2704 meth_name(ConstVolMeth)::type_def(23)=sym_desc(method)
2705 returning(float);:arg(float);protection(public)modifier(const volatile)
2708 .stabs "A:T20=s1ConstMeth::21=##1;:i;2B.;VolatileMeth::22=##2;:c;2C.;
2709 ConstVolMeth::23=##12;:f;2D.;;",128,0,0,0
2712 File: stabs.info, Node: Virtual Methods, Next: Inheritance, Prev: Method Modifiers, Up: Cplusplus
2714 7.11 Virtual Methods
2715 ====================
2717 << The following examples are based on a4.C >>
2719 The presence of virtual methods in a class definition adds additional
2720 data to the class description. The extra data is appended to the
2721 description of the virtual method and to the end of the class
2722 description. Consider the class definition below:
2727 virtual int A_virt (int arg) { return arg; };
2730 This results in the stab below describing class A. It defines a new
2731 type (20) which is an 8 byte structure. The first field of the class
2732 struct is `Adat', an integer, starting at structure offset 0 and
2735 The second field in the class struct is not explicitly defined by the
2736 C++ class definition but is implied by the fact that the class contains
2737 a virtual method. This field is the vtable pointer. The name of the
2738 vtable pointer field starts with `$vf' and continues with a type
2739 reference to the class it is part of. In this example the type
2740 reference for class A is 20 so the name of its vtable pointer field is
2741 `$vf20', followed by the usual colon.
2743 Next there is a type definition for the vtable pointer type (21).
2744 This is in turn defined as a pointer to another new type (22).
2746 Type 22 is the vtable itself, which is defined as an array, indexed
2747 by a range of integers between 0 and 1, and whose elements are of type
2748 17. Type 17 was the vtable record type defined by the boilerplate C++
2749 type definitions, as shown earlier.
2751 The bit offset of the vtable pointer field is 32. The number of bits
2752 in the field are not specified when the field is a vtable pointer.
2754 Next is the method definition for the virtual member function
2755 `A_virt'. Its description starts out using the same format as the
2756 non-virtual member functions described above, except instead of a dot
2757 after the `A' there is an asterisk, indicating that the function is
2758 virtual. Since is is virtual some addition information is appended to
2759 the end of the method description.
2761 The first number represents the vtable index of the method. This is
2762 a 32 bit unsigned number with the high bit set, followed by a
2765 The second number is a type reference to the first base class in the
2766 inheritance hierarchy defining the virtual member function. In this
2767 case the class stab describes a base class so the virtual function is
2768 not overriding any other definition of the method. Therefore the
2769 reference is to the type number of the class that the stab is
2772 This is followed by three semi-colons. One marks the end of the
2773 current sub-section, one marks the end of the method field, and the
2774 third marks the end of the struct definition.
2776 For classes containing virtual functions the very last section of the
2777 string part of the stab holds a type reference to the first base class.
2778 This is preceded by `~%' and followed by a final semi-colon.
2780 .stabs "class_name(A):type_def(20)=sym_desc(struct)struct_bytes(8)
2781 field_name(Adat):type_ref(int),bit_offset(0),field_bits(32);
2782 field_name(A virt func ptr):type_def(21)=type_desc(ptr to)type_def(22)=
2783 sym_desc(array)index_type_ref(range of int from 0 to 1);
2784 elem_type_ref(vtbl elem type),
2786 meth_name(A_virt)::typedef(23)=sym_desc(method)returning(int);
2787 :arg_type(int),protection(public)normal(yes)virtual(yes)
2788 vtable_index(1);class_first_defining(A);;;~%first_base(A);",
2791 .stabs "A:t20=s8Adat:1,0,32;$vf20:21=*22=ar1;0;1;17,32;
2792 A_virt::23=##1;:i;2A*-2147483647;20;;;~%20;",128,0,0,0
2795 File: stabs.info, Node: Inheritance, Next: Virtual Base Classes, Prev: Virtual Methods, Up: Cplusplus
2800 Stabs describing C++ derived classes include additional sections that
2801 describe the inheritance hierarchy of the class. A derived class stab
2802 also encodes the number of base classes. For each base class it tells
2803 if the base class is virtual or not, and if the inheritance is private
2804 or public. It also gives the offset into the object of the portion of
2805 the object corresponding to each base class.
2807 This additional information is embedded in the class stab following
2808 the number of bytes in the struct. First the number of base classes
2809 appears bracketed by an exclamation point and a comma.
2811 Then for each base type there repeats a series: a virtual character,
2812 a visibility character, a number, a comma, another number, and a
2815 The virtual character is `1' if the base class is virtual and `0' if
2816 not. The visibility character is `2' if the derivation is public, `1'
2817 if it is protected, and `0' if it is private. Debuggers should ignore
2818 virtual or visibility characters they do not recognize, and assume a
2819 reasonable default (such as public and non-virtual) (GDB 4.11 does not,
2820 but this should be fixed in the next GDB release).
2822 The number following the virtual and visibility characters is the
2823 offset from the start of the object to the part of the object
2824 pertaining to the base class.
2826 After the comma, the second number is a type_descriptor for the base
2827 type. Finally a semi-colon ends the series, which repeats for each
2830 The source below defines three base classes `A', `B', and `C' and
2831 the derived class `D'.
2836 virtual int A_virt (int arg) { return arg; };
2842 virtual int B_virt (int arg) {return arg; };
2848 virtual int C_virt (int arg) {return arg; };
2851 class D : A, virtual B, public C {
2854 virtual int A_virt (int arg ) { return arg+1; };
2855 virtual int B_virt (int arg) { return arg+2; };
2856 virtual int C_virt (int arg) { return arg+3; };
2857 virtual int D_virt (int arg) { return arg; };
2860 Class stabs similar to the ones described earlier are generated for
2863 .stabs "A:T20=s8Adat:1,0,32;$vf20:21=*22=ar1;0;1;17,32;
2864 A_virt::23=##1;:i;2A*-2147483647;20;;;~%20;",128,0,0,0
2866 .stabs "B:Tt25=s8Bdat:1,0,32;$vf25:21,32;B_virt::26=##1;
2867 :i;2A*-2147483647;25;;;~%25;",128,0,0,0
2869 .stabs "C:Tt28=s8Cdat:1,0,32;$vf28:21,32;C_virt::29=##1;
2870 :i;2A*-2147483647;28;;;~%28;",128,0,0,0
2872 In the stab describing derived class `D' below, the information about
2873 the derivation of this class is encoded as follows.
2875 .stabs "derived_class_name:symbol_descriptors(struct tag&type)=
2876 type_descriptor(struct)struct_bytes(32)!num_bases(3),
2877 base_virtual(no)inheritance_public(no)base_offset(0),
2878 base_class_type_ref(A);
2879 base_virtual(yes)inheritance_public(no)base_offset(NIL),
2880 base_class_type_ref(B);
2881 base_virtual(no)inheritance_public(yes)base_offset(64),
2882 base_class_type_ref(C); ...
2884 .stabs "D:Tt31=s32!3,000,20;100,25;0264,28;$vb25:24,128;Ddat:
2885 1,160,32;A_virt::32=##1;:i;2A*-2147483647;20;;B_virt:
2886 :32:i;2A*-2147483647;25;;C_virt::32:i;2A*-2147483647;
2887 28;;D_virt::32:i;2A*-2147483646;31;;;~%20;",128,0,0,0
2890 File: stabs.info, Node: Virtual Base Classes, Next: Static Members, Prev: Inheritance, Up: Cplusplus
2892 7.13 Virtual Base Classes
2893 =========================
2895 A derived class object consists of a concatenation in memory of the data
2896 areas defined by each base class, starting with the leftmost and ending
2897 with the rightmost in the list of base classes. The exception to this
2898 rule is for virtual inheritance. In the example above, class `D'
2899 inherits virtually from base class `B'. This means that an instance of
2900 a `D' object will not contain its own `B' part but merely a pointer to
2901 a `B' part, known as a virtual base pointer.
2903 In a derived class stab, the base offset part of the derivation
2904 information, described above, shows how the base class parts are
2905 ordered. The base offset for a virtual base class is always given as 0.
2906 Notice that the base offset for `B' is given as 0 even though `B' is
2907 not the first base class. The first base class `A' starts at offset 0.
2909 The field information part of the stab for class `D' describes the
2910 field which is the pointer to the virtual base class `B'. The vbase
2911 pointer name is `$vb' followed by a type reference to the virtual base
2912 class. Since the type id for `B' in this example is 25, the vbase
2913 pointer name is `$vb25'.
2915 .stabs "D:Tt31=s32!3,000,20;100,25;0264,28;$vb25:24,128;Ddat:1,
2916 160,32;A_virt::32=##1;:i;2A*-2147483647;20;;B_virt::32:i;
2917 2A*-2147483647;25;;C_virt::32:i;2A*-2147483647;28;;D_virt:
2918 :32:i;2A*-2147483646;31;;;~%20;",128,0,0,0
2920 Following the name and a semicolon is a type reference describing the
2921 type of the virtual base class pointer, in this case 24. Type 24 was
2922 defined earlier as the type of the `B' class `this' pointer. The
2923 `this' pointer for a class is a pointer to the class type.
2925 .stabs "this:P24=*25=xsB:",64,0,0,8
2927 Finally the field offset part of the vbase pointer field description
2928 shows that the vbase pointer is the first field in the `D' object,
2929 before any data fields defined by the class. The layout of a `D' class
2930 object is a follows, `Adat' at 0, the vtable pointer for `A' at 32,
2931 `Cdat' at 64, the vtable pointer for C at 96, the virtual base pointer
2932 for `B' at 128, and `Ddat' at 160.
2935 File: stabs.info, Node: Static Members, Prev: Virtual Base Classes, Up: Cplusplus
2940 The data area for a class is a concatenation of the space used by the
2941 data members of the class. If the class has virtual methods, a vtable
2942 pointer follows the class data. The field offset part of each field
2943 description in the class stab shows this ordering.
2945 << How is this reflected in stabs? See Cygnus bug #677 for some
2949 File: stabs.info, Node: Stab Types, Next: Symbol Descriptors, Prev: Cplusplus, Up: Top
2951 Appendix A Table of Stab Types
2952 ******************************
2954 The following are all the possible values for the stab type field, for
2955 a.out files, in numeric order. This does not apply to XCOFF, but it
2956 does apply to stabs in sections (*note Stab Sections::). Stabs in
2957 ECOFF use these values but add 0x8f300 to distinguish them from non-stab
2960 The symbolic names are defined in the file `include/aout/stabs.def'.
2964 * Non-Stab Symbol Types:: Types from 0 to 0x1f
2965 * Stab Symbol Types:: Types from 0x20 to 0xff
2968 File: stabs.info, Node: Non-Stab Symbol Types, Next: Stab Symbol Types, Up: Stab Types
2970 A.1 Non-Stab Symbol Types
2971 =========================
2973 The following types are used by the linker and assembler, not by stab
2974 directives. Since this document does not attempt to describe aspects of
2975 object file format other than the debugging format, no details are
2982 File scope absolute symbol
2985 External absolute symbol
2988 File scope text symbol
2990 `0x5 N_TEXT | N_EXT'
2991 External text symbol
2994 File scope data symbol
2996 `0x7 N_DATA | N_EXT'
2997 External data symbol
3000 File scope BSS symbol
3006 Same as `N_FN', for Sequent compilers
3009 Symbol is indirected to another symbol
3012 Common--visible after shared library dynamic link
3015 `0x15 N_SETA | N_EXT'
3016 Absolute set element
3019 `0x17 N_SETT | N_EXT'
3020 Text segment set element
3023 `0x19 N_SETD | N_EXT'
3024 Data segment set element
3027 `0x1b N_SETB | N_EXT'
3028 BSS segment set element
3031 `0x1d N_SETV | N_EXT'
3032 Pointer to set vector
3035 Print a warning message during linking
3038 File name of a `.o' file
3041 File: stabs.info, Node: Stab Symbol Types, Prev: Non-Stab Symbol Types, Up: Stab Types
3043 A.2 Stab Symbol Types
3044 =====================
3046 The following symbol types indicate that this is a stab. This is the
3047 full list of stab numbers, including stab types that are used in
3048 languages other than C.
3051 Global symbol; see *Note Global Variables::.
3054 Function name (for BSD Fortran); see *Note Procedures::.
3057 Function name (*note Procedures::) or text segment variable (*note
3061 Data segment file-scope variable; see *Note Statics::.
3064 BSS segment file-scope variable; see *Note Statics::.
3067 Name of main routine; see *Note Main Program::.
3070 Variable in `.rodata' section; see *Note Statics::.
3073 Global symbol (for Pascal); see *Note N_PC::.
3076 Number of symbols (according to Ultrix V4.0); see *Note N_NSYMS::.
3079 No DST map; see *Note N_NOMAP::.
3082 Object file (Solaris2).
3085 Debugger options (Solaris2).
3088 Register variable; see *Note Register Variables::.
3091 Modula-2 compilation unit; see *Note N_M2C::.
3094 Line number in text segment; see *Note Line Numbers::.
3097 Line number in data segment; see *Note Line Numbers::.
3100 Line number in bss segment; see *Note Line Numbers::.
3103 Sun source code browser, path to `.cb' file; see *Note N_BROWS::.
3106 GNU Modula2 definition module dependency; see *Note N_DEFD::.
3109 Function start/body/end line numbers (Solaris2).
3112 GNU C++ exception variable; see *Note N_EHDECL::.
3115 Modula2 info "for imc" (according to Ultrix V4.0); see *Note
3119 GNU C++ `catch' clause; see *Note N_CATCH::.
3122 Structure of union element; see *Note N_SSYM::.
3125 Last stab for module (Solaris2).
3128 Path and name of source file; see *Note Source Files::.
3131 Stack variable (*note Stack Variables::) or type (*note
3135 Beginning of an include file (Sun only); see *Note Include Files::.
3138 Name of include file; see *Note Include Files::.
3141 Parameter variable; see *Note Parameters::.
3144 End of an include file; see *Note Include Files::.
3147 Alternate entry point; see *Note Alternate Entry Points::.
3150 Beginning of a lexical block; see *Note Block Structure::.
3153 Place holder for a deleted include file; see *Note Include Files::.
3156 Modula2 scope information (Sun linker); see *Note N_SCOPE::.
3159 End of a lexical block; see *Note Block Structure::.
3162 Begin named common block; see *Note Common Blocks::.
3165 End named common block; see *Note Common Blocks::.
3168 Member of a common block; see *Note Common Blocks::.
3171 Pascal `with' statement: type,,0,0,offset (Solaris2).
3174 Gould non-base registers; see *Note Gould::.
3177 Gould non-base registers; see *Note Gould::.
3180 Gould non-base registers; see *Note Gould::.
3183 Gould non-base registers; see *Note Gould::.
3186 Gould non-base registers; see *Note Gould::.
3189 File: stabs.info, Node: Symbol Descriptors, Next: Type Descriptors, Prev: Stab Types, Up: Top
3191 Appendix B Table of Symbol Descriptors
3192 **************************************
3194 The symbol descriptor is the character which follows the colon in many
3195 stabs, and which tells what kind of stab it is. *Note String Field::,
3196 for more information about their use.
3201 Variable on the stack; see *Note Stack Variables::.
3204 C++ nested symbol; see *Note Nested Symbols::.
3207 Parameter passed by reference in register; see *Note Reference
3211 Based variable; see *Note Based Variables::.
3214 Constant; see *Note Constants::.
3217 Conformant array bound (Pascal, maybe other languages); *Note
3218 Conformant Arrays::. Name of a caught exception (GNU C++). These
3219 can be distinguished because the latter uses `N_CATCH' and the
3220 former uses another symbol type.
3223 Floating point register variable; see *Note Register Variables::.
3226 Parameter in floating point register; see *Note Register
3230 File scope function; see *Note Procedures::.
3233 Global function; see *Note Procedures::.
3236 Global variable; see *Note Global Variables::.
3239 *Note Register Parameters::.
3242 Internal (nested) procedure; see *Note Nested Procedures::.
3245 Internal (nested) function; see *Note Nested Procedures::.
3248 Label name (documented by AIX, no further information known).
3251 Module; see *Note Procedures::.
3254 Argument list parameter; see *Note Parameters::.
3260 Fortran Function parameter; see *Note Parameters::.
3263 Unfortunately, three separate meanings have been independently
3264 invented for this symbol descriptor. At least the GNU and Sun
3265 uses can be distinguished by the symbol type. Global Procedure
3266 (AIX) (symbol type used unknown); see *Note Procedures::.
3267 Register parameter (GNU) (symbol type `N_PSYM'); see *Note
3268 Parameters::. Prototype of function referenced by this file (Sun
3269 `acc') (symbol type `N_FUN').
3272 Static Procedure; see *Note Procedures::.
3275 Register parameter; see *Note Register Parameters::.
3278 Register variable; see *Note Register Variables::.
3281 File scope variable; see *Note Statics::.
3284 Local variable (OS9000).
3287 Type name; see *Note Typedefs::.
3290 Enumeration, structure, or union tag; see *Note Typedefs::.
3293 Parameter passed by reference; see *Note Reference Parameters::.
3296 Procedure scope static variable; see *Note Statics::.
3299 Conformant array; see *Note Conformant Arrays::.
3302 Function return variable; see *Note Parameters::.
3305 File: stabs.info, Node: Type Descriptors, Next: Expanded Reference, Prev: Symbol Descriptors, Up: Top
3307 Appendix C Table of Type Descriptors
3308 ************************************
3310 The type descriptor is the character which follows the type number and
3311 an equals sign. It specifies what kind of type is being defined.
3312 *Note String Field::, for more information about their use.
3316 Type reference; see *Note String Field::.
3319 Reference to builtin type; see *Note Negative Type Numbers::.
3322 Method (C++); see *Note Method Type Descriptor::.
3325 Pointer; see *Note Miscellaneous Types::.
3331 Type Attributes (AIX); see *Note String Field::. Member (class
3332 and variable) type (GNU C++); see *Note Member Type Descriptor::.
3335 Array; see *Note Arrays::.
3338 Open array; see *Note Arrays::.
3341 Pascal space type (AIX); see *Note Miscellaneous Types::. Builtin
3342 integer type (Sun); see *Note Builtin Type Descriptors::. Const
3343 and volatile qualified type (OS9000).
3346 Volatile-qualified type; see *Note Miscellaneous Types::.
3349 Complex builtin type (AIX); see *Note Builtin Type Descriptors::.
3350 Const-qualified type (OS9000).
3353 COBOL Picture type. See AIX documentation for details.
3356 File type; see *Note Miscellaneous Types::.
3359 N-dimensional dynamic array; see *Note Arrays::.
3362 Enumeration type; see *Note Enumerations::.
3365 N-dimensional subarray; see *Note Arrays::.
3368 Function type; see *Note Function Types::.
3371 Pascal function parameter; see *Note Function Types::
3374 Builtin floating point type; see *Note Builtin Type Descriptors::.
3377 COBOL Group. See AIX documentation for details.
3380 Imported type (AIX); see *Note Cross-References::.
3381 Volatile-qualified type (OS9000).
3384 Const-qualified type; see *Note Miscellaneous Types::.
3387 COBOL File Descriptor. See AIX documentation for details.
3390 Multiple instance type; see *Note Miscellaneous Types::.
3393 String type; see *Note Strings::.
3396 Stringptr; see *Note Strings::.
3399 Opaque type; see *Note Typedefs::.
3402 Procedure; see *Note Function Types::.
3405 Packed array; see *Note Arrays::.
3408 Range type; see *Note Subranges::.
3411 Builtin floating type; see *Note Builtin Type Descriptors:: (Sun).
3412 Pascal subroutine parameter; see *Note Function Types:: (AIX).
3413 Detecting this conflict is possible with careful parsing (hint: a
3414 Pascal subroutine parameter type will always contain a comma, and
3415 a builtin type descriptor never will).
3418 Structure type; see *Note Structures::.
3421 Set type; see *Note Miscellaneous Types::.
3424 Union; see *Note Unions::.
3427 Variant record. This is a Pascal and Modula-2 feature which is
3428 like a union within a struct in C. See AIX documentation for
3432 Wide character; see *Note Builtin Type Descriptors::.
3435 Cross-reference; see *Note Cross-References::.
3438 Used by IBM's xlC C++ compiler (for structures, I think).
3441 gstring; see *Note Strings::.
3444 File: stabs.info, Node: Expanded Reference, Next: Questions, Prev: Type Descriptors, Up: Top
3446 Appendix D Expanded Reference by Stab Type
3447 ******************************************
3449 For a full list of stab types, and cross-references to where they are
3450 described, see *Note Stab Types::. This appendix just covers certain
3451 stabs which are not yet described in the main body of this document;
3452 eventually the information will all be in one place.
3456 The first line is the symbol type (see `include/aout/stab.def').
3458 The second line describes the language constructs the symbol type
3461 The third line is the stab format with the significant stab fields
3462 named and the rest NIL.
3464 Subsequent lines expand upon the meaning and possible values for each
3465 significant stab field.
3467 Finally, any further information.
3471 * N_PC:: Pascal global symbol
3472 * N_NSYMS:: Number of symbols
3473 * N_NOMAP:: No DST map
3474 * N_M2C:: Modula-2 compilation unit
3475 * N_BROWS:: Path to .cb file for Sun source code browser
3476 * N_DEFD:: GNU Modula2 definition module dependency
3477 * N_EHDECL:: GNU C++ exception variable
3478 * N_MOD2:: Modula2 information "for imc"
3479 * N_CATCH:: GNU C++ "catch" clause
3480 * N_SSYM:: Structure or union element
3481 * N_SCOPE:: Modula2 scope information (Sun only)
3482 * Gould:: non-base register symbols used on Gould systems
3483 * N_LENG:: Length of preceding entry
3486 File: stabs.info, Node: N_PC, Next: N_NSYMS, Up: Expanded Reference
3492 Global symbol (for Pascal).
3494 "name" -> "symbol_name" <<?>>
3495 value -> supposedly the line number (stab.def is skeptical)
3499 global pascal symbol: name,,0,subtype,line
3503 File: stabs.info, Node: N_NSYMS, Next: N_NOMAP, Prev: N_PC, Up: Expanded Reference
3508 -- `.stabn': N_NSYMS
3509 Number of symbols (according to Ultrix V4.0).
3511 0, files,,funcs,lines (stab.def)
3514 File: stabs.info, Node: N_NOMAP, Next: N_M2C, Prev: N_NSYMS, Up: Expanded Reference
3519 -- `.stabs': N_NOMAP
3520 No DST map for symbol (according to Ultrix V4.0). I think this
3521 means a variable has been optimized out.
3523 name, ,0,type,ignored (stab.def)
3526 File: stabs.info, Node: N_M2C, Next: N_BROWS, Prev: N_NOMAP, Up: Expanded Reference
3532 Modula-2 compilation unit.
3534 "string" -> "unit_name,unit_time_stamp[,code_time_stamp]"
3536 value -> 0 (main unit)
3539 See `Dbx and Dbxtool Interfaces', 2nd edition, by Sun, 1988, for
3544 File: stabs.info, Node: N_BROWS, Next: N_DEFD, Prev: N_M2C, Up: Expanded Reference
3549 -- `.stabs': N_BROWS
3550 Sun source code browser, path to `.cb' file
3552 <<?>> "path to associated `.cb' file"
3554 Note: N_BROWS has the same value as N_BSLINE.
3557 File: stabs.info, Node: N_DEFD, Next: N_EHDECL, Prev: N_BROWS, Up: Expanded Reference
3563 GNU Modula2 definition module dependency.
3565 GNU Modula-2 definition module dependency. The value is the
3566 modification time of the definition file. The other field is
3567 non-zero if it is imported with the GNU M2 keyword `%INITIALIZE'.
3568 Perhaps `N_M2C' can be used if there are enough empty fields?
3571 File: stabs.info, Node: N_EHDECL, Next: N_MOD2, Prev: N_DEFD, Up: Expanded Reference
3576 -- `.stabs': N_EHDECL
3577 GNU C++ exception variable <<?>>.
3579 "STRING is variable name"
3581 Note: conflicts with `N_MOD2'.
3584 File: stabs.info, Node: N_MOD2, Next: N_CATCH, Prev: N_EHDECL, Up: Expanded Reference
3590 Modula2 info "for imc" (according to Ultrix V4.0)
3592 Note: conflicts with `N_EHDECL' <<?>>
3595 File: stabs.info, Node: N_CATCH, Next: N_SSYM, Prev: N_MOD2, Up: Expanded Reference
3600 -- `.stabn': N_CATCH
3601 GNU C++ `catch' clause
3603 GNU C++ `catch' clause. The value is its address. The desc field
3604 is nonzero if this entry is immediately followed by a `CAUGHT' stab
3605 saying what exception was caught. Multiple `CAUGHT' stabs means
3606 that multiple exceptions can be caught here. If desc is 0, it
3607 means all exceptions are caught here.
3610 File: stabs.info, Node: N_SSYM, Next: N_SCOPE, Prev: N_CATCH, Up: Expanded Reference
3616 Structure or union element.
3618 The value is the offset in the structure.
3620 <<?looking at structs and unions in C I didn't see these>>
3623 File: stabs.info, Node: N_SCOPE, Next: Gould, Prev: N_SSYM, Up: Expanded Reference
3628 -- `.stab?': N_SCOPE
3629 Modula2 scope information (Sun linker) <<?>>
3632 File: stabs.info, Node: Gould, Next: N_LENG, Prev: N_SCOPE, Up: Expanded Reference
3634 D.12 Non-base registers on Gould systems
3635 ========================================
3637 -- `.stab?': N_NBTEXT
3638 -- `.stab?': N_NBDATA
3639 -- `.stab?': N_NBBSS
3640 -- `.stab?': N_NBSTS
3641 -- `.stab?': N_NBLCS
3642 These are used on Gould systems for non-base registers syms.
3644 However, the following values are not the values used by Gould;
3645 they are the values which GNU has been documenting for these
3646 values for a long time, without actually checking what Gould uses.
3647 I include these values only because perhaps some someone actually
3648 did something with the GNU information (I hope not, why GNU
3649 knowingly assigned wrong values to these in the header file is a
3650 complete mystery to me).
3652 240 0xf0 N_NBTEXT ??
3653 242 0xf2 N_NBDATA ??
3659 File: stabs.info, Node: N_LENG, Prev: Gould, Up: Expanded Reference
3665 Second symbol entry containing a length-value for the preceding
3666 entry. The value is the length.
3669 File: stabs.info, Node: Questions, Next: Stab Sections, Prev: Expanded Reference, Up: Top
3671 Appendix E Questions and Anomalies
3672 **********************************
3674 * For GNU C stabs defining local and global variables (`N_LSYM' and
3675 `N_GSYM'), the desc field is supposed to contain the source line
3676 number on which the variable is defined. In reality the desc
3677 field is always 0. (This behavior is defined in `dbxout.c' and
3678 putting a line number in desc is controlled by `#ifdef
3679 WINNING_GDB', which defaults to false). GDB supposedly uses this
3680 information if you say `list VAR'. In reality, VAR can be a
3681 variable defined in the program and GDB says `function VAR not
3684 * In GNU C stabs, there seems to be no way to differentiate tag
3685 types: structures, unions, and enums (symbol descriptor `T') and
3686 typedefs (symbol descriptor `t') defined at file scope from types
3687 defined locally to a procedure or other more local scope. They
3688 all use the `N_LSYM' stab type. Types defined at procedure scope
3689 are emitted after the `N_RBRAC' of the preceding function and
3690 before the code of the procedure in which they are defined. This
3691 is exactly the same as types defined in the source file between
3692 the two procedure bodies. GDB over-compensates by placing all
3693 types in block #1, the block for symbols of file scope. This is
3694 true for default, `-ansi' and `-traditional' compiler options.
3695 (Bugs gcc/1063, gdb/1066.)
3697 * What ends the procedure scope? Is it the proc block's `N_RBRAC'
3698 or the next `N_FUN'? (I believe its the first.)
3701 File: stabs.info, Node: Stab Sections, Next: Symbol Types Index, Prev: Questions, Up: Top
3703 Appendix F Using Stabs in Their Own Sections
3704 ********************************************
3706 Many object file formats allow tools to create object files with custom
3707 sections containing any arbitrary data. For any such object file
3708 format, stabs can be embedded in special sections. This is how stabs
3709 are used with ELF and SOM, and aside from ECOFF and XCOFF, is how stabs
3714 * Stab Section Basics:: How to embed stabs in sections
3715 * ELF Linker Relocation:: Sun ELF hacks
3718 File: stabs.info, Node: Stab Section Basics, Next: ELF Linker Relocation, Up: Stab Sections
3720 F.1 How to Embed Stabs in Sections
3721 ==================================
3723 The assembler creates two custom sections, a section named `.stab'
3724 which contains an array of fixed length structures, one struct per stab,
3725 and a section named `.stabstr' containing all the variable length
3726 strings that are referenced by stabs in the `.stab' section. The byte
3727 order of the stabs binary data depends on the object file format. For
3728 ELF, it matches the byte order of the ELF file itself, as determined
3729 from the `EI_DATA' field in the `e_ident' member of the ELF header.
3730 For SOM, it is always big-endian (is this true??? FIXME). For COFF, it
3731 matches the byte order of the COFF headers. The meaning of the fields
3732 is the same as for a.out (*note Symbol Table Format::), except that the
3733 `n_strx' field is relative to the strings for the current compilation
3734 unit (which can be found using the synthetic N_UNDF stab described
3735 below), rather than the entire string table.
3737 The first stab in the `.stab' section for each compilation unit is
3738 synthetic, generated entirely by the assembler, with no corresponding
3739 `.stab' directive as input to the assembler. This stab contains the
3743 Offset in the `.stabstr' section to the source filename.
3749 Unused field, always zero. This may eventually be used to hold
3750 overflows from the count in the `n_desc' field.
3753 Count of upcoming symbols, i.e., the number of remaining stabs for
3757 Size of the string table fragment associated with this source
3760 The `.stabstr' section always starts with a null byte (so that string
3761 offsets of zero reference a null string), followed by random length
3762 strings, each of which is null byte terminated.
3764 The ELF section header for the `.stab' section has its `sh_link'
3765 member set to the section number of the `.stabstr' section, and the
3766 `.stabstr' section has its ELF section header `sh_type' member set to
3767 `SHT_STRTAB' to mark it as a string table. SOM and COFF have no way of
3768 linking the sections together or marking them as string tables.
3770 For COFF, the `.stab' and `.stabstr' sections may be simply
3771 concatenated by the linker. GDB then uses the `n_desc' fields to
3772 figure out the extent of the original sections. Similarly, the
3773 `n_value' fields of the header symbols are added together in order to
3774 get the actual position of the strings in a desired `.stabstr' section.
3775 Although this design obviates any need for the linker to relocate or
3776 otherwise manipulate `.stab' and `.stabstr' sections, it also requires
3777 some care to ensure that the offsets are calculated correctly. For
3778 instance, if the linker were to pad in between the `.stabstr' sections
3779 before concatenating, then the offsets to strings in the middle of the
3780 executable's `.stabstr' section would be wrong.
3782 The GNU linker is able to optimize stabs information by merging
3783 duplicate strings and removing duplicate header file information (*note
3784 Include Files::). When some versions of the GNU linker optimize stabs
3785 in sections, they remove the leading `N_UNDF' symbol and arranges for
3786 all the `n_strx' fields to be relative to the start of the `.stabstr'
3790 File: stabs.info, Node: ELF Linker Relocation, Prev: Stab Section Basics, Up: Stab Sections
3792 F.2 Having the Linker Relocate Stabs in ELF
3793 ===========================================
3795 This section describes some Sun hacks for Stabs in ELF; it does not
3796 apply to COFF or SOM.
3798 To keep linking fast, you don't want the linker to have to relocate
3799 very many stabs. Making sure this is done for `N_SLINE', `N_RBRAC',
3800 and `N_LBRAC' stabs is the most important thing (see the descriptions
3801 of those stabs for more information). But Sun's stabs in ELF has taken
3802 this further, to make all addresses in the `n_value' field (functions
3803 and static variables) relative to the source file. For the `N_SO'
3804 symbol itself, Sun simply omits the address. To find the address of
3805 each section corresponding to a given source file, the compiler puts
3806 out symbols giving the address of each section for a given source file.
3807 Since these are ELF (not stab) symbols, the linker relocates them
3808 correctly without having to touch the stabs section. They are named
3809 `Bbss.bss' for the bss section, `Ddata.data' for the data section, and
3810 `Drodata.rodata' for the rodata section. For the text section, there
3811 is no such symbol (but there should be, see below). For an example of
3812 how these symbols work, *Note Stab Section Transformations::. GCC does
3813 not provide these symbols; it instead relies on the stabs getting
3814 relocated. Thus addresses which would normally be relative to
3815 `Bbss.bss', etc., are already relocated. The Sun linker provided with
3816 Solaris 2.2 and earlier relocates stabs using normal ELF relocation
3817 information, as it would do for any section. Sun has been threatening
3818 to kludge their linker to not do this (to speed up linking), even
3819 though the correct way to avoid having the linker do these relocations
3820 is to have the compiler no longer output relocatable values. Last I
3821 heard they had been talked out of the linker kludge. See Sun point
3822 patch 101052-01 and Sun bug 1142109. With the Sun compiler this
3823 affects `S' symbol descriptor stabs (*note Statics::) and functions
3824 (*note Procedures::). In the latter case, to adopt the clean solution
3825 (making the value of the stab relative to the start of the compilation
3826 unit), it would be necessary to invent a `Ttext.text' symbol, analogous
3827 to the `Bbss.bss', etc., symbols. I recommend this rather than using a
3828 zero value and getting the address from the ELF symbols.
3830 Finding the correct `Bbss.bss', etc., symbol is difficult, because
3831 the linker simply concatenates the `.stab' sections from each `.o' file
3832 without including any information about which part of a `.stab' section
3833 comes from which `.o' file. The way GDB does this is to look for an
3834 ELF `STT_FILE' symbol which has the same name as the last component of
3835 the file name from the `N_SO' symbol in the stabs (for example, if the
3836 file name is `../../gdb/main.c', it looks for an ELF `STT_FILE' symbol
3837 named `main.c'). This loses if different files have the same name
3838 (they could be in different directories, a library could have been
3839 copied from one system to another, etc.). It would be much cleaner to
3840 have the `Bbss.bss' symbols in the stabs themselves. Having the linker
3841 relocate them there is no more work than having the linker relocate ELF
3842 symbols, and it solves the problem of having to associate the ELF and
3843 stab symbols. However, no one has yet designed or implemented such a
3847 File: stabs.info, Node: GNU Free Documentation License, Prev: Symbol Types Index, Up: Top
3849 Appendix G GNU Free Documentation License
3850 *****************************************
3852 Version 1.2, November 2002
3854 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
3855 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
3857 Everyone is permitted to copy and distribute verbatim copies
3858 of this license document, but changing it is not allowed.
3862 The purpose of this License is to make a manual, textbook, or other
3863 functional and useful document "free" in the sense of freedom: to
3864 assure everyone the effective freedom to copy and redistribute it,
3865 with or without modifying it, either commercially or
3866 noncommercially. Secondarily, this License preserves for the
3867 author and publisher a way to get credit for their work, while not
3868 being considered responsible for modifications made by others.
3870 This License is a kind of "copyleft", which means that derivative
3871 works of the document must themselves be free in the same sense.
3872 It complements the GNU General Public License, which is a copyleft
3873 license designed for free software.
3875 We have designed this License in order to use it for manuals for
3876 free software, because free software needs free documentation: a
3877 free program should come with manuals providing the same freedoms
3878 that the software does. But this License is not limited to
3879 software manuals; it can be used for any textual work, regardless
3880 of subject matter or whether it is published as a printed book.
3881 We recommend this License principally for works whose purpose is
3882 instruction or reference.
3884 1. APPLICABILITY AND DEFINITIONS
3886 This License applies to any manual or other work, in any medium,
3887 that contains a notice placed by the copyright holder saying it
3888 can be distributed under the terms of this License. Such a notice
3889 grants a world-wide, royalty-free license, unlimited in duration,
3890 to use that work under the conditions stated herein. The
3891 "Document", below, refers to any such manual or work. Any member
3892 of the public is a licensee, and is addressed as "you". You
3893 accept the license if you copy, modify or distribute the work in a
3894 way requiring permission under copyright law.
3896 A "Modified Version" of the Document means any work containing the
3897 Document or a portion of it, either copied verbatim, or with
3898 modifications and/or translated into another language.
3900 A "Secondary Section" is a named appendix or a front-matter section
3901 of the Document that deals exclusively with the relationship of the
3902 publishers or authors of the Document to the Document's overall
3903 subject (or to related matters) and contains nothing that could
3904 fall directly within that overall subject. (Thus, if the Document
3905 is in part a textbook of mathematics, a Secondary Section may not
3906 explain any mathematics.) The relationship could be a matter of
3907 historical connection with the subject or with related matters, or
3908 of legal, commercial, philosophical, ethical or political position
3911 The "Invariant Sections" are certain Secondary Sections whose
3912 titles are designated, as being those of Invariant Sections, in
3913 the notice that says that the Document is released under this
3914 License. If a section does not fit the above definition of
3915 Secondary then it is not allowed to be designated as Invariant.
3916 The Document may contain zero Invariant Sections. If the Document
3917 does not identify any Invariant Sections then there are none.
3919 The "Cover Texts" are certain short passages of text that are
3920 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
3921 that says that the Document is released under this License. A
3922 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
3923 be at most 25 words.
3925 A "Transparent" copy of the Document means a machine-readable copy,
3926 represented in a format whose specification is available to the
3927 general public, that is suitable for revising the document
3928 straightforwardly with generic text editors or (for images
3929 composed of pixels) generic paint programs or (for drawings) some
3930 widely available drawing editor, and that is suitable for input to
3931 text formatters or for automatic translation to a variety of
3932 formats suitable for input to text formatters. A copy made in an
3933 otherwise Transparent file format whose markup, or absence of
3934 markup, has been arranged to thwart or discourage subsequent
3935 modification by readers is not Transparent. An image format is
3936 not Transparent if used for any substantial amount of text. A
3937 copy that is not "Transparent" is called "Opaque".
3939 Examples of suitable formats for Transparent copies include plain
3940 ASCII without markup, Texinfo input format, LaTeX input format,
3941 SGML or XML using a publicly available DTD, and
3942 standard-conforming simple HTML, PostScript or PDF designed for
3943 human modification. Examples of transparent image formats include
3944 PNG, XCF and JPG. Opaque formats include proprietary formats that
3945 can be read and edited only by proprietary word processors, SGML or
3946 XML for which the DTD and/or processing tools are not generally
3947 available, and the machine-generated HTML, PostScript or PDF
3948 produced by some word processors for output purposes only.
3950 The "Title Page" means, for a printed book, the title page itself,
3951 plus such following pages as are needed to hold, legibly, the
3952 material this License requires to appear in the title page. For
3953 works in formats which do not have any title page as such, "Title
3954 Page" means the text near the most prominent appearance of the
3955 work's title, preceding the beginning of the body of the text.
3957 A section "Entitled XYZ" means a named subunit of the Document
3958 whose title either is precisely XYZ or contains XYZ in parentheses
3959 following text that translates XYZ in another language. (Here XYZ
3960 stands for a specific section name mentioned below, such as
3961 "Acknowledgements", "Dedications", "Endorsements", or "History".)
3962 To "Preserve the Title" of such a section when you modify the
3963 Document means that it remains a section "Entitled XYZ" according
3966 The Document may include Warranty Disclaimers next to the notice
3967 which states that this License applies to the Document. These
3968 Warranty Disclaimers are considered to be included by reference in
3969 this License, but only as regards disclaiming warranties: any other
3970 implication that these Warranty Disclaimers may have is void and
3971 has no effect on the meaning of this License.
3975 You may copy and distribute the Document in any medium, either
3976 commercially or noncommercially, provided that this License, the
3977 copyright notices, and the license notice saying this License
3978 applies to the Document are reproduced in all copies, and that you
3979 add no other conditions whatsoever to those of this License. You
3980 may not use technical measures to obstruct or control the reading
3981 or further copying of the copies you make or distribute. However,
3982 you may accept compensation in exchange for copies. If you
3983 distribute a large enough number of copies you must also follow
3984 the conditions in section 3.
3986 You may also lend copies, under the same conditions stated above,
3987 and you may publicly display copies.
3989 3. COPYING IN QUANTITY
3991 If you publish printed copies (or copies in media that commonly
3992 have printed covers) of the Document, numbering more than 100, and
3993 the Document's license notice requires Cover Texts, you must
3994 enclose the copies in covers that carry, clearly and legibly, all
3995 these Cover Texts: Front-Cover Texts on the front cover, and
3996 Back-Cover Texts on the back cover. Both covers must also clearly
3997 and legibly identify you as the publisher of these copies. The
3998 front cover must present the full title with all words of the
3999 title equally prominent and visible. You may add other material
4000 on the covers in addition. Copying with changes limited to the
4001 covers, as long as they preserve the title of the Document and
4002 satisfy these conditions, can be treated as verbatim copying in
4005 If the required texts for either cover are too voluminous to fit
4006 legibly, you should put the first ones listed (as many as fit
4007 reasonably) on the actual cover, and continue the rest onto
4010 If you publish or distribute Opaque copies of the Document
4011 numbering more than 100, you must either include a
4012 machine-readable Transparent copy along with each Opaque copy, or
4013 state in or with each Opaque copy a computer-network location from
4014 which the general network-using public has access to download
4015 using public-standard network protocols a complete Transparent
4016 copy of the Document, free of added material. If you use the
4017 latter option, you must take reasonably prudent steps, when you
4018 begin distribution of Opaque copies in quantity, to ensure that
4019 this Transparent copy will remain thus accessible at the stated
4020 location until at least one year after the last time you
4021 distribute an Opaque copy (directly or through your agents or
4022 retailers) of that edition to the public.
4024 It is requested, but not required, that you contact the authors of
4025 the Document well before redistributing any large number of
4026 copies, to give them a chance to provide you with an updated
4027 version of the Document.
4031 You may copy and distribute a Modified Version of the Document
4032 under the conditions of sections 2 and 3 above, provided that you
4033 release the Modified Version under precisely this License, with
4034 the Modified Version filling the role of the Document, thus
4035 licensing distribution and modification of the Modified Version to
4036 whoever possesses a copy of it. In addition, you must do these
4037 things in the Modified Version:
4039 A. Use in the Title Page (and on the covers, if any) a title
4040 distinct from that of the Document, and from those of
4041 previous versions (which should, if there were any, be listed
4042 in the History section of the Document). You may use the
4043 same title as a previous version if the original publisher of
4044 that version gives permission.
4046 B. List on the Title Page, as authors, one or more persons or
4047 entities responsible for authorship of the modifications in
4048 the Modified Version, together with at least five of the
4049 principal authors of the Document (all of its principal
4050 authors, if it has fewer than five), unless they release you
4051 from this requirement.
4053 C. State on the Title page the name of the publisher of the
4054 Modified Version, as the publisher.
4056 D. Preserve all the copyright notices of the Document.
4058 E. Add an appropriate copyright notice for your modifications
4059 adjacent to the other copyright notices.
4061 F. Include, immediately after the copyright notices, a license
4062 notice giving the public permission to use the Modified
4063 Version under the terms of this License, in the form shown in
4066 G. Preserve in that license notice the full lists of Invariant
4067 Sections and required Cover Texts given in the Document's
4070 H. Include an unaltered copy of this License.
4072 I. Preserve the section Entitled "History", Preserve its Title,
4073 and add to it an item stating at least the title, year, new
4074 authors, and publisher of the Modified Version as given on
4075 the Title Page. If there is no section Entitled "History" in
4076 the Document, create one stating the title, year, authors,
4077 and publisher of the Document as given on its Title Page,
4078 then add an item describing the Modified Version as stated in
4079 the previous sentence.
4081 J. Preserve the network location, if any, given in the Document
4082 for public access to a Transparent copy of the Document, and
4083 likewise the network locations given in the Document for
4084 previous versions it was based on. These may be placed in
4085 the "History" section. You may omit a network location for a
4086 work that was published at least four years before the
4087 Document itself, or if the original publisher of the version
4088 it refers to gives permission.
4090 K. For any section Entitled "Acknowledgements" or "Dedications",
4091 Preserve the Title of the section, and preserve in the
4092 section all the substance and tone of each of the contributor
4093 acknowledgements and/or dedications given therein.
4095 L. Preserve all the Invariant Sections of the Document,
4096 unaltered in their text and in their titles. Section numbers
4097 or the equivalent are not considered part of the section
4100 M. Delete any section Entitled "Endorsements". Such a section
4101 may not be included in the Modified Version.
4103 N. Do not retitle any existing section to be Entitled
4104 "Endorsements" or to conflict in title with any Invariant
4107 O. Preserve any Warranty Disclaimers.
4109 If the Modified Version includes new front-matter sections or
4110 appendices that qualify as Secondary Sections and contain no
4111 material copied from the Document, you may at your option
4112 designate some or all of these sections as invariant. To do this,
4113 add their titles to the list of Invariant Sections in the Modified
4114 Version's license notice. These titles must be distinct from any
4115 other section titles.
4117 You may add a section Entitled "Endorsements", provided it contains
4118 nothing but endorsements of your Modified Version by various
4119 parties--for example, statements of peer review or that the text
4120 has been approved by an organization as the authoritative
4121 definition of a standard.
4123 You may add a passage of up to five words as a Front-Cover Text,
4124 and a passage of up to 25 words as a Back-Cover Text, to the end
4125 of the list of Cover Texts in the Modified Version. Only one
4126 passage of Front-Cover Text and one of Back-Cover Text may be
4127 added by (or through arrangements made by) any one entity. If the
4128 Document already includes a cover text for the same cover,
4129 previously added by you or by arrangement made by the same entity
4130 you are acting on behalf of, you may not add another; but you may
4131 replace the old one, on explicit permission from the previous
4132 publisher that added the old one.
4134 The author(s) and publisher(s) of the Document do not by this
4135 License give permission to use their names for publicity for or to
4136 assert or imply endorsement of any Modified Version.
4138 5. COMBINING DOCUMENTS
4140 You may combine the Document with other documents released under
4141 this License, under the terms defined in section 4 above for
4142 modified versions, provided that you include in the combination
4143 all of the Invariant Sections of all of the original documents,
4144 unmodified, and list them all as Invariant Sections of your
4145 combined work in its license notice, and that you preserve all
4146 their Warranty Disclaimers.
4148 The combined work need only contain one copy of this License, and
4149 multiple identical Invariant Sections may be replaced with a single
4150 copy. If there are multiple Invariant Sections with the same name
4151 but different contents, make the title of each such section unique
4152 by adding at the end of it, in parentheses, the name of the
4153 original author or publisher of that section if known, or else a
4154 unique number. Make the same adjustment to the section titles in
4155 the list of Invariant Sections in the license notice of the
4158 In the combination, you must combine any sections Entitled
4159 "History" in the various original documents, forming one section
4160 Entitled "History"; likewise combine any sections Entitled
4161 "Acknowledgements", and any sections Entitled "Dedications". You
4162 must delete all sections Entitled "Endorsements."
4164 6. COLLECTIONS OF DOCUMENTS
4166 You may make a collection consisting of the Document and other
4167 documents released under this License, and replace the individual
4168 copies of this License in the various documents with a single copy
4169 that is included in the collection, provided that you follow the
4170 rules of this License for verbatim copying of each of the
4171 documents in all other respects.
4173 You may extract a single document from such a collection, and
4174 distribute it individually under this License, provided you insert
4175 a copy of this License into the extracted document, and follow
4176 this License in all other respects regarding verbatim copying of
4179 7. AGGREGATION WITH INDEPENDENT WORKS
4181 A compilation of the Document or its derivatives with other
4182 separate and independent documents or works, in or on a volume of
4183 a storage or distribution medium, is called an "aggregate" if the
4184 copyright resulting from the compilation is not used to limit the
4185 legal rights of the compilation's users beyond what the individual
4186 works permit. When the Document is included in an aggregate, this
4187 License does not apply to the other works in the aggregate which
4188 are not themselves derivative works of the Document.
4190 If the Cover Text requirement of section 3 is applicable to these
4191 copies of the Document, then if the Document is less than one half
4192 of the entire aggregate, the Document's Cover Texts may be placed
4193 on covers that bracket the Document within the aggregate, or the
4194 electronic equivalent of covers if the Document is in electronic
4195 form. Otherwise they must appear on printed covers that bracket
4196 the whole aggregate.
4200 Translation is considered a kind of modification, so you may
4201 distribute translations of the Document under the terms of section
4202 4. Replacing Invariant Sections with translations requires special
4203 permission from their copyright holders, but you may include
4204 translations of some or all Invariant Sections in addition to the
4205 original versions of these Invariant Sections. You may include a
4206 translation of this License, and all the license notices in the
4207 Document, and any Warranty Disclaimers, provided that you also
4208 include the original English version of this License and the
4209 original versions of those notices and disclaimers. In case of a
4210 disagreement between the translation and the original version of
4211 this License or a notice or disclaimer, the original version will
4214 If a section in the Document is Entitled "Acknowledgements",
4215 "Dedications", or "History", the requirement (section 4) to
4216 Preserve its Title (section 1) will typically require changing the
4221 You may not copy, modify, sublicense, or distribute the Document
4222 except as expressly provided for under this License. Any other
4223 attempt to copy, modify, sublicense or distribute the Document is
4224 void, and will automatically terminate your rights under this
4225 License. However, parties who have received copies, or rights,
4226 from you under this License will not have their licenses
4227 terminated so long as such parties remain in full compliance.
4229 10. FUTURE REVISIONS OF THIS LICENSE
4231 The Free Software Foundation may publish new, revised versions of
4232 the GNU Free Documentation License from time to time. Such new
4233 versions will be similar in spirit to the present version, but may
4234 differ in detail to address new problems or concerns. See
4235 `http://www.gnu.org/copyleft/'.
4237 Each version of the License is given a distinguishing version
4238 number. If the Document specifies that a particular numbered
4239 version of this License "or any later version" applies to it, you
4240 have the option of following the terms and conditions either of
4241 that specified version or of any later version that has been
4242 published (not as a draft) by the Free Software Foundation. If
4243 the Document does not specify a version number of this License,
4244 you may choose any version ever published (not as a draft) by the
4245 Free Software Foundation.
4247 G.1 ADDENDUM: How to use this License for your documents
4248 ========================================================
4250 To use this License in a document you have written, include a copy of
4251 the License in the document and put the following copyright and license
4252 notices just after the title page:
4254 Copyright (C) YEAR YOUR NAME.
4255 Permission is granted to copy, distribute and/or modify this document
4256 under the terms of the GNU Free Documentation License, Version 1.2
4257 or any later version published by the Free Software Foundation;
4258 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
4259 Texts. A copy of the license is included in the section entitled ``GNU
4260 Free Documentation License''.
4262 If you have Invariant Sections, Front-Cover Texts and Back-Cover
4263 Texts, replace the "with...Texts." line with this:
4265 with the Invariant Sections being LIST THEIR TITLES, with
4266 the Front-Cover Texts being LIST, and with the Back-Cover Texts
4269 If you have Invariant Sections without Cover Texts, or some other
4270 combination of the three, merge those two alternatives to suit the
4273 If your document contains nontrivial examples of program code, we
4274 recommend releasing these examples in parallel under your choice of
4275 free software license, such as the GNU General Public License, to
4276 permit their use in free software.
4279 File: stabs.info, Node: Symbol Types Index, Next: GNU Free Documentation License, Prev: Stab Sections, Up: Top
4287 * .bb: Block Structure. (line 26)
4288 * .be: Block Structure. (line 26)
4289 * C_BCOMM: Common Blocks. (line 10)
4290 * C_BINCL: Include Files. (line 41)
4291 * C_BLOCK: Block Structure. (line 26)
4292 * C_BSTAT: Statics. (line 31)
4293 * C_DECL, for types: Typedefs. (line 6)
4294 * C_ECOML: Common Blocks. (line 17)
4295 * C_ECOMM: Common Blocks. (line 10)
4296 * C_EINCL: Include Files. (line 41)
4297 * C_ENTRY: Alternate Entry Points.
4299 * C_ESTAT: Statics. (line 31)
4300 * C_FILE: Source Files. (line 61)
4301 * C_FUN: Procedures. (line 18)
4302 * C_GSYM: Global Variables. (line 6)
4303 * C_LSYM: Stack Variables. (line 11)
4304 * C_PSYM: Parameters. (line 12)
4305 * C_RPSYM: Register Parameters. (line 15)
4306 * C_RSYM: Register Variables. (line 6)
4307 * C_STSYM: Statics. (line 31)
4308 * N_BCOMM: Common Blocks. (line 10)
4309 * N_BINCL: Include Files. (line 17)
4310 * N_BROWS: N_BROWS. (line 7)
4311 * N_BSLINE: Line Numbers. (line 12)
4312 * N_CATCH: N_CATCH. (line 7)
4313 * N_DEFD: N_DEFD. (line 7)
4314 * N_DSLINE: Line Numbers. (line 12)
4315 * N_ECOML: Common Blocks. (line 17)
4316 * N_ECOMM: Common Blocks. (line 10)
4317 * N_EHDECL: N_EHDECL. (line 7)
4318 * N_EINCL: Include Files. (line 17)
4319 * N_ENTRY: Alternate Entry Points.
4321 * N_EXCL: Include Files. (line 17)
4322 * N_FNAME: Procedures. (line 6)
4323 * N_FUN, for functions: Procedures. (line 6)
4324 * N_FUN, for variables: Statics. (line 12)
4325 * N_GSYM: Global Variables. (line 6)
4326 * N_GSYM, for functions (Sun acc): Procedures. (line 6)
4327 * N_LBRAC: Block Structure. (line 6)
4328 * N_LCSYM: Statics. (line 12)
4329 * N_LENG: N_LENG. (line 7)
4330 * N_LSYM, for parameter: Local Variable Parameters.
4332 * N_LSYM, for stack variables: Stack Variables. (line 11)
4333 * N_LSYM, for types: Typedefs. (line 6)
4334 * N_M2C: N_M2C. (line 7)
4335 * N_MAIN: Main Program. (line 6)
4336 * N_MOD2: N_MOD2. (line 7)
4337 * N_NBBSS: Gould. (line 9)
4338 * N_NBDATA: Gould. (line 8)
4339 * N_NBLCS: Gould. (line 11)
4340 * N_NBSTS: Gould. (line 10)
4341 * N_NBTEXT: Gould. (line 7)
4342 * N_NOMAP: N_NOMAP. (line 7)
4343 * N_NSYMS: N_NSYMS. (line 7)
4344 * N_PC: N_PC. (line 7)
4345 * N_PSYM: Parameters. (line 12)
4346 * N_RBRAC: Block Structure. (line 6)
4347 * N_ROSYM: Statics. (line 12)
4348 * N_RSYM: Register Variables. (line 6)
4349 * N_RSYM, for parameters: Register Parameters. (line 15)
4350 * N_SCOPE: N_SCOPE. (line 7)
4351 * N_SLINE: Line Numbers. (line 6)
4352 * N_SO: Source Files. (line 6)
4353 * N_SOL: Include Files. (line 11)
4354 * N_SSYM: N_SSYM. (line 7)
4355 * N_STSYM: Statics. (line 12)
4356 * N_STSYM, for functions (Sun acc): Procedures. (line 6)
4362 Node: Overview
\x7f1857
4364 Node: Stabs Format
\x7f4798
4365 Node: String Field
\x7f6360
4366 Node: C Example
\x7f11791
4367 Node: Assembly Code
\x7f12336
4368 Node: Program Structure
\x7f14307
4369 Node: Main Program
\x7f15033
4370 Node: Source Files
\x7f15594
4371 Node: Include Files
\x7f18046
4372 Node: Line Numbers
\x7f20711
4373 Node: Procedures
\x7f22245
4374 Node: Nested Procedures
\x7f28135
4375 Node: Block Structure
\x7f29311
4376 Node: Alternate Entry Points
\x7f30717
4377 Node: Constants
\x7f31450
4378 Node: Variables
\x7f34562
4379 Node: Stack Variables
\x7f35250
4380 Node: Global Variables
\x7f36951
4381 Node: Register Variables
\x7f38107
4382 Node: Common Blocks
\x7f38929
4383 Node: Statics
\x7f40183
4384 Node: Based Variables
\x7f42764
4385 Node: Parameters
\x7f44149
4386 Node: Register Parameters
\x7f45761
4387 Node: Local Variable Parameters
\x7f48022
4388 Node: Reference Parameters
\x7f50937
4389 Node: Conformant Arrays
\x7f51557
4390 Node: Types
\x7f52274
4391 Node: Builtin Types
\x7f53209
4392 Node: Traditional Builtin Types
\x7f54355
4393 Node: Traditional Integer Types
\x7f54756
4394 Node: Traditional Other Types
\x7f57064
4395 Node: Builtin Type Descriptors
\x7f57978
4396 Node: Negative Type Numbers
\x7f61478
4397 Node: Miscellaneous Types
\x7f67833
4398 Node: Cross-References
\x7f69719
4399 Node: Subranges
\x7f71394
4400 Node: Arrays
\x7f72633
4401 Node: Strings
\x7f75858
4402 Node: Enumerations
\x7f76920
4403 Node: Structures
\x7f79305
4404 Node: Typedefs
\x7f82012
4405 Node: Unions
\x7f83336
4406 Node: Function Types
\x7f84917
4407 Node: Symbol Tables
\x7f86499
4408 Node: Symbol Table Format
\x7f86931
4409 Node: Transformations On Symbol Tables
\x7f88379
4410 Node: Transformations On Static Variables
\x7f89733
4411 Node: Transformations On Global Variables
\x7f90469
4412 Node: Stab Section Transformations
\x7f91712
4413 Node: Cplusplus
\x7f93095
4414 Node: Class Names
\x7f93678
4415 Node: Nested Symbols
\x7f94423
4416 Node: Basic Cplusplus Types
\x7f95269
4417 Node: Simple Classes
\x7f96829
4418 Node: Class Instance
\x7f101123
4419 Node: Methods
\x7f101840
4420 Node: Method Type Descriptor
\x7f104059
4421 Node: Member Type Descriptor
\x7f105259
4422 Node: Protections
\x7f106090
4423 Node: Method Modifiers
\x7f109180
4424 Node: Virtual Methods
\x7f110808
4425 Node: Inheritance
\x7f114609
4426 Node: Virtual Base Classes
\x7f118305
4427 Node: Static Members
\x7f120549
4428 Node: Stab Types
\x7f121019
4429 Node: Non-Stab Symbol Types
\x7f121643
4430 Node: Stab Symbol Types
\x7f123074
4431 Node: Symbol Descriptors
\x7f126797
4432 Node: Type Descriptors
\x7f129576
4433 Node: Expanded Reference
\x7f132788
4434 Node: N_PC
\x7f134206
4435 Node: N_NSYMS
\x7f134574
4436 Node: N_NOMAP
\x7f134815
4437 Node: N_M2C
\x7f135121
4438 Node: N_BROWS
\x7f135555
4439 Node: N_DEFD
\x7f135838
4440 Node: N_EHDECL
\x7f136295
4441 Node: N_MOD2
\x7f136546
4442 Node: N_CATCH
\x7f136784
4443 Node: N_SSYM
\x7f137278
4444 Node: N_SCOPE
\x7f137563
4445 Node: Gould
\x7f137753
4446 Node: N_LENG
\x7f138745
4447 Node: Questions
\x7f138973
4448 Node: Stab Sections
\x7f140617
4449 Node: Stab Section Basics
\x7f141215
4450 Node: ELF Linker Relocation
\x7f144556
4451 Node: GNU Free Documentation License
\x7f147966
4452 Node: Symbol Types Index
\x7f170400