1 /* Copyright (C) 2021 Free Software Foundation, Inc. 2 Contributed by Oracle. 3 4 This file is part of GNU Binutils. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, 51 Franklin Street - Fifth Floor, Boston, 19 MA 02110-1301, USA. */ 20 21 /* 22 * This file gives definitions supplementing <a.out.h> 23 * for debugging symbol table entries. 24 * These entries must have one of the N_STAB bits on, 25 * and are subject to relocation according to the masks in <a.out.h> 26 * on 4.x (stabs not relocated on SVR4). 27 */ 28 29 #ifndef _STAB_H 30 #define _STAB_H 31 32 /* this file also contains fragments of a.out.h relevant to 33 * support of stab processing within ELF files 34 * (when a.out.h is not available) 35 */ 36 struct stab 37 { 38 unsigned n_strx; /* index into file string table */ 39 unsigned char n_type; /* type flag (N_TEXT,..) */ 40 char n_other; /* used by N_SLINE stab */ 41 short n_desc; /* see stabs documentation */ 42 unsigned n_value; /* value of symbol (or sdb offset) */ 43 }; 44 45 /* patchtypes for N_PATCH stab (n_desc field) */ 46 #define P_BITFIELD 0x1 47 #define P_SPILL 0x2 48 #define P_SCOPY 0x3 49 50 /* markers for N_CODETAG stab (n_other field) */ 51 #define CODETAG_BITFIELD 0x1 /* load/store of a bit field */ 52 #define CODETAG_SPILL 0x2 /* spill of registers */ 53 #define CODETAG_SCOPY 0x3 /* structure copy load/store */ 54 #define CODETAG_FSTART 0x4 /* points to first inst of new frame (0==leaf)*/ 55 #define CODETAG_END_CTORS 0x5 /* end of calls to super-class constructors */ 56 /* UNUSED 0x6 DW_ATCF_SUN_branch_target in dwarf, not used in stabs */ 57 #define CODETAG_STACK_PROBE 0x7 /* marks insns which probe the stack memory */ 58 59 /* 60 * Simple values for n_type. 61 */ 62 #define N_UNDF 0x0 /* undefined */ 63 #define N_ABS 0x2 /* absolute */ 64 #define N_TEXT 0x4 /* text */ 65 #define N_DATA 0x6 /* data */ 66 #define N_BSS 0x8 /* bss */ 67 #define N_COMM 0x12 /* common (internal to ld) */ 68 #define N_FN 0x1f /* file name symbol */ 69 #define N_EXT 01 /* external bit, or'ed in */ 70 #define N_TYPE 0x1e /* mask for all the type bits */ 71 72 /* 73 * maximum length of stab string before using continuation stab. 74 * (this is just a suggested limit), assembler has no limit. 75 */ 76 #define MAX_STAB_STR_LEN 250 77 78 /* 79 * for symbolic debuggers: 80 */ 81 #define N_GSYM 0x20 /* global symbol: name,,0,type,0 */ 82 #define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */ 83 #define N_FUN 0x24 /* procedure: name,,0,linenumber,0 */ 84 #define N_OUTL 0x25 /* outlined func: name,,0,linenumber,0 */ 85 #define N_STSYM 0x26 /* static symbol: name,,0,type,0 or section relative */ 86 #define N_TSTSYM 0x27 /* thread static symbol: Ttdata.data */ 87 #define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,0 or section relative */ 88 #define N_TLCSYM 0x29 /* thread local symbol: Ttbss.bss */ 89 #define N_MAIN 0x2a /* name of main routine : name,,0,0,0 */ 90 #define N_ROSYM 0x2c /* ro_data: name,,0,type,0 or section relative */ 91 #define N_FLSYM 0x2e /* fragmented data: name,,0,type,0 */ 92 #define N_TFLSYM 0x2f /* thread fragmented data: name,,0,type,0 */ 93 #define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */ 94 #define N_CMDLINE 0x34 /* command line info */ 95 #define N_OBJ 0x38 /* object file path or name */ 96 #define N_OPT 0x3c /* compiler options */ 97 #define N_RSYM 0x40 /* register sym: name,,0,type,register */ 98 #define N_SLINE 0x44 /* src line: 0,,0,linenumber,function relative */ 99 #define N_XLINE 0x45 /* h.o. src line: 0,,0,linenumber>>16,0 */ 100 #define N_ILDPAD 0x4c /* now used as ild pad stab value=strtab delta 101 * was designed for "function start.end" */ 102 #define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */ 103 #define N_ENDM 0x62 /* last stab emitted for object module */ 104 #define N_SO 0x64 /* source file name: name,,0,0,0 */ 105 #define N_MOD 0x66 /* f90 module: name,,0,0,0 */ 106 #define N_EMOD 0x68 /* end of f90 module: name,,0,0,0 */ 107 #define N_READ_MOD 0x6a /* use of f90 module: name;locallist,,0,0,0 */ 108 #define N_ALIAS 0x6c /* alias name: name,,0,0,0 */ 109 #define N_LSYM 0x80 /* local sym: name,,0,type,offset */ 110 #define N_BINCL 0x82 /* header file: name,,0,0,0 */ 111 #define N_SOL 0x84 /* #included file name: name,,0,0,0 */ 112 #define N_PSYM 0xa0 /* parameter: name,,0,type,offset */ 113 #define N_EINCL 0xa2 /* end of include file */ 114 #define N_ENTRY 0xa4 /* alternate entry: name,linenumber,0 */ 115 #define N_SINCL 0xa6 /* shared include file */ 116 #define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,function relative */ 117 #define N_EXCL 0xc2 /* excluded include file */ 118 #define N_USING 0xc4 /* C++ using command */ 119 #define N_ISYM 0xc6 /* position independent type symbol, internal */ 120 #define N_ESYM 0xc8 /* position independent type symbol, external */ 121 #define N_PATCH 0xd0 /* Instruction to be ignored by run-time checking. */ 122 #define N_CONSTRUCT 0xd2 /* C++ constructor call. */ 123 #define N_DESTRUCT 0xd4 /* C++ destructor call. */ 124 #define N_CODETAG 0xd8 /* Generic code tag */ 125 #define N_FUN_CHILD 0xd9 /* Identifies a child function */ 126 #define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,function relative */ 127 #define N_BCOMM 0xe2 /* begin common: name,, */ 128 #define N_TCOMM 0xe3 /* begin task common: name,, */ 129 #define N_ECOMM 0xe4 /* end task_common/common: name,, */ 130 #define N_XCOMM 0xe6 /* excluded common block */ 131 #define N_ECOML 0xe8 /* end common (local name): ,,address */ 132 #define N_WITH 0xea /* pascal with statement: type,,0,0,offset */ 133 #define N_LENG 0xfe /* second stab entry with length information */ 134 135 /* 136 * for analyzer (cache profile feedback support) 137 */ 138 #define N_CPROF 0xf0 /* annotation for cache profile feedback */ 139 140 /* 141 * n_descr values used in N_CPROF stabs. The n_descr field of 142 * an N_CPROF stab identifies the type of table whose location 143 * is defined by the N_CPROF stab. 144 */ 145 typedef enum n_cprof_instr_type_t 146 { 147 N_CPROF_INSTR_TYPE_LOAD = 0, /* profiled load ops */ 148 N_CPROF_INSTR_TYPE_STORE, /* profiled store ops */ 149 N_CPROF_INSTR_TYPE_PREFETCH, /* profiled prefetch ops */ 150 N_CPROF_INSTR_TYPE_BRTARGET, /* branch target locations */ 151 N_CPROF_INSTR_TYPE_NTYPES /* number of types */ 152 } n_cprof_instr_type_t; 153 154 /* 155 * for code browser only 156 */ 157 #define N_BROWS 0x48 /* path to associated .cb file */ 158 159 /* 160 * for functions -- n_other bits for N_FUN stab 161 */ 162 #define N_FUN_PURE (1 << 0) 163 #define N_FUN_ELEMENTAL (1 << 1) 164 #define N_FUN_RECURSIVE (1 << 2) 165 #define N_FUN_AMD64_PARMDUMP (1 << 3) 166 167 /* 168 * for variables -- n_other bits for N_LSYM, N_GSYM, N_LCSYM, N_STSYM, ... 169 */ 170 #define N_SYM_OMP_TLS (1 << 3) 171 172 /* 173 * Optional language designations for N_SO (n_desc field) 174 */ 175 #define N_SO_AS 1 /* Assembler */ 176 #define N_SO_C 2 /* C */ 177 #define N_SO_ANSI_C 3 /* ANSI C */ 178 #define N_SO_CC 4 /* C++ */ 179 #define N_SO_FORTRAN 5 /* Fortran 77 */ 180 #define N_SO_FORTRAN77 5 /* Fortran 77 */ 181 #define N_SO_PASCAL 6 /* Pascal */ 182 #define N_SO_FORTRAN90 7 /* Fortran 90 */ 183 #define N_SO_JAVA 8 /* Java */ 184 #define N_SO_C99 9 /* C99 */ 185 186 /* 187 * Floating point type values (encoded in "R" type specification string) 188 */ 189 #define NF_NONE 0 /* Undefined type */ 190 #define NF_SINGLE 1 /* Float IEEE 32 bit floating point */ 191 #define NF_DOUBLE 2 /* Double IEEE 64 bit floating point */ 192 #define NF_COMPLEX 3 /* Complex (2 32bit floats) */ 193 #define NF_COMPLEX16 4 /* Complex (2 64bit doubles) */ 194 #define NF_COMPLEX32 5 /* Complex (2 128bit long doubles) */ 195 #define NF_LDOUBLE 6 /* Long double 128 bit floating point */ 196 #define NF_INTERARITH 7 /* Interval (2 32bit floats) */ 197 #define NF_DINTERARITH 8 /* Interval (2 64bit doubles) */ 198 #define NF_QINTERARITH 9 /* Interval (2 128bit long doubles) */ 199 #define NF_IMAGINARY 10 /* Imaginary (1 32bit floats) */ 200 #define NF_DIMAGINARY 11 /* Imaginary (1 64bit doubles) */ 201 #define NF_QIMAGINARY 12 /* Imaginary (1 128bit long doubles) */ 202 203 #endif 204 205 206