home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / libs / ixemul-47.3 / ixemul-sdk / man / cat5 / stab.0 < prev    next >
Encoding:
Text File  |  1998-06-15  |  5.8 KB  |  130 lines

  1.  
  2. STAB(5)                    UNIX Programmer's Manual                    STAB(5)
  3.  
  4. NNAAMMEE
  5.      ssttaabb - symbol table types
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssttaabb..hh>>
  9.  
  10. DDEESSCCRRIIPPTTIIOONN
  11.      The file <_s_t_a_b_._h> defines some of the symbol table _n___t_y_p_e field values
  12.      for a.out files.  These are the types for permanent symbols (i.e. not lo-
  13.      cal labels, etc.)  used by the old debugger _s_d_b and the Berkeley Pascal
  14.      compiler pc(1).  Symbol table entries can be produced by the _._s_t_a_b_s as-
  15.      sembler directive.  This allows one to specify a double-quote delimited
  16.      name, a symbol type, one char and one short of information about the sym-
  17.      bol, and an unsigned long (usually an address).  To avoid having to pro-
  18.      duce an explicit label for the address field, the _._s_t_a_b_d directive can be
  19.      used to implicitly address the current location.  If no name is needed,
  20.      symbol table entries can be generated using the _._s_t_a_b_n directive.  The
  21.      loader promises to preserve the order of symbol table entries produced by
  22.      _._s_t_a_b directives.  As described in a.out(5),  an element of the symbol
  23.      table consists of the following structure:
  24.  
  25.      /*
  26.      * Format of a symbol table entry.
  27.      */
  28.  
  29.      struct nlist {
  30.              union {
  31.                      char    *n_name;        /* for use when in-core */
  32.                      long    n_strx;         /* index into file string table */
  33.              } n_un;
  34.              unsigned char   n_type;         /* type flag */
  35.              char            n_other;        /* unused */
  36.              short           n_desc;         /* see struct desc, below */
  37.              unsigned        n_value;        /* address or offset or line */
  38.      };
  39.  
  40.      The low bits of the _n___t_y_p_e field are used to place a symbol into at most
  41.      one segment, according to the following masks, defined in <_a_._o_u_t_._h>. A
  42.      symbol can be in none of these segments by having none of these segment
  43.      bits set.
  44.  
  45.      /*
  46.      * Simple values for n_type.
  47.      */
  48.  
  49.      #define N_UNDF  0x0     /* undefined */
  50.      #define N_ABS   0x2     /* absolute */
  51.      #define N_TEXT  0x4     /* text */
  52.      #define N_DATA  0x6     /* data */
  53.      #define N_BSS   0x8     /* bss */
  54.  
  55.      #define N_EXT   01      /* external bit, or'ed in */
  56.  
  57.      The _n___v_a_l_u_e field of a symbol is relocated by the linker, ld(1) as an ad-
  58.      dress within the appropriate segment.  _N___v_a_l_u_e fields of symbols not in
  59.      any segment are unchanged by the linker.  In addition, the linker will
  60.      discard certain symbols, according to rules of its own, unless the _n___t_y_p_e
  61.      field has one of the following bits set:
  62.  
  63.      /*
  64.      * Other permanent symbol table entries have some of the N_STAB bits set.
  65.      * These are given in <stab.h>
  66.      */
  67.  
  68.      #define N_STAB  0xe0    /* if any of these bits set, don't discard */
  69.  
  70.      This allows up to 112 (7 * 16) symbol types, split between the various
  71.      segments.  Some of these have already been claimed.  The old symbolic de-
  72.      bugger, _s_d_b, uses the following n_type values:
  73.  
  74.      #define N_GSYM  0x20    /* global symbol: name,,0,type,0 */
  75.      #define N_FNAME 0x22    /* procedure name (f77 kludge): name,,0 */
  76.      #define N_FUN   0x24    /* procedure: name,,0,linenumber,address */
  77.      #define N_STSYM 0x26    /* static symbol: name,,0,type,address */
  78.      #define N_LCSYM 0x28    /* .lcomm symbol: name,,0,type,address */
  79.      #define N_RSYM  0x40    /* register sym: name,,0,type,register */
  80.      #define N_SLINE 0x44    /* src line: 0,,0,linenumber,address */
  81.      #define N_SSYM  0x60    /* structure elt: name,,0,type,struct_offset */
  82.      #define N_SO    0x64    /* source file name: name,,0,0,address */
  83.      #define N_LSYM  0x80    /* local sym: name,,0,type,offset */
  84.      #define N_SOL   0x84    /* #included file name: name,,0,0,address */
  85.      #define N_PSYM  0xa0    /* parameter: name,,0,type,offset */
  86.      #define N_ENTRY 0xa4    /* alternate entry: name,linenumber,address */
  87.      #define N_LBRAC 0xc0    /* left bracket: 0,,0,nesting level,address */
  88.      #define N_RBRAC 0xe0    /* right bracket: 0,,0,nesting level,address */
  89.      #define N_BCOMM 0xe2    /* begin common: name,, */
  90.      #define N_ECOMM 0xe4    /* end common: name,, */
  91.      #define N_ECOML 0xe8    /* end common (local name): ,,address */
  92.      #define N_LENG  0xfe    /* second stab entry with length information */
  93.  
  94.      where the comments give _s_d_b conventional use for _._s_t_a_b _s and the _n___n_a_m_e,
  95.      _n___o_t_h_e_r, _n___d_e_s_c, and _n___v_a_l_u_e fields of the given _n___t_y_p_e. _S_d_b uses the
  96.      _n___d_e_s_c field to hold a type specifier in the form used by the Portable C
  97.      Compiler, cc(1);  see the header file _p_c_c_._h for details on the format of
  98.      these type values.
  99.  
  100.      The Berkeley Pascal compiler, pc(1),  uses the following _n___t_y_p_e value:
  101.  
  102.      #define N_PC    0x30    /* global pascal symbol: name,,0,subtype,line */
  103.  
  104.      and uses the following subtypes to do type checking across separately
  105.      compiled files:
  106.  
  107.            1       source file name
  108.            2       included file name
  109.            3       global label
  110.            4       global constant
  111.            5       global type
  112.            6       global variable
  113.            7       global function
  114.            8       global procedure
  115.            9       external function
  116.            10      external procedure
  117.            11      library variable
  118.            12      library routine
  119.  
  120. SSEEEE AALLSSOO
  121.      as(1),  ld(1),  dbx(1),  a.out(5)
  122.  
  123. BBUUGGSS
  124.      More basic types are needed.
  125.  
  126. HHIISSTTOORRYY
  127.      The ssttaabb file appeared in 4.0BSD.
  128.  
  129. 4th Berkeley Distribution        June 5, 1993                                2
  130.