1 /* ----------------------------------------------------------------------- * 2 * 3 * Copyright 1996-2018 The NASM Authors - All Rights Reserved 4 * See the file AUTHORS included with the NASM distribution for 5 * the specific copyright holders. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following 9 * conditions are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above 14 * copyright notice, this list of conditions and the following 15 * disclaimer in the documentation and/or other materials provided 16 * with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * 32 * ----------------------------------------------------------------------- */ 33 34 #ifndef STABS_H_ 35 #define STABS_H_ 36 37 #include <ctype.h> 38 39 #include "compiler.h" 40 #include "nasmlib.h" 41 #include "nasm.h" 42 43 /* offsets */ 44 enum stab_offsets { 45 STAB_strdxoff = 0, 46 STAB_typeoff = 4, 47 STAB_otheroff = 5, 48 STAB_descoff = 6, 49 STAB_valoff = 8, 50 STAB_stabsize = 12 51 }; 52 53 /* stab/non-stab types */ 54 enum stab_types { 55 N_UNDF = 0x00, /* Undefined symbol */ 56 N_EXT = 0x01, /* External symbol */ 57 N_ABS = 0x02, /* Absolute symbol */ 58 N_ABS_EXT = 0x03, /* Absolute external symbol */ 59 N_TEXT = 0x04, /* Symbol in text segment */ 60 N_TEXT_EXT = 0x05, /* Symbol in external text segment */ 61 N_DATA = 0x06, 62 N_DATA_EXT = 0x07, 63 N_BSS = 0x08, 64 N_BSS_EXT = 0x09, 65 N_INDR = 0x0a, 66 N_FN_SEQ = 0x0c, /* N_FN from Sequent compilers */ 67 N_WEAKU = 0x0d, /* Weak undefined symbol */ 68 N_WEAKA = 0x0e, /* Weak absolute symbl */ 69 N_WEAKT = 0x0f, /* Weak text symbol */ 70 N_WEAKD = 0x10, /* Weak data symbol */ 71 N_WEAKB = 0x11, /* Weak bss symbol */ 72 N_COMM = 0x12, /* Common symbol */ 73 N_SETA = 0x14, /* Absolute set element symbol */ 74 N_SETA_EXT = 0x15, 75 N_SETT = 0x16, /* Text set element symbol */ 76 N_SETT_EXT = 0x17, 77 N_SETD = 0x18, /* Data set element symbol */ 78 N_SETD_EXT = 0x19, 79 N_SETB = 0x1a, /* BSS set element symbol */ 80 N_SETB_EXT = 0x1b, 81 N_SETV = 0x1c, /* Pointer to set vector in data area */ 82 N_SETV_EXT = 0x1d, 83 N_WARNING = 0x1e, /* Warning symbol */ 84 N_FN = 0x1f, /* Filename of .o file */ 85 N_GSYM = 0x20, /* Global variable */ 86 N_FNAME = 0x22, /* Function name for BSD Fortran */ 87 N_FUN = 0x24, /* Function name or text segment variable for C */ 88 N_STSYM = 0x26, /* Data-segment variable with internal linkage */ 89 N_LCSYM = 0x28, /* BSS-segment variable with internal linkage */ 90 N_MAIN = 0x2a, /* Name of main routine */ 91 N_ROSYM = 0x2c, /* Read-only data symbols */ 92 N_BNSYM = 0x2e, /* The beginning of a relocatable function block */ 93 N_PC = 0x30, /* Global symbol in Pascal */ 94 N_NSYMS = 0x32, /* Number of symbols */ 95 N_NOMAP = 0x34, /* No DST map for sym */ 96 N_OBJ = 0x38, /* Like N_SO, but for the object file */ 97 N_OPT = 0x3c, /* Options for the debugger */ 98 N_RSYM = 0x40, /* Register variable */ 99 N_M2C = 0x42, /* Modula-2 compilation unit */ 100 N_SLINE = 0x44, /* Line number in text segment */ 101 N_DSLINE = 0x46, /* Line number in data segment */ 102 N_BSLINE = 0x48, /* Line number in bss segment */ 103 N_BROWS = 0x48, /* Sun's source-code browser stabs */ 104 N_DEFD = 0x4a, /* GNU Modula-2 definition module dependency */ 105 N_FLINE = 0x4c, /* Function start/body/end line numbers */ 106 N_ENSYM = 0x4e, /* This tells the end of a relocatable function */ 107 N_EHDECL = 0x50, /* GNU C++ exception variable */ 108 N_MOD2 = 0x50, /* Modula2 info "for imc" */ 109 N_CATCH = 0x54, /* GNU C++ `catch' clause */ 110 N_SSYM = 0x60, /* Structure or union element */ 111 N_ENDM = 0x62, /* Last stab emitted for module */ 112 N_SO = 0x64, /* ID for main source file */ 113 N_OSO = 0x66, /* Apple: This is the stab that associated the .o file */ 114 N_ALIAS = 0x6c, /* SunPro F77: Name of alias */ 115 N_LSYM = 0x80, /* Automatic variable in the stack */ 116 N_BINCL = 0x82, /* Beginning of an include file */ 117 N_SOL = 0x84, /* ID for sub-source file */ 118 N_PSYM = 0xa0, /* Parameter variable */ 119 N_EINCL = 0xa2, /* End of an include file */ 120 N_ENTRY = 0xa4, /* Alternate entry point */ 121 N_LBRAC = 0xc0, /* Beginning of lexical block */ 122 N_EXCL = 0xc2, /* Place holder for deleted include file */ 123 N_SCOPE = 0xc4, /* Modula-2 scope information */ 124 N_PATCH = 0xd0, /* Solaris2: Patch Run Time Checker */ 125 N_RBRAC = 0xe0, /* End of a lexical block */ 126 N_BCOMM = 0xe2, /* Begin named common block */ 127 N_ECOMM = 0xe4, /* End named common block */ 128 N_ECOML = 0xe8, /* Member of a common block */ 129 N_WITH = 0xea, /* Solaris2: Pascal "with" statement */ 130 N_NBTEXT = 0xf0, 131 N_NBDATA = 0xf2, 132 N_NBBSS = 0xf4, 133 N_NBSTS = 0xf6, 134 N_NBLCS = 0xf8, 135 N_LENG = 0xfe /* Second symbol entry whih a length-value for the preceding entry */ 136 }; 137 138 enum stab_source_file { 139 N_SO_AS = 0x01, 140 N_SO_C = 0x02, 141 N_SO_ANSI_C = 0x03, 142 N_SO_CC = 0x04, 143 N_SO_FORTRAN = 0x05, 144 N_SO_PASCAL = 0x06, 145 N_SO_FORTRAN90 = 0x07, 146 N_SO_OBJC = 0x32, 147 N_SO_OBJCPLUS = 0x33 148 }; 149 150 #endif /* STABS_H_ */ 151