|
|
1.1 ! root 1: .\" Copyright (c) 1980 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)stab.5 6.3 (Berkeley) 5/19/86 ! 6: .\" ! 7: .TH STAB 5 "May 19, 1986" ! 8: .UC 4 ! 9: .SH NAME ! 10: stab \- symbol table types ! 11: .SH SYNOPSIS ! 12: .B "#include <stab.h>" ! 13: .SH DESCRIPTION ! 14: .I Stab.h ! 15: defines some values of the n_type field of the symbol table of a.out files. ! 16: These are the types for permanent symbols (i.e. not local labels, etc.) ! 17: used by the old debugger ! 18: .I sdb ! 19: and the Berkeley Pascal compiler ! 20: .IR pc (1). ! 21: Symbol table entries can be produced by the ! 22: .I .stabs ! 23: assembler directive. ! 24: This allows one to specify a double-quote delimited name, a symbol type, ! 25: one char and one short of information about the symbol, and an unsigned ! 26: long (usually an address). ! 27: To avoid having to produce an explicit label for the address field, ! 28: the ! 29: .I .stabd ! 30: directive can be used to implicitly address the current location. ! 31: If no name is needed, symbol table entries can be generated using the ! 32: .I .stabn ! 33: directive. ! 34: The loader promises to preserve the order of symbol table entries produced ! 35: by ! 36: .I .stab ! 37: directives. ! 38: As described in ! 39: .IR a.out (5), ! 40: an element of the symbol table ! 41: consists of the following structure: ! 42: .PP ! 43: .nf ! 44: /* ! 45: .ti +\w'/'u ! 46: * Format of a symbol table entry. ! 47: .ti +\w'/'u ! 48: */ ! 49: .ta \w'#define\ 'u +\w'unsigned 'u +\w'char\ \ 'u +\w'n_name;\ \ 'u ! 50: struct nlist { ! 51: union { ! 52: char *n_name; /* for use when in-core */ ! 53: long n_strx; /* index into file string table */ ! 54: } n_un; ! 55: unsigned char n_type; /* type flag */ ! 56: char n_other; /* unused */ ! 57: short n_desc; /* see struct desc, below */ ! 58: unsigned n_value; /* address or offset or line */ ! 59: }; ! 60: .fi ! 61: .DT ! 62: .PP ! 63: The low bits of the n_type field are used to place a symbol into ! 64: at most one segment, according to ! 65: the following masks, defined in ! 66: .RI < a.out.h >. ! 67: A symbol can be in none of these segments by having none of these segment ! 68: bits set. ! 69: .PP ! 70: .nf ! 71: /* ! 72: .ti +\w'/'u ! 73: * Simple values for n_type. ! 74: .ti +\w'/'u ! 75: */ ! 76: .ta \w'#define\ 'u +\w'N_FNAME\ 'u +\w'0x0\ \ \ 'u ! 77: #define N_UNDF 0x0 /* undefined */ ! 78: #define N_ABS 0x2 /* absolute */ ! 79: #define N_TEXT 0x4 /* text */ ! 80: #define N_DATA 0x6 /* data */ ! 81: #define N_BSS 0x8 /* bss */ ! 82: ! 83: #define N_EXT 01 /* external bit, or'ed in */ ! 84: .DT ! 85: .fi ! 86: .PP ! 87: The n_value field of a symbol is relocated by the linker, ! 88: .IR ld (1) ! 89: as an address within the appropriate segment. ! 90: N_value fields of symbols not in any segment are unchanged by the linker. ! 91: In addition, the linker will discard certain symbols, according to rules ! 92: of its own, unless the n_type field has one of the following bits set: ! 93: .PP ! 94: .nf ! 95: /* ! 96: .ti +\w'/'u ! 97: * Other permanent symbol table entries have some of the N_STAB bits set. ! 98: .ti +\w'/'u ! 99: * These are given in <stab.h> ! 100: .ti +\w'/'u ! 101: */ ! 102: .ta \w'#define\ 'u +\w'N_FNAME\ 'u +\w'0x0\ \ \ 'u ! 103: #define N_STAB 0xe0 /* if any of these bits set, don't discard */ ! 104: ! 105: .DT ! 106: .fi ! 107: .PP ! 108: This allows up to 112 (7 \(** 16) symbol types, split between the various ! 109: segments. ! 110: Some of these have already been claimed. ! 111: The old symbolic debugger, ! 112: .IR sdb , ! 113: uses the following n_type values: ! 114: .PP ! 115: .nf ! 116: .ta \w'#define\ 'u +\w'N_FNAME\ 'u +\w'0x0\ \ \ 'u ! 117: #define N_GSYM 0x20 /* global symbol: name,,0,type,0 */ ! 118: #define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */ ! 119: #define N_FUN 0x24 /* procedure: name,,0,linenumber,address */ ! 120: #define N_STSYM 0x26 /* static symbol: name,,0,type,address */ ! 121: #define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */ ! 122: #define N_RSYM 0x40 /* register sym: name,,0,type,register */ ! 123: #define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */ ! 124: #define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */ ! 125: #define N_SO 0x64 /* source file name: name,,0,0,address */ ! 126: #define N_LSYM 0x80 /* local sym: name,,0,type,offset */ ! 127: #define N_SOL 0x84 /* #included file name: name,,0,0,address */ ! 128: #define N_PSYM 0xa0 /* parameter: name,,0,type,offset */ ! 129: #define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */ ! 130: #define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */ ! 131: #define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */ ! 132: #define N_BCOMM 0xe2 /* begin common: name,, */ ! 133: #define N_ECOMM 0xe4 /* end common: name,, */ ! 134: #define N_ECOML 0xe8 /* end common (local name): ,,address */ ! 135: #define N_LENG 0xfe /* second stab entry with length information */ ! 136: .fi ! 137: .PP ! 138: where the comments give ! 139: .I sdb ! 140: conventional use for ! 141: .IR .stab s ! 142: and the n_name, n_other, n_desc, and n_value fields ! 143: of the given n_type. ! 144: .I Sdb ! 145: uses the n_desc field to hold a type specifier in the form used ! 146: by the Portable C Compiler, ! 147: .IR cc (1); ! 148: see the header file \fIpcc.h\fP ! 149: for details on the format of these type values. ! 150: .PP ! 151: The Berkeley Pascal compiler, ! 152: .IR pc (1), ! 153: uses the following n_type value: ! 154: .PP ! 155: .nf ! 156: #define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */ ! 157: .fi ! 158: .PP ! 159: and uses the following subtypes to do type checking across separately ! 160: compiled files: ! 161: .nf ! 162: 1 source file name ! 163: 2 included file name ! 164: 3 global label ! 165: 4 global constant ! 166: 5 global type ! 167: 6 global variable ! 168: 7 global function ! 169: 8 global procedure ! 170: 9 external function ! 171: 10 external procedure ! 172: 11 library variable ! 173: 12 library routine ! 174: .fi ! 175: .SH "SEE ALSO" ! 176: as(1), ld(1), dbx(1), a.out(5) ! 177: .SH BUGS ! 178: .PP ! 179: More basic types are needed.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.