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@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.3 1993/07/22 13:03:01 brezak Exp $ 28 * 29 * HISTORY 30 * $Log: db_sym.h,v $ 31 * Revision 1.3 1993/07/22 13:03:01 brezak 32 * Allow adding more than one symbol table at runtime. For LKM. 33 * 34 * Revision 1.2 1993/05/20 03:39:32 cgd 35 * add explicit rcs id 36 * 37 * Revision 1.1.1.1 1993/03/21 09:46:27 cgd 38 * initial import of 386bsd-0.1 sources 39 * 40 * Revision 1.1 1992/03/25 21:45:29 pace 41 * Initial revision 42 * 43 * Revision 2.3 91/02/05 17:07:12 mrt 44 * Changed to new Mach copyright 45 * [91/01/31 16:19:27 mrt] 46 * 47 * Revision 2.2 90/08/27 21:52:39 dbg 48 * Changed type of db_sym_t to char * - it's a better type for an 49 * opaque pointer. 50 * [90/08/22 dbg] 51 * 52 * Created. 53 * [90/08/19 af] 54 * 55 */ 56 /* 57 * Author: Alessandro Forin, Carnegie Mellon University 58 * Date: 8/90 59 */ 60 61 /* 62 * This module can handle multiple symbol tables 63 */ 64 typedef struct { 65 char *name; /* symtab name */ 66 char *start; /* symtab location */ 67 char *end; 68 char *private; /* optional machdep pointer */ 69 } db_symtab_t; 70 71 extern db_symtab_t *db_last_symtab; /* where last symbol was found */ 72 73 /* 74 * Symbol representation is specific to the symtab style: 75 * BSD compilers use dbx' nlist, other compilers might use 76 * a different one 77 */ 78 typedef char * db_sym_t; /* opaque handle on symbols */ 79 #define DB_SYM_NULL ((db_sym_t)0) 80 81 /* 82 * Non-stripped symbol tables will have duplicates, for instance 83 * the same string could match a parameter name, a local var, a 84 * global var, etc. 85 * We are most concern with the following matches. 86 */ 87 typedef int db_strategy_t; /* search strategy */ 88 89 #define DB_STGY_ANY 0 /* anything goes */ 90 #define DB_STGY_XTRN 1 /* only external symbols */ 91 #define DB_STGY_PROC 2 /* only procedures */ 92 93 extern boolean_t db_qualify_ambiguous_names; 94 /* if TRUE, check across symbol tables 95 * for multiple occurrences of a name. 96 * Might slow down quite a bit */ 97 98 /* 99 * Functions exported by the symtable module 100 */ 101 extern int db_add_symbol_table(); 102 /* extend the list of symbol tables */ 103 104 extern void db_del_symbol_table(/* char * */); 105 /* remove a symbol table from list */ 106 107 extern int db_value_of_name(/* char*, db_expr_t* */); 108 /* find symbol value given name */ 109 110 extern db_sym_t db_search_symbol(/* db_expr_t, db_strategy_t, int* */); 111 /* find symbol given value */ 112 113 extern void db_symbol_values(/* db_sym_t, char**, db_expr_t* */); 114 /* return name and value of symbol */ 115 116 #define db_find_sym_and_offset(val,namep,offp) \ 117 db_symbol_values(db_search_symbol(val,DB_STGY_ANY,offp),namep,0) 118 /* find name&value given approx val */ 119 120 #define db_find_xtrn_sym_and_offset(val,namep,offp) \ 121 db_symbol_values(db_search_symbol(val,DB_STGY_XTRN,offp),namep,0) 122 /* ditto, but no locals */ 123 124 extern int db_eqname(/* char*, char*, char */); 125 /* strcmp, modulo leading char */ 126 127 extern void db_printsym(/* db_expr_t, db_strategy_t */); 128 /* print closest symbol to a value */ 129