stab.5
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 5 代码 · 共 297 行
5
297 行
.SCCSID: @(#)stab.5 2.1 3/10/87.TH stab 5 VAX.SH Namestab \- symbol table types.SH Syntax.B "#include <stab.h>".SH Description.NXB "stab file" "format".NXA "a.out file" "stab file"The.PN stab.hfiledefines some values of the n_type field of the symbol table of.PN a.outfiles.These are the types for permanent symbols(that is, not local labels, and so on)used by the debugger.PN dbxand the Berkeley Pascal compiler .MS pc 1 .Symbol table entries can be produced by the .PN .stabsassembler directive, which allows you to specify a double-quote delimited name, a symbol type,one char and one short of information about the symbol, and an unsignedlong (usually an address)..PPTo avoid having to produce an explicit label for the address field,the .stabddirective can be used to implicitly address the current location.If no name is needed, symbol table entriescan be generated using the .stabndirective.The loader promises to preserve the orderof symbol table entries produced by .stab directives.As described in .MS a.out 5 ,an element of the symbol tableconsists of the following structure:.EX 0/*struct nlist { union { char *n_name; /* for use when in-core */ long n_strx; /* index into file string table */ } n_un; unsigned char n_type; /* type flag */ char n_other; /* unused */ short n_desc; /* see struct desc, below */ unsigned n_value; /* address or offset or line */};.EE.PPThe low bits of the n_type field are used to place a symbol intoone segment, maximum, according to the following masks defined in .PN <a.out.h> .If none of the segment bits are set, a symbol cannot be in any of thesesegments..EX 0* Simple values for n_type.#define N_UNDF 0x0 /* undefined */#define N_ABS 0x2 /* absolute */#define N_TEXT 0x4 /* text */#define N_DATA 0x6 /* data */#define N_BSS 0x8 /* bss */#define N_EXT 01 /* external bit, or'ed in */.EE.PPThe n_value field of a symbol is relocated by the linker,.PN ld ,as an address within the appropriate segment.N_value fields of symbols not in any segment are unchanged by the linker.In addition, the linker will discard certain symbols, according to rulesof its own, unless the n_type field has one of the following bits set:.EX 0/** Other permanent symbol table entries have some of the* N_STAB bits set. These are given in <stab.h>*/#define N_STAB 0xe0 /* if any of these bits set, don't discard */.EE.PPThis allows up to 112 (7 \(** 16) symbol types,split between the various segments.Some of these have already been claimed.The C compiler generates the following n_type values,where the comments give the use for.IR .stab sand the n_name, n_other, n_desc, and n_value fieldsof the given n_type: .EX 0#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */#define N_STSYM 0x26 /* static symbol: name,,0,type,address */#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */#define N_RSYM 0x40 /* register sym: name,,0,type,register */#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */#define N_SSYM 0x60 /* struct elt: name,,0,type,struct_offset */#define N_SO 0x64 /* source file name: name,,0,0,address */#define N_LSYM 0x80 /* local sym: name,,0,type,offset */#define N_SOL 0x84 /* #included file name: name,,0,0,address */#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */#define N_ENTRY 0xa4 /* alt entry: name,linenumber,address */#define N_LBRAC 0xc0 /* lft bracket: 0,,0,nesting level,address */#define N_RBRAC 0xe0 /* rt bracket: 0,,0,nesting level,address */#define N_BCOMM 0xe2 /* begin common: name,, */#define N_ECOMM 0xe4 /* end common: name,, */#define N_ECOML 0xe8 /* end common (local name): ,,address */#define N_LENG 0xfe /* second stab entry with length information */.EE.PPThen_desc holds a type specifier in the form usedby the Portable C Compiler,.MS cc 1 ,in which a base type is qualified in the following structure:.EX 0struct desc { short q6:2, q5:2, q4:2, q3:2, q2:2, q1:2, basic:4;};.EE.PPThere are 4 qualifications, with q1 the most significant and q6 the leastsignificant:.sp 4p.RS 3.PD 0.IP 0 5None.IP 1Pointer.IP 2Function.IP 3Array.RE.PD.PPThe 16 basic types are assigned as follows:.sp 4p.PD 0.RS 3.IP 0 5Undefined.IP 1Function argument.IP 2Character.IP 3Short.IP 4Int.IP 5Long.IP 6Float.IP 7Double.IP 8Structure.IP 9Union.IP 10Enumeration.IP 11Member of enumeration.IP 12Unsigned character.IP 13Unsigned short.IP 14Unsigned int.IP 15Unsigned long.RE.PD .PPThe same information is encoded in a more useful form in thesymbolic string. The symbol's name is followed by a colon,which is followed by a description of the symbol's type.This begins with one of the following letters:.sp 4p.RS 3.PD 0.IP cConstant.IP fLocal function.IP FFunction name.IP GGlobal variable.IP pArgument (by value).IP PExternal procedure.IP rRegister variable.IP sStatic variable.IP t 5 Typedef name.IP TLocal variable.IP vArgument (by ref).IP VLocal static variable.IP "No letter"Local dynamic variable.RE.PD.PPThis is followed by the variable's type, where \fItype\fR is any ofthe following:.IP \fIinteger\fR 16Same as previously defined type \fIinteger\fR.IP \fIinteger\fR=\fItype\fRDefine type \fIinteger\fR to have form \fItype\fI.IP *\fItype\fRPointer to \fItype\fR.IP r\fItype\fR;\fIlow\fR;\fIhigh\fR;Range of \fItype\fR from \fIlow\fR to \fIhigh\fR.IP a\fIrangetype\fRArray with bounds \fIrange\fR of \fItype\fR.IP e\fIname:value\fR,;Enumerated type. The phrase "\fIname\fR:\fIvalue\fR," repeats as needed..IP s\fIsizename\fR:\fItype,offset,size\fR;;.brStructure. The \fIsize\fR is the number of bytes in thecomplete structure. The phrase "\fIname:\fItype,offset,size\fR;"repeats as needed, giving the \fIoffset\fR from the start of thestructure (in bits) and the \fIsize\fR in bits of each member..IP u\fIsizename\fR:\fItype,offset,size\fR;;Union. Analogous to structure entry..IP S\fItype\fRSet of \fItype\fR..IP f\fItype,integer\fR;\fItype,class\fR; Function returning \fItype\fR with \fIinteger\fR parameters, describedby the repeating "\fItype,class\fR;" phrase..IP p\fIinteger\fR;\fItype,class\fR;Procedure\-like function.IP d\fItype\fRFile of \fItype\fR.RE.PPThe Berkeley Pascal compiler,.MS pc 1 ,uses the following n_type value:.PP.EX#define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */.EE.PPThe complier uses the following subtypes to do type checking across separatelycompiled files:.sp 4p.RS 3.PD 0.IP 1 5Source file name.IP 2Included file name.IP 3Global label.IP 4Global constant.IP 5Global type.IP 6Global variable.IP 7Global function.IP 8Global procedure.IP 9External function.IP 10External procedure.IP 11Library variable.IP 12Library routine.PD.SH See Alsoas(1), cc(1), dbx(1), ld(1), pc(1), a.out(5).NXE "stab file" "format"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?