Home | History | Annotate | Line # | Download | only in ddb
db_sym.h revision 1.2
      1 /*
      2  * Mach Operating System
      3  * Copyright (c) 1991,1990 Carnegie Mellon University
      4  * All Rights Reserved.
      5  *
      6  * Permission to use, copy, modify and distribute this software and its
      7  * documentation is hereby granted, provided that both the copyright
      8  * notice and this permission notice appear in all copies of the
      9  * software, derivative works or modified versions, and any portions
     10  * thereof, and that both notices appear in supporting documentation.
     11  *
     12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
     13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
     14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     15  *
     16  * Carnegie Mellon requests users of this software to return to
     17  *
     18  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     19  *  School of Computer Science
     20  *  Carnegie Mellon University
     21  *  Pittsburgh PA 15213-3890
     22  *
     23  * any improvements or extensions that they make and grant Carnegie the
     24  * rights to redistribute these changes.
     25  */
     26 /*
     27  * $Id: db_sym.h,v 1.2 1993/05/20 03:39:32 cgd Exp $
     28  *
     29  * HISTORY
     30  * $Log: db_sym.h,v $
     31  * Revision 1.2  1993/05/20 03:39:32  cgd
     32  * add explicit rcs id
     33  *
     34  * Revision 1.1.1.1  1993/03/21  09:46:27  cgd
     35  * initial import of 386bsd-0.1 sources
     36  *
     37  * Revision 1.1  1992/03/25  21:45:29  pace
     38  * Initial revision
     39  *
     40  * Revision 2.3  91/02/05  17:07:12  mrt
     41  * 	Changed to new Mach copyright
     42  * 	[91/01/31  16:19:27  mrt]
     43  *
     44  * Revision 2.2  90/08/27  21:52:39  dbg
     45  * 	Changed type of db_sym_t to char * - it's a better type for an
     46  * 	opaque pointer.
     47  * 	[90/08/22            dbg]
     48  *
     49  * 	Created.
     50  * 	[90/08/19            af]
     51  *
     52  */
     53 /*
     54  * 	Author: Alessandro Forin, Carnegie Mellon University
     55  *	Date:	8/90
     56  */
     57 
     58 /*
     59  * This module can handle multiple symbol tables
     60  */
     61 typedef struct {
     62 	char		*name;		/* symtab name */
     63 	char		*start;		/* symtab location */
     64 	char		*end;
     65 	char		*private;	/* optional machdep pointer */
     66 } db_symtab_t;
     67 
     68 extern db_symtab_t	*db_last_symtab; /* where last symbol was found */
     69 
     70 /*
     71  * Symbol representation is specific to the symtab style:
     72  * BSD compilers use dbx' nlist, other compilers might use
     73  * a different one
     74  */
     75 typedef	char *		db_sym_t;	/* opaque handle on symbols */
     76 #define	DB_SYM_NULL	((db_sym_t)0)
     77 
     78 /*
     79  * Non-stripped symbol tables will have duplicates, for instance
     80  * the same string could match a parameter name, a local var, a
     81  * global var, etc.
     82  * We are most concern with the following matches.
     83  */
     84 typedef int		db_strategy_t;	/* search strategy */
     85 
     86 #define	DB_STGY_ANY	0			/* anything goes */
     87 #define DB_STGY_XTRN	1			/* only external symbols */
     88 #define DB_STGY_PROC	2			/* only procedures */
     89 
     90 extern boolean_t	db_qualify_ambiguous_names;
     91 					/* if TRUE, check across symbol tables
     92 					 * for multiple occurrences of a name.
     93 					 * Might slow down quite a bit */
     94 
     95 /*
     96  * Functions exported by the symtable module
     97  */
     98 extern void	db_add_symbol_table();
     99 					/* extend the list of symbol tables */
    100 
    101 extern int	db_value_of_name(/* char*, db_expr_t* */);
    102 					/* find symbol value given name */
    103 
    104 extern db_sym_t	db_search_symbol(/* db_expr_t, db_strategy_t, int* */);
    105 					/* find symbol given value */
    106 
    107 extern void	db_symbol_values(/* db_sym_t, char**, db_expr_t* */);
    108 					/* return name and value of symbol */
    109 
    110 #define db_find_sym_and_offset(val,namep,offp)	\
    111 	db_symbol_values(db_search_symbol(val,DB_STGY_ANY,offp),namep,0)
    112 					/* find name&value given approx val */
    113 
    114 #define db_find_xtrn_sym_and_offset(val,namep,offp)	\
    115 	db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0)
    116 					/* ditto, but no locals */
    117 
    118 extern int	db_eqname(/* char*, char*, char */);
    119 					/* strcmp, modulo leading char */
    120 
    121 extern void	db_printsym(/* db_expr_t, db_strategy_t */);
    122 					/* print closest symbol to a value */
    123