stab.h
  1  /*
  2   * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
  3   *
  4   * @APPLE_LICENSE_HEADER_START@
  5   * 
  6   * This file contains Original Code and/or Modifications of Original Code
  7   * as defined in and that are subject to the Apple Public Source License
  8   * Version 2.0 (the 'License'). You may not use this file except in
  9   * compliance with the License. Please obtain a copy of the License at
 10   * http://www.opensource.apple.com/apsl/ and read it before using this
 11   * file.
 12   * 
 13   * The Original Code and all software distributed under the License are
 14   * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 15   * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
 16   * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
 17   * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
 18   * Please see the License for the specific language governing rights and
 19   * limitations under the License.
 20   * 
 21   * @APPLE_LICENSE_HEADER_END@
 22   */
 23  #ifndef _MACHO_STAB_H_
 24  #define _MACHO_STAB_H_
 25  /*	$NetBSD: stab.h,v 1.4 1994/10/26 00:56:25 cgd Exp $	*/
 26  
 27  /*-
 28   * Copyright (c) 1991 The Regents of the University of California.
 29   * All rights reserved.
 30   *
 31   * Redistribution and use in source and binary forms, with or without
 32   * modification, are permitted provided that the following conditions
 33   * are met:
 34   * 1. Redistributions of source code must retain the above copyright
 35   *    notice, this list of conditions and the following disclaimer.
 36   * 2. Redistributions in binary form must reproduce the above copyright
 37   *    notice, this list of conditions and the following disclaimer in the
 38   *    documentation and/or other materials provided with the distribution.
 39   * 3. All advertising materials mentioning features or use of this software
 40   *    must display the following acknowledgement:
 41   *	This product includes software developed by the University of
 42   *	California, Berkeley and its contributors.
 43   * 4. Neither the name of the University nor the names of its contributors
 44   *    may be used to endorse or promote products derived from this software
 45   *    without specific prior written permission.
 46   *
 47   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 48   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 49   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 50   * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 51   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 52   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 53   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 54   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 55   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 56   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 57   * SUCH DAMAGE.
 58   *
 59   *	@(#)stab.h	5.2 (Berkeley) 4/4/91
 60   */
 61  
 62  /*
 63   * This file gives definitions supplementing <nlist.h> for permanent symbol
 64   * table entries of Mach-O files.  Modified from the BSD definitions.  The
 65   * modifications from the original definitions were changing what the values of
 66   * what was the n_other field (an unused field) which is now the n_sect field.
 67   * These modifications are required to support symbols in an arbitrary number of
 68   * sections not just the three sections (text, data and bss) in a BSD file.
 69   * The values of the defined constants have NOT been changed.
 70   *
 71   * These must have one of the N_STAB bits on.  The n_value fields are subject
 72   * to relocation according to the value of their n_sect field.  So for types
 73   * that refer to things in sections the n_sect field must be filled in with the
 74   * proper section ordinal.  For types that are not to have their n_value field 
 75   * relocatated the n_sect field must be NO_SECT.
 76   */
 77  
 78  /*
 79   * Symbolic debugger symbols.  The comments give the conventional use for
 80   * 
 81   * 	.stabs "n_name", n_type, n_sect, n_desc, n_value
 82   *
 83   * where n_type is the defined constant and not listed in the comment.  Other
 84   * fields not listed are zero. n_sect is the section ordinal the entry is
 85   * refering to.
 86   */
 87  #define	N_GSYM	0x20	/* global symbol: name,,NO_SECT,type,0 */
 88  #define	N_FNAME	0x22	/* procedure name (f77 kludge): name,,NO_SECT,0,0 */
 89  #define	N_FUN	0x24	/* procedure: name,,n_sect,linenumber,address */
 90  #define	N_STSYM	0x26	/* static symbol: name,,n_sect,type,address */
 91  #define	N_LCSYM	0x28	/* .lcomm symbol: name,,n_sect,type,address */
 92  #define N_BNSYM 0x2e	/* begin nsect sym: 0,,n_sect,0,address */
 93  #define N_AST	0x32	/* AST file path: name,,NO_SECT,0,0 */
 94  #define N_OPT	0x3c	/* emitted with gcc2_compiled and in gcc source */
 95  #define	N_RSYM	0x40	/* register sym: name,,NO_SECT,type,register */
 96  #define	N_SLINE	0x44	/* src line: 0,,n_sect,linenumber,address */
 97  #define N_ENSYM 0x4e	/* end nsect sym: 0,,n_sect,0,address */
 98  #define	N_SSYM	0x60	/* structure elt: name,,NO_SECT,type,struct_offset */
 99  #define	N_SO	0x64	/* source file name: name,,n_sect,0,address */
100  #define	N_OSO	0x66	/* object file name: name,,0,0,st_mtime */
101  #define	N_LSYM	0x80	/* local sym: name,,NO_SECT,type,offset */
102  #define N_BINCL	0x82	/* include file beginning: name,,NO_SECT,0,sum */
103  #define	N_SOL	0x84	/* #included file name: name,,n_sect,0,address */
104  #define	N_PARAMS  0x86	/* compiler parameters: name,,NO_SECT,0,0 */
105  #define	N_VERSION 0x88	/* compiler version: name,,NO_SECT,0,0 */
106  #define	N_OLEVEL  0x8A	/* compiler -O level: name,,NO_SECT,0,0 */
107  #define	N_PSYM	0xa0	/* parameter: name,,NO_SECT,type,offset */
108  #define N_EINCL	0xa2	/* include file end: name,,NO_SECT,0,0 */
109  #define	N_ENTRY	0xa4	/* alternate entry: name,,n_sect,linenumber,address */
110  #define	N_LBRAC	0xc0	/* left bracket: 0,,NO_SECT,nesting level,address */
111  #define N_EXCL	0xc2	/* deleted include file: name,,NO_SECT,0,sum */
112  #define	N_RBRAC	0xe0	/* right bracket: 0,,NO_SECT,nesting level,address */
113  #define	N_BCOMM	0xe2	/* begin common: name,,NO_SECT,0,0 */
114  #define	N_ECOMM	0xe4	/* end common: name,,n_sect,0,0 */
115  #define	N_ECOML	0xe8	/* end common (local name): 0,,n_sect,0,address */
116  #define	N_LENG	0xfe	/* second stab entry with length information */
117  
118  /*
119   * for the berkeley pascal compiler, pc(1):
120   */
121  #define	N_PC	0x30	/* global pascal symbol: name,,NO_SECT,subtype,line */
122  
123  #endif /* _MACHO_STAB_H_ */