1 /*
2  * Copyright (c) 2017, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 /**
19    \file
20    \brief Definitions for stab format.
21  */
22 
23 #ifndef _stab_h
24 #define _stab_h
25 
26 /*
27  * for symbolic debugger, sdb(1):
28  */
29 #define N_GSYM 0x20  /* global symbol: name,,0,type,0 */
30 #define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
31 #define N_FUN 0x24   /* procedure: name,,0,linenumber,address */
32 #define N_STSYM 0x26 /* static symbol: name,,0,type,address */
33 #define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
34 #define N_MAIN 0x2a  /* name of main routine : name,,0,0,0 */
35 #define N_OBJ 0x38   /* object file path or name */
36 #define N_OPT 0x3c   /* compiler options */
37 #define N_RSYM 0x40  /* register sym: name,,0,type,register */
38 #define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */
39 #define N_SSYM 0x60  /* structure elt: name,,0,type,struct_offset */
40 #define N_ENDM 0x62  /* last stab emitted for module */
41 #define N_SO 0x64    /* source file name: name,,0,0,address */
42 #define N_LSYM 0x80  /* local sym: name,,0,type,offset */
43 #define N_BINCL 0x82 /* header file: name,,0,0,0 */
44 #define N_SOL 0x84   /* #included file name: name,,0,0,address */
45 #define N_PSYM 0xa0  /* parameter: name,,0,type,offset */
46 #define N_EINCL 0xa2 /* end of include file */
47 #define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */
48 #define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */
49 #define N_EXCL 0xc2  /* excluded include file */
50 #define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */
51 #define N_BCOMM 0xe2 /* begin common: name,, */
52 #define N_ECOMM 0xe4 /* end common: name,, */
53 #define N_ECOML 0xe8 /* end common (local name): ,,address */
54 #define N_LENG 0xfe  /* second stab entry with length information */
55 
56 /*
57  * for the berkeley pascal compiler, pc(1):
58  */
59 #define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */
60 
61 /*
62  * for modula-2 compiler only
63  */
64 #define N_M2C 0x42   /* compilation unit stab */
65 #define N_SCOPE 0xc4 /* scope information */
66 
67 /*
68  * for code browser only
69  */
70 #define N_BROWS 0x48 /* path to associated .cb file */
71 
72 /*
73  *    Optional language designations for N_SO
74  */
75 
76 #define N_SO_C 2       /* C          */
77 #define N_SO_ANSI_C 3  /* Ansi C     */
78 #define N_SO_CC 4      /* C++	      */
79 #define N_SO_FORTRAN 5 /* Fortran 77 */
80 
81 #endif /*!_stab_h*/
82 
83 /* definitions for coff object file format */
84 /*
85  *   STORAGE CLASSES
86  */
87 
88 #define C_EFCN -1 /* physical end of function */
89 #define C_NULL 0
90 #define C_AUTO 1     /* automatic variable */
91 #define C_EXT 2      /* external symbol */
92 #define C_STAT 3     /* static */
93 #define C_REG 4      /* register variable */
94 #define C_EXTDEF 5   /* external definition */
95 #define C_LABEL 6    /* label */
96 #define C_ULABEL 7   /* undefined label */
97 #define C_MOS 8      /* member of structure */
98 #define C_ARG 9      /* function argument */
99 #define C_STRTAG 10  /* structure tag */
100 #define C_MOU 11     /* member of union */
101 #define C_UNTAG 12   /* union tag */
102 #define C_TPDEF 13   /* type definition */
103 #define C_USTATIC 14 /* undefined static */
104 #define C_ENTAG 15   /* enumeration tag */
105 #define C_MOE 16     /* member of enumeration */
106 #define C_REGPARM 17 /* register parameter */
107 #define C_FIELD 18   /* bit field */
108 #define C_BLOCK 100  /* ".bb" or ".eb" */
109 #define C_FCN 101    /* ".bf" or ".ef" */
110 #define C_EOS 102    /* end of structure */
111 #define C_FILE 103   /* file name */
112 
113 /*		Number of array dimensions in auxiliary entry */
114 #define DIMNUM 4
115 
116 /*
117    The fundamental type of a symbol packed into the low
118    4 bits of the word.
119 */
120 
121 #define T_NULL 0
122 #define T_ARG 1     /* function argument (only used by compiler) */
123 #define T_CHAR 2    /* character */
124 #define T_SHORT 3   /* short integer */
125 #define T_INT 4     /* integer */
126 #define T_LONG 5    /* long integer */
127 #define T_FLOAT 6   /* floating point */
128 #define T_DOUBLE 7  /* double word */
129 #define T_STRUCT 8  /* structure  */
130 #define T_UNION 9   /* union  */
131 #define T_ENUM 10   /* enumeration  */
132 #define T_MOE 11    /* member of enumeration */
133 #define T_UCHAR 12  /* unsigned character */
134 #define T_USHORT 13 /* unsigned short */
135 #define T_UINT 14   /* unsigned integer */
136 #define T_ULONG 15  /* unsigned long */
137 
138 /*
139  * derived types are:
140  */
141 
142 #define DT_NON 0 /* no derived type */
143 #define DT_PTR 1 /* pointer */
144 #define DT_FCN 2 /* function */
145 #define DT_ARY 3 /* array */
146 
147 /*
148  *   type packing constants
149  */
150 
151 #define N_BTMASK 017
152 #define N_TMASK 060
153 #define N_TMASK1 0300
154 #define N_TMASK2 0360
155 #define N_BTSHFT 4
156 #define N_TSHIFT 2
157